@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600&family=Inter:wght@400;500;600;700&family=Playfair+Display:wght@400;500;600;700&family=Cormorant+Garamond:wght@400;500;600;700&family=Manrope:wght@500;600;700&display=swap');

:root {
    --bg-primary: #0f0d0b;
    --bg-secondary: rgba(18, 15, 12, 0.78);
    --bg-card: rgba(28, 24, 20, 0.86);
    --bg-card-alt: rgba(28, 24, 20, 0.64);
    --border-soft: rgba(255, 245, 230, 0.10);
    --border-highlight: rgba(198, 168, 124, 0.6);
    --text-primary: #faf6f0;
    --text-secondary: rgba(245, 238, 226, 0.72);
    --text-muted: rgba(210, 196, 174, 0.56);
    --accent: #c6a87c;
    --accent-primary: #c6a87c;
    --accent-primary-rgb: 198, 168, 124;
    --accent-strong: #a67c52;
    --success: #7cb88a;
    --success-rgb: 124, 184, 138;
    --danger: #c45e5e;
    --danger-rgb: 196, 94, 94;
    --shadow-soft: 0 24px 60px -32px rgba(12, 10, 6, 0.8);
    --shadow-intense: 0 32px 80px -36px rgba(20, 16, 10, 0.9);
    --glass-blur: saturate(120%) blur(22px);

    --radius-sm: 10px;
    --radius-md: 14px;
    --radius-lg: 18px;
    --radius-xl: 22px;
}

* {
    box-sizing: border-box;
}

html {
    background: #0f0d0b;
}

body {
    margin: 0;
    font-family: 'Inter', 'Manrope', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: radial-gradient(circle at 20% 120%, rgba(198, 168, 124, 0.12), transparent 40%),
                radial-gradient(circle at 80% -10%, rgba(166, 124, 82, 0.14), transparent 46%),
                linear-gradient(135deg, #0f0d0b, #17130e 48%, #0f0d0b 100%);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    color-scheme: dark;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: geometricPrecision;
}

/* Composer: deep warm page background */
body.composer {
    background: radial-gradient(circle at 18% 115%, rgba(198, 168, 124, 0.06), transparent 42%),
                radial-gradient(circle at 82% -8%, rgba(166, 124, 82, 0.04), transparent 48%),
                linear-gradient(135deg, #0c0a08, #0a0806 52%, #0c0a08 100%);
}

/* Video Pipeline: deep warm page background */
body.pipeline {
    background: radial-gradient(circle at 18% 115%, rgba(198, 168, 124, 0.06), transparent 42%),
                radial-gradient(circle at 82% -8%, rgba(166, 124, 82, 0.04), transparent 48%),
                linear-gradient(135deg, #0c0a08, #0a0806 52%, #0c0a08 100%);
}

/* Studio Editing: deep warm page background */
body.studio-editing {
    background: radial-gradient(circle at 18% 115%, rgba(198, 168, 124, 0.06), transparent 42%),
                radial-gradient(circle at 82% -8%, rgba(166, 124, 82, 0.04), transparent 48%),
                linear-gradient(135deg, #0c0a08, #0a0806 52%, #0c0a08 100%);
}

/* Cloud Image Library: deeper warm background */
body.library {
    background: radial-gradient(circle at 18% 115%, rgba(198, 168, 124, 0.04), transparent 42%),
                radial-gradient(circle at 82% -8%, rgba(166, 124, 82, 0.025), transparent 48%),
                linear-gradient(135deg, #0a0806, #060503 52%, #0a0806 100%);
}

::selection {
    background: rgba(var(--accent-primary-rgb), 0.28);
    color: var(--text-primary);
}

/* Interior Design Typography */
.hero h1, .login-hero h1, .hero-video-overlay h1 {
    font-family: 'Playfair Display', 'Cormorant Garamond', Georgia, serif;
}

.eyebrow {
    font-family: 'Inter', 'Manrope', system-ui, sans-serif;
    letter-spacing: 0.18em;
}

body.has-modal {
    overflow: hidden;
}

.page {
    position: relative;
    padding: 0;
}


.page::after {
    width: 360px;
    height: 360px;
    bottom: -140px;
    left: -160px;
    background: radial-gradient(circle, rgba(96, 227, 199, 0.32) 0%, transparent 75%);
}

/* ============================================================
   Global top navigation — pill style (matches marketing page)
   ============================================================ */
.top-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 12px 22px;
    margin: 14px 24px 0;
    background: rgba(15, 13, 11, 0.62);
    -webkit-backdrop-filter: saturate(160%) blur(18px);
    backdrop-filter: saturate(160%) blur(18px);
    border: 1px solid rgba(198, 168, 124, 0.18);
    border-radius: 999px;
    position: sticky;
    top: 14px;
    z-index: 100;
    box-shadow: 0 18px 40px -22px rgba(0, 0, 0, 0.55);
    transition: top 0.32s ease, background 0.32s ease, border-color 0.32s ease, padding 0.32s ease, box-shadow 0.32s ease;
}
.top-nav.scrolled {
    top: 8px;
    padding: 10px 20px;
    background: rgba(15, 13, 11, 0.88);
    border-color: rgba(198, 168, 124, 0.32);
    box-shadow: 0 22px 50px -22px rgba(0, 0, 0, 0.7);
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    font-family: 'Playfair Display', 'Cormorant Garamond', Georgia, serif;
    font-size: 1.1rem;
    font-weight: 600;
    letter-spacing: 0.01em;
    text-transform: none;
    color: var(--text-primary);
    text-decoration: none;
    cursor: pointer;
    padding: 0;
    background: transparent;
    border: none;
    box-shadow: none;
    transition: color 0.2s ease;
}
.brand:hover { color: #fff; transform: none; box-shadow: none; }
.brand.brand-home,
.brand.brand-home:hover {
    padding: 0;
    background: transparent;
    border: none;
    box-shadow: none;
    transform: none;
}
.brand.brand-home:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(198, 168, 124, 0.32);
    border-radius: 999px;
}

.brand-logo {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: 1.5px solid #c6a87c;
    object-fit: cover;
    box-shadow: 0 0 0 2px rgba(198, 168, 124, 0.12);
}

.nav-actions {
    display: flex;
    align-items: center;
    gap: 22px;
}

.nav-actions a {
    position: relative;
    font-size: 0.92rem;
    font-weight: 500;
    color: var(--text-muted);
    text-decoration: none;
    padding: 6px 2px;
    border-radius: 0;
    border: none;
    background: transparent;
    transition: color 0.22s ease;
}
.nav-actions a::after {
    content: '';
    position: absolute;
    left: 0; right: 0; bottom: -4px;
    height: 1px;
    background: #c6a87c;
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.3s ease;
}
.nav-actions a:hover::after,
.nav-actions a[aria-current="page"]::after { transform: scaleX(1); }
.nav-actions a[aria-current="page"] { color: var(--text-primary); }

/* Hide Video Pipeline and Actor nav links */
.nav-actions a[href="/video-pipeline"],
.nav-actions a[href="/actors/catalog"],
.nav-actions a[href="/actors"] {
    display: none;
}

/* Account avatar button and dropdown */
.nav-account {
    position: relative;
}

.avatar-button {
    width: 40px;
    height: 40px;
    padding: 0;
    border-radius: 50%;
    border: 1.5px solid rgba(198, 168, 124, 0.5);
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-strong) 100%);
    cursor: pointer;
    overflow: hidden;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: none;
    font-size: 15px;
    font-weight: 600;
    color: white;
    text-transform: uppercase;
    transition: border-color 0.2s ease, transform 0.2s ease;
}
.avatar-button:hover { border-color: #c6a87c; transform: translateY(-1px); }

.avatar-button img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.account-dropdown {
    position: absolute;
    right: 0;
    top: 100%;
    min-width: 170px;
    padding: 8px;
    border-radius: 12px;
    background: rgba(28, 24, 20, 0.92);
    border: 1px solid rgba(255, 245, 230, 0.14);
    box-shadow: 0 16px 42px -18px rgba(12, 10, 6, 0.9);
    display: none;
    z-index: 200;
}

.account-dropdown a {
    display: block;
    padding: 10px 12px;
    border-radius: 8px;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 14px;
}

.account-dropdown a:hover {
    background: rgba(255, 248, 235, 0.06);
    color: var(--text-primary);
}

.nav-account:hover .account-dropdown,
.nav-account:focus-within .account-dropdown {
    display: block;
}

.nav-actions a:focus-visible {
    outline: none;
    color: var(--text-primary);
    box-shadow: 0 0 0 3px rgba(198, 168, 124, 0.28);
    border-radius: 6px;
}

.nav-actions a:hover {
    color: var(--text-primary);
    background: transparent;
    border-color: transparent;
}

.primary-action {
    background: linear-gradient(135deg, var(--accent), var(--accent-strong)) !important;
    color: #1a120a !important;
    font-weight: 600 !important;
    padding: 8px 18px !important;
    border-radius: 999px !important;
    box-shadow: 0 12px 26px -12px rgba(198, 168, 124, 0.55);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.primary-action::after { display: none !important; }

.primary-action:hover {
    transform: translateY(-1px);
    box-shadow: 0 16px 36px -14px rgba(198, 168, 124, 0.7);
}

.content {
    z-index: 2;
    display: grid;
    gap: clamp(32px, 4vw, 56px);
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    align-items: start;
    padding: clamp(40px, 5vw, 72px) clamp(36px, 6vw, 96px) clamp(60px, 5vw, 96px);
}

/* Home: align hero content with the left edge of the top-nav brand */
body.home .content {
    padding-left: 24px;
    padding-right: 24px;
}

/* Global: align all page content with the top-nav brand padding */
.page > main.content,
.page > .content {
    padding-left: 24px;
    padding-right: 24px;
}

/* Composer: same 20px gap under the sticky navbar */
body.composer main.content {
    padding-top: 20px;
}

/* Apply same 20px gap under sticky navbar for all pages using main.content */
main.content {
    padding-top: 20px;
}

/* Image Studio Results already manages its own internal padding. */
.image-studio-results-page .content {
    padding: 0;
}

.content.single-column {
    grid-template-columns: minmax(0, 1fr);
}

.hero {
    display: flex;
    flex-direction: column;
    gap: 20px;
    max-width: 520px;
}

body.home .hero {
    border: 1px solid rgba(255, 245, 230, 0.08);
    border-radius: 24px;
    padding: 24px;
}

.hero .prompt-box {
    margin-top: 12px;
}

.eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--text-muted);
    background: rgba(198, 168, 124, 0.1);
    border: 1px solid rgba(198, 168, 124, 0.25);
    border-radius: 999px;
    padding: 6px 14px;
    width: fit-content;
    backdrop-filter: blur(12px);
}

.hero h1 {
    font-size: clamp(34px, 4vw, 48px);
    line-height: 1.1;
    margin: 0;
    font-family: 'Playfair Display', 'Cormorant Garamond', Georgia, serif;
    font-weight: 700;
}

.hero p {
    margin: 0;
    color: var(--text-secondary);
    font-size: 16px;
    line-height: 1.7;
}

.hero-highlights {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 8px;
}

.hero-highlights .tag {
    flex: 1 1 auto;
    min-width: 160px;
    max-width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    justify-content: center;
}

.pinned-actor-card {
    margin-top: 28px;
    display: grid;
    grid-template-columns: minmax(160px, 200px) 1fr;
    gap: 24px;
    padding: 24px;
    border-radius: 24px;
    border: 1px solid rgba(255, 248, 235, 0.08);
    background: linear-gradient(135deg, rgba(36, 30, 24, 0.82), rgba(28, 24, 20, 0.68));
    box-shadow: 0 18px 42px rgba(8, 12, 24, 0.38);
}

.pinned-actor-thumb {
    border-radius: 18px;
    overflow: hidden;
    background: rgba(255, 248, 235, 0.04);
    display: flex;
    align-items: center;
    justify-content: center;
    aspect-ratio: 2 / 3;
}

.pinned-actor-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.pinned-actor-details {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.pinned-actor-meta {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
}

.pinned-actor-meta .status-hint {
    color: var(--text-muted);
    font-size: 12px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.pinned-actor-details h2 {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
}

.pinned-actor-details p {
    margin: 0;
    color: var(--text-secondary);
    line-height: 1.6;
}

.pinned-actor-tags {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.pinned-actor-tags .tag {
    background: rgba(198, 168, 124, 0.16);
    border: 1px solid rgba(198, 168, 124, 0.38);
    color: #f5efe5;
}

.pinned-actor-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 6px;
}

.pinned-actor-list li {
    font-size: 13px;
    color: var(--text-secondary);
}

.pinned-actor-list strong {
    color: var(--text-primary);
    font-weight: 600;
    margin-right: 4px;
}

.pinned-actor-links {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}

.pinned-actor-links .ghost-link {
    padding-left: 0;
}

.tag {
    padding: 9px 14px;
    border-radius: 12px;
    background: rgba(255, 248, 235, 0.05);
    border: 1px solid rgba(255, 248, 235, 0.08);
    color: var(--text-secondary);
    font-size: 13px;
    letter-spacing: 0.04em;
    backdrop-filter: blur(16px);
}

.tag.tag-link {
    display: inline-flex;
    align-items: center;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s ease;
    background: rgba(198, 168, 124, 0.1);
    border-color: rgba(198, 168, 124, 0.2);
    color: var(--accent-primary);
}

.tag.tag-link:hover {
    background: rgba(198, 168, 124, 0.2);
    border-color: rgba(198, 168, 124, 0.4);
}

/* Accent variant for tag links - uses success color */
.tag.tag-link.tag-link-accent {
    background: rgba(124, 184, 138, 0.1);
    border-color: rgba(124, 184, 138, 0.25);
    color: var(--success);
}

.tag.tag-link.tag-link-accent:hover {
    background: rgba(124, 184, 138, 0.2);
    border-color: rgba(124, 184, 138, 0.45);
}

.tag.danger {
    background: rgba(196, 94, 94, 0.1);
    border-color: rgba(196, 94, 94, 0.24);
    color: var(--danger);
}

.surface {
    background: var(--bg-card);
    border: 1px solid var(--border-soft);
    border-radius: 24px;
    padding: clamp(28px, 4vw, 36px);
    box-shadow: var(--shadow-soft);
    backdrop-filter: var(--glass-blur);
    position: relative;
    overflow: hidden;
}

#prompt-composer.surface {
    border-width: 4px;
    border-color: rgba(198, 168, 124, 0.95);
    box-shadow:
        0 0 24px rgba(198, 168, 124, 0.45),
        0 0 64px rgba(198, 168, 124, 0.35),
        var(--shadow-soft);
}

#prompt-composer.surface::after {
    content: "";
    position: absolute;
    inset: -6px;
    border-radius: inherit;
    background:
        radial-gradient(circle at 20% 15%, rgba(111, 203, 255, 0.35), transparent 60%),
        radial-gradient(circle at 80% 80%, rgba(121, 106, 255, 0.32), transparent 65%);
    filter: blur(20px);
    opacity: 0.9;
    pointer-events: none;
    z-index: 0;
}

#actor-composer.surface {
    border-width: 4px;
    border-color: rgba(198, 168, 124, 0.95);
}

#account-settings.surface {
    border-width: 4px;
    border-color: rgba(198, 168, 124, 0.95);
    box-shadow:
        0 0 24px rgba(198, 168, 124, 0.45),
        0 0 64px rgba(198, 168, 124, 0.35),
        var(--shadow-soft);
}

#account-settings.surface::after {
    content: "";
    position: absolute;
    inset: -6px;
    border-radius: inherit;
    background:
        radial-gradient(circle at 20% 15%, rgba(111, 203, 255, 0.35), transparent 60%),
        radial-gradient(circle at 80% 80%, rgba(121, 106, 255, 0.32), transparent 65%);
    filter: blur(20px);
    opacity: 0.9;
    pointer-events: none;
    z-index: 0;
}

#subscription.surface {
    border-width: 4px;
    border-color: rgba(198, 168, 124, 0.95);
    box-shadow:
        0 0 24px rgba(198, 168, 124, 0.45),
        0 0 64px rgba(198, 168, 124, 0.35),
        var(--shadow-soft);
}

#subscription.surface::after {
    content: "";
    position: absolute;
    inset: -6px;
    border-radius: inherit;
    background:
        radial-gradient(circle at 20% 15%, rgba(111, 203, 255, 0.35), transparent 60%),
        radial-gradient(circle at 80% 80%, rgba(121, 106, 255, 0.32), transparent 65%);
    filter: blur(20px);
    opacity: 0.9;
    pointer-events: none;
    z-index: 0;
}

#payment-methods.surface {
    border-width: 4px;
    border-color: rgba(198, 168, 124, 0.95);
    box-shadow:
        0 0 24px rgba(198, 168, 124, 0.45),
        0 0 64px rgba(198, 168, 124, 0.35),
        var(--shadow-soft);
}

#payment-methods.surface::after {
    content: "";
    position: absolute;
    inset: -6px;
    border-radius: inherit;
    background:
        radial-gradient(circle at 20% 15%, rgba(111, 203, 255, 0.35), transparent 60%),
        radial-gradient(circle at 80% 80%, rgba(121, 106, 255, 0.32), transparent 65%);
    filter: blur(20px);
    opacity: 0.9;
    pointer-events: none;
    z-index: 0;
}

#payment-history.surface {
    border-width: 4px;
    border-color: rgba(198, 168, 124, 0.95);
    box-shadow:
        0 0 24px rgba(198, 168, 124, 0.45),
        0 0 64px rgba(198, 168, 124, 0.35),
        var(--shadow-soft);
}

#payment-history.surface::after {
    content: "";
    position: absolute;
    inset: -6px;
    border-radius: inherit;
    background:
        radial-gradient(circle at 20% 15%, rgba(111, 203, 255, 0.35), transparent 60%),
        radial-gradient(circle at 80% 80%, rgba(121, 106, 255, 0.32), transparent 65%);
    filter: blur(20px);
    opacity: 0.9;
    pointer-events: none;
    z-index: 0;
}

.surface::before {
    content: "";
    position: absolute;
    inset: -60% -15% 60%;
    background: linear-gradient(130deg, transparent 45%, rgba(198, 168, 124, 0.18) 65%, transparent 92%);
    opacity: 0.4;
    pointer-events: none;
}

.surface > * {
    position: relative;
    z-index: 1;
}

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

.surface header h2 {
    margin: 0;
    font-size: 22px;
    letter-spacing: -0.03em;
}

.surface header span {
    color: var(--text-muted);
    font-size: 14px;
}

.surface-render-status {
    width: calc(100% + 20%);
    margin-left: -10%;
    border-width: 6px;
    border-color: rgba(198, 168, 124, 0.95);
    box-sizing: border-box;
}

@media (max-width: 1024px) {
    .surface-render-status {
        width: 100%;
        margin-left: 0;
    }
}

.surface-roster {
    width: calc(100% + 30%);
    margin-left: -30%;
    border-width: 6px;
    border-color: rgba(198, 168, 124, 0.95);
    box-sizing: border-box;
    box-shadow:
        0 0 32px rgba(198, 168, 124, 0.38),
        0 0 90px rgba(60, 96, 198, 0.32),
        var(--shadow-soft);
}

.surface-roster::after {
    content: "";
    position: absolute;
    inset: 14px;
    border-radius: inherit;
    border: 1px solid rgba(147, 189, 255, 0.4);
    box-shadow: inset 0 0 42px rgba(198, 168, 124, 0.2);
    pointer-events: none;
    z-index: 0;
}

@media (max-width: 1200px) {
    .surface-roster {
        width: 100%;
        margin-left: 0;
    }
}

.surface-shot-reel {
    width: 100%;
    margin-left: 0;
    box-sizing: border-box;
    min-height: 100%;
    background: var(--bg-card);
    border: 4px solid rgba(198, 168, 124, 0.95);
    border-radius: 24px;
    padding: clamp(28px, 4vw, 36px);
    box-shadow:
        0 0 24px rgba(198, 168, 124, 0.45),
        0 0 64px rgba(198, 168, 124, 0.35),
        var(--shadow-soft);
    backdrop-filter: var(--glass-blur);
    position: relative;
    overflow: hidden;
}

.surface-shot-reel::after {
    content: "";
    position: absolute;
    inset: -6px;
    border-radius: inherit;
    background:
        radial-gradient(circle at 20% 15%, rgba(111, 203, 255, 0.35), transparent 60%),
        radial-gradient(circle at 80% 80%, rgba(121, 106, 255, 0.32), transparent 65%);
    filter: blur(20px);
    opacity: 0.9;
    pointer-events: none;
    z-index: 0;
}

.surface-shot-reel > * {
    position: relative;
    z-index: 1;
}

.content.results-layout {
    grid-template-columns: minmax(340px, 460px) 1fr;
    grid-template-areas: "hero shot";
    gap: 24px;
    align-items: start;
    padding-left: 24px;
    padding-right: 24px;
}

/* Two-column layout for pipeline view without hero panel */
.content.results-layout.pipeline-only {
    grid-template-columns: minmax(340px, 460px) 1fr;
    grid-template-areas: "pipeline shot";
    gap: 24px;
    align-items: start;
}

.results-layout > .results-hero-panel {
    grid-area: hero;
    max-width: 460px;
}

.results-layout > .results-sidebar {
    grid-area: pipeline;
}

.results-layout > .surface-shot-reel {
    grid-area: shot;
    width: 100%;
    max-width: none;
    flex: 1;
}

/* Reset margins for pipeline-only layout */
.results-layout.pipeline-only > .results-sidebar {
    margin-left: 0;
    max-width: 460px;
}

.results-layout.pipeline-only > .surface-shot-reel {
    width: 100%;
    margin-left: 0;
    max-width: none;
    flex: 1;
}

.results-sidebar {
    position: static;
    padding: 24px;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    margin-left: 0;
    margin-top: 24px;
}

.results-hero-panel {
    padding: clamp(24px, 3vw, 36px);
    border: 1px solid rgba(255, 248, 235, 0.12);
    border-radius: 24px;
    background: rgba(7, 11, 26, 0.72);
    box-shadow: inset 0 1px 0 rgba(255, 248, 235, 0.08);
}

/* Results page body styling to match Composer */
body.results-page main.content {
    padding-top: 20px;
}

body.results-page .results-hero-panel {
    border: 1px solid rgba(255, 248, 235, 0.08);
    border-radius: 24px;
    padding: 24px;
}

.results-sidebar-header {
    margin-bottom: 20px;
}

.results-pipeline-summary {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 20px 22px;
    border-radius: 20px;
    border: 1px solid rgba(255, 248, 235, 0.08);
    background: linear-gradient(135deg, rgba(24, 32, 58, 0.95), rgba(31, 46, 92, 0.8));
    box-shadow: inset 0 1px 0 rgba(255, 248, 235, 0.08);
}

.results-pipeline-summary-left {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}

.results-pipeline-summary-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px;
    border-radius: 999px;
    font-size: 12px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-primary);
    background: rgba(198, 168, 124, 0.18);
    border: 1px solid rgba(198, 168, 124, 0.35);
}

.results-pipeline-summary-count {
    display: flex;
    align-items: baseline;
    gap: 6px;
    font-weight: 600;
}

.results-pipeline-summary-count-number {
    font-size: 26px;
    line-height: 1;
    font-family: 'Manrope', 'Inter', system-ui, sans-serif;
}

.results-pipeline-summary-count-label {
    font-size: 13px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.results-pipeline-summary-text {
    margin: 0;
    font-size: 14px;
    line-height: 1.5;
    color: var(--text-secondary);
}

.results-sidebar-list {
    list-style: none;
    margin: 20px 0 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.results-sidebar-item {
    border: 1px solid rgba(255, 248, 235, 0.1);
    border-radius: 18px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.results-sidebar-item.is-active {
    border-color: rgba(198, 168, 124, 0.6);
    box-shadow: 0 0 0 1px rgba(198, 168, 124, 0.3);
}

.results-sidebar-item.is-complete {
    border-color: rgba(124, 184, 138, 0.9);
    box-shadow: 0 0 0 1px rgba(124, 184, 138, 0.45);
}

.results-sidebar-link {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px 16px 8px;
    text-decoration: none;
    color: inherit;
}

.results-sidebar-index {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(198, 168, 124, 0.15);
    color: var(--text-primary);
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
}

.results-sidebar-body {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.results-sidebar-body strong {
    font-size: 15px;
    line-height: 1.2;
}

.results-sidebar-status {
    font-size: 13px;
    color: var(--text-muted);
    text-transform: capitalize;
}

.results-sidebar-item.is-complete .results-sidebar-status {
    color: var(--success);
}

.results-sidebar-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    padding: 12px 16px 16px;
}

.results-sidebar-actions .action-button {
    font-size: 11px;
    font-weight: 600;
    padding: 10px 12px;
    text-align: center;
    justify-content: center;
    border-radius: 8px;
    letter-spacing: 0.02em;
}

.results-sidebar-actions .ghost-link {
    font-size: 11px;
    font-weight: 500;
    text-align: center;
    padding: 10px 12px;
    display: flex;
    justify-content: center;
    border-radius: 8px;
    background: rgba(255, 248, 235, 0.06);
    border: 1px solid rgba(255, 248, 235, 0.1);
    color: var(--text-secondary);
    transition: all 0.2s ease;
}

.results-sidebar-actions .ghost-link:hover {
    background: rgba(255, 248, 235, 0.1);
    border-color: rgba(255, 248, 235, 0.18);
    color: var(--text-primary);
}

/* Sidebar segment details - storyboard, dialog, prompt */
.results-sidebar-details {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 0 16px 12px;
}

.results-sidebar-storyboard {
    width: 100%;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid rgba(255, 248, 235, 0.08);
}

.results-sidebar-storyboard-img {
    width: 100%;
    height: auto;
    display: block;
    object-fit: cover;
    max-height: 120px;
}

.results-sidebar-dialog,
.results-sidebar-prompt {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.results-sidebar-detail-label {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--accent-primary);
    font-weight: 600;
}

.results-sidebar-detail-text {
    margin: 0;
    font-size: 12px;
    line-height: 1.5;
    color: var(--text-muted);
    background: rgba(0, 0, 0, 0.2);
    padding: 8px 10px;
    border-radius: 6px;
    border: 1px solid rgba(255, 248, 235, 0.05);
}

@media (max-width: 1600px) {
    .content.results-layout {
        grid-template-columns: minmax(340px, 420px) 1fr;
        gap: 24px;
    }
}

@media (max-width: 1200px) {
    .content.results-layout {
        grid-template-columns: minmax(300px, 380px) 1fr;
        grid-template-areas:
            "hero shot"
            "pipeline shot";
        gap: 20px;
    }
}

@media (max-width: 1024px) {
    .content.results-layout {
        grid-template-columns: 1fr;
        grid-template-areas:
            "hero"
            "pipeline"
            "shot";
    }

    .results-sidebar {
        position: static;
    }
}

.prompt-preview {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.prompt-preview header {
    margin-bottom: 0;
}

.prompt-preview header span {
    font-size: 13px;
    color: var(--text-secondary);
}

.prompt-window {
    margin: 0;
    padding: 24px;
    border-radius: 18px;
    background: linear-gradient(135deg, rgba(198, 168, 124, 0.18), rgba(30, 24, 16, 0.4));
    border: 1px solid rgba(198, 168, 124, 0.35);
    box-shadow: inset 0 1px 0 rgba(255, 248, 235, 0.08), 0 16px 42px -28px rgba(36, 64, 144, 0.9);
    color: var(--text-primary);
    font-size: 15px;
    line-height: 1.7;
    white-space: pre-wrap;
    word-break: break-word;
    scrollbar-width: thin;
    max-height: 320px;
    overflow: auto;
}

.prompt-window::-webkit-scrollbar {
    width: 6px;
}

.prompt-window::-webkit-scrollbar-track {
    background: rgba(8, 11, 20, 0.32);
    border-radius: 12px;
}

.prompt-window::-webkit-scrollbar-thumb {
    background: rgba(198, 168, 124, 0.55);
    border-radius: 12px;
}

.alert {
    border-radius: 16px;
    padding: 14px 18px;
    margin-bottom: 18px;
    border: 1px solid rgba(255, 248, 235, 0.12);
    background: rgba(28, 24, 20, 0.78);
    font-size: 14px;
    line-height: 1.5;
}

.alert-error {
    border-color: rgba(196, 94, 94, 0.4);
    background: rgba(196, 94, 94, 0.14);
    color: var(--danger);
}

.alert-info {
    border-color: rgba(198, 168, 124, 0.4);
    background: rgba(198, 168, 124, 0.12);
    color: var(--text-primary);
}

.alert-success {
    border-color: rgba(118, 214, 155, 0.4);
    background: rgba(118, 214, 155, 0.12);
    color: var(--text-primary);
}

.alert-warning {
    border-color: rgba(198, 168, 124, 0.4);
    background: rgba(198, 168, 124, 0.12);
    color: var(--text-primary);
}

.segment-helper.meta {
    font-size: 12px;
    color: var(--text-muted);
}

.segment-helper.warning {
    color: var(--danger);
}

.pipeline-layout {
    gap: clamp(28px, 3vw, 36px);
}

.pipeline-body {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: clamp(24px, 3vw, 32px);
}

.pipeline-body.has-results {
    align-items: start;
}

@media (min-width: 1100px) {
    .pipeline-body.has-results {
        grid-template-columns: minmax(0, 1.1fr) minmax(320px, 0.9fr);
    }
}

.pipeline-hero {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.pipeline-guide {
    margin-top: 8px;
    background: linear-gradient(135deg, rgba(198, 168, 124, 0.14), rgba(30, 24, 16, 0.32));
    border: 1px solid rgba(198, 168, 124, 0.26);
    border-radius: 20px;
    padding: 22px 24px;
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.pipeline-guide header {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.pipeline-guide h3 {
    margin: 0;
    font-size: 18px;
    letter-spacing: -0.01em;
}

.pipeline-guide header span {
    font-size: 13px;
    color: var(--text-muted);
}

.pipeline-checklist {
    margin: 16px 0;
    padding: 0 0 0 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    color: var(--text-secondary);
    font-size: 15px;
    line-height: 1.55;
}

.pipeline-checklist li::marker {
    color: var(--success);
    font-size: 13px;
}

.intro-meta {
    margin: 0;
    font-size: 13px;
    color: var(--text-muted);
}

.pipeline-hero h1 {
    margin-bottom: 12px;
}

.hero-slot-card {
    align-self: stretch;
    gap: 18px;
    background: rgba(21, 26, 44, 0.7);
    border-color: rgba(255, 248, 235, 0.14);
    box-shadow: 0 24px 52px -32px rgba(12, 22, 46, 0.72);
}

.hero-slot-card .segment-title {
    font-size: 15px;
    letter-spacing: 0.18em;
}

.hero-slot-card .segment-helper {
    margin: 0;
    color: rgba(245, 238, 226, 0.72);
}

.slot-buttons {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 12px;
}

.slot-pill {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border-radius: 999px;
    background: rgba(255, 248, 235, 0.04);
    border: 1px solid rgba(255, 248, 235, 0.14);
    color: rgba(255, 248, 235, 0.78);
    font-size: 15px;
    cursor: pointer;
    transition: border-color 0.2s ease, background-color 0.2s ease, color 0.2s ease;
    overflow: hidden;
}

.slot-pill input {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
}

.slot-pill span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 12px 18px;
    border-radius: 999px;
    transition: inherit;
}

.slot-pill:hover {
    border-color: rgba(255, 248, 235, 0.32);
}

.slot-pill input:checked + span {
    background: linear-gradient(135deg, #4f46e5, #06b6d4);
    color: #0f1014;
    font-weight: 600;
    box-shadow: 0 12px 28px -16px rgba(6, 182, 212, 0.65);
}

.slot-pill input:focus-visible + span {
    outline: 2px solid rgba(79, 70, 229, 0.9);
    outline-offset: 2px;
}

.slot-pill input:disabled + span {
    opacity: 0.4;
    cursor: not-allowed;
}

/* Pipeline parsed content preview */
.pipeline-parsed-content {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 8px;
    padding: 12px;
    max-height: 300px;
    overflow-y: auto;
    margin-top: 8px;
}

.pipeline-parsed-content pre {
    margin: 0;
    white-space: pre-wrap;
    word-wrap: break-word;
    font-family: 'SF Mono', Monaco, Consolas, monospace;
    font-size: 13px;
    line-height: 1.5;
    color: var(--text-secondary);
}

.pipeline-form-card {
    align-self: stretch;
}

/* Make Video Pipeline Source material card visually identical to Prompt Composer card */
.pipeline-form-card.surface {
    border-width: 4px;
    border-color: rgba(198, 168, 124, 0.95);
    box-shadow:
        0 0 24px rgba(198, 168, 124, 0.45),
        0 0 64px rgba(198, 168, 124, 0.35),
        var(--shadow-soft);
    /* Inset the card 50px from both sides */
    margin-left: 50px;
    margin-right: 50px;
}

.pipeline-form-card.surface::after {
    content: "";
    position: absolute;
    inset: -6px;
    border-radius: inherit;
    background:
        radial-gradient(circle at 20% 15%, rgba(111, 203, 255, 0.35), transparent 60%),
        radial-gradient(circle at 80% 80%, rgba(121, 106, 255, 0.32), transparent 65%);
    filter: blur(20px);
    opacity: 0.9;
    pointer-events: none;
    z-index: 0;
}

@media (max-width: 1024px) {
    .pipeline-form-card.surface {
        margin-left: 0;
        margin-right: 0;
    }
}

.pipeline-form-card header span {
    color: var(--text-muted);
}

.pipeline-form .segment-grid {
    display: grid;
    align-items: start;
}

.pipeline-form .segment-card {
    min-height: auto;
    padding: 18px 20px;
    gap: 12px;
}

.segment-grid-stacked {
    row-gap: 18px;
}

.segment-inline .inline-controls {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 8px;
}

.segment-inline .inline-controls .segment-helper {
    margin: 0;
    text-align: right;
}

.pipeline-form .segment-card .segment-helper {
    font-size: 13px;
    line-height: 1.5;
}

.segment-card.segment-text {
    background: linear-gradient(145deg, rgba(198, 168, 124, 0.08), rgba(28, 24, 20, 0.88));
    border: 1px solid rgba(198, 168, 124, 0.25);
    box-shadow: 0 28px 60px -38px rgba(6, 14, 32, 0.82);
    padding: 26px 28px 24px;
}

.segment-card.segment-text::before {
    inset: -55% 45% 60% -40%;
    background: linear-gradient(130deg, transparent 46%, rgba(198, 168, 124, 0.18) 70%, transparent 90%);
    opacity: 0.5;
}

.segment-card.segment-text .segment-header {
    align-items: flex-start;
    gap: 12px;
}

.segment-card.segment-text .segment-title {
    font-size: 15px;
    letter-spacing: 0.24em;
    color: rgba(250, 246, 240, 0.92);
}

.segment-card.segment-text .segment-chip {
    background: linear-gradient(135deg, rgba(198, 168, 124, 0.55), rgba(166, 124, 82, 0.42));
    border: 1px solid rgba(198, 168, 124, 0.5);
    color: rgba(250, 246, 240, 0.94);
    box-shadow: 0 8px 22px -12px rgba(166, 124, 82, 0.6);
}

.segment-card.segment-text textarea.control {
    background: linear-gradient(140deg, rgba(14, 12, 10, 0.92), rgba(12, 10, 6, 0.88));
    border: 1px solid rgba(198, 168, 124, 0.22);
    box-shadow: inset 0 0 0 1px rgba(6, 12, 28, 0.6), 0 18px 44px -34px rgba(166, 124, 82, 0.4);
    padding: 22px 24px;
    min-height: 240px;
    font-size: 16px;
    line-height: 1.7;
}

.segment-card.segment-text textarea.control::placeholder {
    color: rgba(250, 246, 240, 0.45);
}

.segment-card.segment-text textarea.control:focus {
    border-color: rgba(198, 168, 124, 0.55);
    box-shadow: inset 0 0 0 1px rgba(198, 168, 124, 0.25), 0 18px 44px -30px rgba(198, 168, 124, 0.4);
}

.segment-card.segment-text .segment-helper {
    color: rgba(250, 246, 240, 0.65);
}

/* Project Title Bar styling */
.segment-card.segment-title-bar {
    padding: 14px 20px;
    border: 1px solid rgba(198, 168, 124, 0.2);
}

.segment-card.segment-title-bar input.control {
    padding: 10px 14px;
}

.project-actions-row {
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: stretch;
}

.project-actions-row .project-select-wrapper {
    width: 100%;
    min-width: 0;
}

.project-new-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    white-space: nowrap;
    padding: 9px 14px;
    font-size: 13px;
    border-radius: 12px;
    flex-shrink: 0;
    align-self: flex-start;
}

.project-select-wrapper {
    width: 100%;
}

/* ── New Project Modal ── */
.new-project-dialog {
    width: min(520px, 100%);
    gap: 14px;
}

.np-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.np-field-row {
    display: flex;
    gap: 12px;
}

.np-field-half {
    flex: 1;
    min-width: 0;
}

.np-label {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
}

.np-required {
    color: #c6a87c;
}

.np-input {
    background: rgba(255, 248, 235, 0.04) !important;
    border: 1px solid rgba(255, 248, 235, 0.1) !important;
    border-radius: 10px !important;
    padding: 10px 14px !important;
    font-size: 14px !important;
    color: var(--text-primary) !important;
    transition: border-color 0.2s ease;
}

.np-input:focus {
    border-color: rgba(198, 168, 124, 0.5) !important;
    outline: none;
}

.np-input::placeholder {
    color: var(--text-muted);
    opacity: 0.5;
}

.np-select-wrapper {
    width: 100%;
}

.np-radio-group {
    display: flex;
    gap: 10px;
}

.np-radio-option {
    flex: 1;
    cursor: pointer;
}

.np-radio-option input[type="radio"] {
    display: none;
}

.np-radio-label {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 16px;
    border-radius: 12px;
    border: 1px solid rgba(255, 248, 235, 0.1);
    background: rgba(255, 248, 235, 0.03);
    font-size: 14px;
    font-weight: 500;
    color: var(--text-muted);
    transition: all 0.2s ease;
}

.np-radio-option input[type="radio"]:checked + .np-radio-label {
    border-color: rgba(198, 168, 124, 0.5);
    background: rgba(198, 168, 124, 0.1);
    color: #c6a87c;
}

.np-radio-label:hover {
    border-color: rgba(198, 168, 124, 0.3);
    background: rgba(198, 168, 124, 0.06);
}

.np-customer-fields {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 14px;
    border-radius: 14px;
    background: rgba(198, 168, 124, 0.04);
    border: 1px solid rgba(198, 168, 124, 0.12);
}

.np-customer-fields[hidden] {
    display: none;
}

.np-divider {
    border: none;
    border-top: 1px solid rgba(255, 248, 235, 0.08);
    margin: 4px 0;
}

/* ── Generation Modal ── */
.gen-modal-dialog {
    width: 96vw !important;
    max-width: 2200px !important;
    max-height: 92vh;
}

.gen-select-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 14px;
}

.gen-selected-count {
    margin-left: auto;
    font-size: 13px;
    color: var(--text-muted);
}

.gen-image-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 14px;
    max-height: 70vh;
    overflow-y: auto;
    padding: 2px;
}

.gen-thumb {
    position: relative;
    border-radius: 10px;
    overflow: hidden;
    border: 2px solid rgba(255, 248, 235, 0.08);
    cursor: pointer;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    aspect-ratio: 1;
}

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

.gen-thumb.is-selected {
    border-color: #c6a87c;
    box-shadow: 0 0 0 2px rgba(198, 168, 124, 0.3);
}

.gen-thumb-check {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 22px;
    height: 22px;
    background: rgba(198, 168, 124, 0.9);
    border-radius: 50%;
    display: none;
    align-items: center;
    justify-content: center;
    color: #0f0d0b;
}

.gen-thumb.is-selected .gen-thumb-check {
    display: flex;
}

.gen-thumb-name {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    font-size: 10px;
    padding: 3px 5px;
    background: rgba(0, 0, 0, 0.65);
    color: rgba(255, 255, 255, 0.85);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.gen-thumb:hover {
    border-color: rgba(198, 168, 124, 0.5);
}

/* Phase 2: Progress cards */
.gen-progress-list {
    display: flex;
    flex-direction: column;
    gap: 14px;
    max-height: 70vh;
    overflow-y: auto;
}

.gen-progress-card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 14px 16px;
    border-radius: 14px;
    background: rgba(255, 248, 235, 0.03);
    border: 1px solid rgba(255, 248, 235, 0.08);
    transition: border-color 0.3s ease;
}

.gen-progress-card.is-generating {
    border-color: rgba(198, 168, 124, 0.3);
}

.gen-progress-card.is-completed {
    border-color: rgba(76, 175, 80, 0.4);
}

.gen-progress-card.is-failed {
    border-color: rgba(239, 83, 80, 0.4);
}

.gen-progress-card.is-blocked {
    border-color: rgba(255, 183, 77, 0.4);
}

.gen-prog-thumb {
    width: 192px;
    height: 192px;
    border-radius: 12px;
    object-fit: cover;
    flex-shrink: 0;
    transition: opacity 0.25s ease;
}

.gen-prog-thumb-wrap {
    position: relative;
    flex-shrink: 0;
}

.gen-toggle-btn {
    position: absolute;
    bottom: 6px;
    right: 6px;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: none;
    background: rgba(15, 13, 11, 0.75);
    color: #c6a87c;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease, transform 0.2s ease;
    backdrop-filter: blur(6px);
}

.gen-toggle-btn:hover {
    background: rgba(198, 168, 124, 0.3);
    transform: scale(1.1);
}

.gen-toggle-btn[hidden] {
    display: none;
}

.gen-thumb-label {
    position: absolute;
    top: 6px;
    left: 6px;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 2px 7px;
    border-radius: 6px;
    background: rgba(15, 13, 11, 0.75);
    color: #c6a87c;
    backdrop-filter: blur(6px);
}

.gen-thumb-label[hidden] {
    display: none;
}

.gen-prog-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.gen-prog-name {
    font-size: 16px;
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.gen-prog-bar-track {
    height: 8px;
    border-radius: 4px;
    background: rgba(255, 248, 235, 0.08);
    overflow: hidden;
}

.gen-prog-bar-fill {
    height: 100%;
    border-radius: 3px;
    background: #c6a87c;
    width: 0;
    transition: width 0.5s ease;
}

.gen-prog-bar-fill.bar-completed {
    background: #4caf50;
}

.gen-prog-bar-fill.bar-failed {
    background: #ef5350;
}

.gen-prog-status {
    font-size: 11px;
    color: var(--text-muted);
}

.library-layout {
    align-items: flex-start;
}

.library-hero {
    gap: 22px;
}

.library-highlights {
    margin-top: 12px;
}

.library-tip {
    margin-top: 28px;
    padding: 22px 24px;
    gap: 14px;
    background: linear-gradient(140deg, rgba(23, 28, 48, 0.86), rgba(10, 13, 26, 0.78));
    border: 1px solid rgba(198, 168, 124, 0.26);
    box-shadow: 0 26px 58px -34px rgba(16, 24, 48, 0.85);
}

.library-tip header {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    margin-bottom: 4px;
}

.library-tip header h3 {
    margin: 0;
    font-size: 16px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.library-tip header span {
    font-size: 13px;
    color: var(--text-muted);
}

.library-tip p {
    margin: 0;
}

.library-tip .ghost-link {
    width: fit-content;
}

.library-panel {
    display: flex;
    flex-direction: column;
    gap: 32px;
    border: 1px solid var(--border-soft);
    border-radius: 24px;
    padding: clamp(24px, 3vw, 32px);
    box-shadow: var(--shadow-soft);
    backdrop-filter: var(--glass-blur);
    position: relative;
    overflow: hidden;
}

.library-panel::after {
    content: "";
    position: absolute;
    inset: 10px;
    border-radius: inherit;
    border: 1px solid rgba(255, 248, 235, 0.08);
    box-shadow:
        inset 0 0 46px rgba(var(--accent-primary-rgb), 0.12),
        inset 0 1px 0 rgba(255, 248, 235, 0.06);
    pointer-events: none;
    z-index: 0;
}

/* Cloud Image Library: remove the panel outline border */
body.library .surface.library-panel {
    border: 0;
}

body.library .surface.library-panel::after {
    border: 0;
    box-shadow: none;
}

/* Library: make the Video Library card visually identical to the Prompt Composer card. */
#prompt-composer.library-panel {
    padding: clamp(28px, 4vw, 36px);
    border-width: 4px;
    border-color: rgba(198, 168, 124, 0.95);
    box-shadow:
        0 0 24px rgba(198, 168, 124, 0.45),
        0 0 64px rgba(198, 168, 124, 0.35),
        var(--shadow-soft);
}

#prompt-composer.library-panel::after {
    content: "";
    position: absolute;
    inset: -6px;
    border-radius: inherit;
    background:
        radial-gradient(circle at 20% 15%, rgba(111, 203, 255, 0.35), transparent 60%),
        radial-gradient(circle at 80% 80%, rgba(121, 106, 255, 0.32), transparent 65%);
    filter: blur(20px);
    opacity: 0.9;
    pointer-events: none;
    z-index: 0;
    border: 0;
    box-shadow: none;
}

.library-panel-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

.library-panel-header > div:first-child span {
    font-size: 13px;
    color: var(--text-muted);
    display: block;
    margin-top: 6px;
}

.library-view-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
    justify-content: flex-end;
}

.library-view-tabs .library-chip.is-disabled {
    opacity: 0.6;
}

.library-tab-panel {
    margin-top: 24px;
    display: none;
}

.library-tab-panel.is-active {
    display: block;
}

.library-tab-panel[hidden] {
    display: none !important;
}

.library-status-nav,
.library-orientation-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
}

.library-status-nav {
    justify-content: flex-end;
}

.library-orientation-nav {
    margin-top: 6px;
}

.library-orientation-nav.is-disabled {
    opacity: 0.55;
    pointer-events: none;
}

.library-orientation-nav.is-disabled .library-chip {
    color: var(--text-muted);
    box-shadow: none;
    transform: none;
    cursor: default;
}

.library-channel-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: flex-end;
}

.library-chip {
    background: rgba(20, 24, 38, 0.88);
    border: 1px solid rgba(255, 248, 235, 0.08);
    color: var(--text-secondary);
    padding: 8px 18px;
    border-radius: 999px;
    font-size: 13px;
    letter-spacing: 0.04em;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease, border 0.2s ease, color 0.2s ease;
}

.library-chip:focus-visible {
    outline: 2px solid rgba(var(--accent-primary-rgb), 0.95);
    outline-offset: 3px;
}

.library-chip:hover {
    border-color: rgba(198, 168, 124, 0.28);
    color: var(--text-primary);
    transform: translateY(-1px);
}

.library-chip.is-active {
    background: linear-gradient(135deg, rgba(198, 168, 124, 0.95), rgba(180, 150, 110, 0.88));
    color: var(--text-primary);
    border-color: transparent;
    box-shadow: 0 18px 36px -22px rgba(198, 168, 124, 0.9);
    transform: translateY(-1px);
}

.library-chip.library-chip-images {
    background: rgba(20, 24, 38, 0.88);
    color: var(--text-primary);
    border: 2px solid rgba(198, 168, 124, 0.6);
    box-shadow: 0 0 0 1px rgba(198, 168, 124, 0.3);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.library-chip.library-chip-images:hover {
    background: rgba(198, 168, 124, 0.15);
    border-color: rgba(198, 168, 124, 0.9);
    box-shadow: 0 0 0 2px rgba(198, 168, 124, 0.4);
    transform: translateY(-2px);
}

/* Blue border variant for Edited Videos and Images buttons */
.library-chip.library-chip-bordered {
    border: 2px solid rgba(198, 168, 124, 0.6);
    box-shadow: 0 0 0 1px rgba(198, 168, 124, 0.3);
}

.library-chip.library-chip-bordered:hover {
    border-color: rgba(198, 168, 124, 0.9);
    box-shadow: 0 0 0 2px rgba(198, 168, 124, 0.4);
}

.library-video-grid {
    display: grid;
    gap: clamp(20px, 3vw, 28px);
    grid-template-columns: repeat(4, 1fr);
}

.library-edited-grid {
    display: grid;
    gap: clamp(20px, 3vw, 28px);
    grid-template-columns: repeat(4, 1fr);
}

.library-edited-card .library-video-meta {
    flex-wrap: wrap;
}

@media (max-width: 1400px) {
    .library-video-grid,
    .library-edited-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 1024px) {
    .library-video-grid,
    .library-edited-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 640px) {
    .library-video-grid,
    .library-edited-grid {
        grid-template-columns: 1fr;
    }
}

@media (min-width: 1280px) {
    .library-video-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

.library-video-card {
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding: 22px 24px;
    border-radius: 22px;
    background: linear-gradient(135deg, rgba(198, 168, 124, 0.06), rgba(28, 24, 20, 0.54));
    border: 1px solid rgba(198, 168, 124, 0.2);
    box-shadow: 0 26px 56px -36px rgba(10, 12, 36, 0.85);
    backdrop-filter: blur(14px);
    transition: border-color 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease;
    height: 100%;
}

.library-video-card:hover {
    border-color: rgba(198, 168, 124, 0.5);
    transform: translateY(-1px);
    box-shadow: 0 30px 70px -44px rgba(0, 0, 0, 0.85);
}

.library-video-card:focus-within {
    border-color: rgba(198, 168, 124, 0.5);
    box-shadow:
        0 28px 66px -46px rgba(0, 0, 0, 0.9),
        0 0 0 3px rgba(var(--accent-primary-rgb), 0.16);
}

.library-video-thumb {
    position: relative;
    border-radius: 18px;
    overflow: hidden;
    background: linear-gradient(140deg, rgba(20, 28, 52, 0.9), rgba(12, 18, 38, 0.85));
    aspect-ratio: 16 / 9;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(255, 248, 235, 0.08);
    box-shadow: 0 22px 44px -34px rgba(10, 14, 28, 0.9);
}

.library-video-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transform: scale(1);
    transition: transform 0.22s ease;
}

.library-video-card:hover .library-video-thumb img {
    transform: scale(1.02);
}

.library-video-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    font-size: 15px;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: rgba(231, 236, 255, 0.62);
    background: linear-gradient(130deg, rgba(36, 48, 92, 0.72), rgba(14, 20, 40, 0.76));
}

.library-video-thumb.is-pending {
    background: linear-gradient(145deg, rgba(26, 32, 58, 0.9), rgba(14, 18, 32, 0.88));
    border: 1px dashed rgba(198, 168, 124, 0.28);
}

.library-video-duration {
    position: absolute;
    right: 12px;
    bottom: 12px;
    border-radius: 10px;
    padding: 6px 10px;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    background: rgba(3, 6, 14, 0.78);
    color: rgba(243, 246, 255, 0.94);
    box-shadow: 0 12px 24px -18px rgba(0, 0, 0, 0.85);
}

.library-video-progress {
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: center;
    text-align: center;
    padding: 32px 24px;
    color: var(--text-secondary);
}

.library-video-body {
    display: flex;
    flex-direction: column;
    gap: 10px;
    flex: 1;
}

.library-video-body h3 {
    margin: 0;
    font-size: 16px;
    line-height: 1.4;
    color: var(--text-primary);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 2.8em;
}

.library-video-body p {
    margin: 0;
    color: var(--text-secondary);
    line-height: 1.6;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 4.8em;
}

.library-video-body p.library-video-description:empty {
    min-height: 0;
    display: none;
}

.library-video-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    font-size: 13px;
    color: var(--text-muted);
}

.library-video-meta span::before {
    content: '';
    margin-right: 8px;
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: rgba(255, 248, 235, 0.24);
    display: inline-block;
}

.library-video-meta span:first-child::before {
    display: none;
}

.library-video-status {
    font-weight: 600;
    color: var(--accent);
}

.library-video-card[data-status="processing"] .library-video-status {
    color: rgba(149, 188, 255, 0.92);
}

.library-video-card[data-status="failed"] .library-video-status {
    color: var(--danger);
}

.library-video-actions .library-status-chip {
    text-align: left;
    justify-content: flex-start;
    cursor: default;
    pointer-events: none;
}

.library-video-actions .library-play-button {
    gap: 8px;
    border-color: rgba(122, 169, 255, 0.85);
    box-shadow: 0 12px 26px rgba(48, 82, 156, 0.28);
    background: rgba(18, 24, 44, 0.75);
}

.library-video-actions .library-play-button .library-play-icon {
    font-size: 12px;
    line-height: 1;
    display: inline-flex;
    align-items: center;
}

.library-video-actions .library-play-button:hover {
    border-color: rgba(158, 201, 255, 0.95);
    background: rgba(58, 74, 118, 0.85);
}

.library-video-actions .library-play-button.is-disabled {
    border-color: rgba(122, 169, 255, 0.38);
    box-shadow: none;
    background: rgba(255, 248, 235, 0.04);
}

.library-video-actions .library-download-button {
    text-decoration: none;
}

.library-modal {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: clamp(16px, 4vw, 48px);
    z-index: 1200;
}

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

.library-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(12, 10, 6, 0.85);
    backdrop-filter: blur(18px);
}

.library-modal-dialog {
    position: relative;
    width: min(960px, 100%);
    background: rgba(28, 24, 20, 0.92);
    border: 1px solid rgba(255, 248, 235, 0.14);
    border-radius: 24px;
    padding: clamp(20px, 3vw, 28px);
    box-shadow: 0 32px 88px -36px rgba(5, 6, 18, 0.9);
    backdrop-filter: var(--glass-blur);
    z-index: 1;
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.library-modal-header h3 {
    margin: 0;
    font-size: 18px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.library-modal-close {
    position: absolute;
    top: 12px;
    right: 12px;
    border: none;
    background: rgba(255, 248, 235, 0.08);
    color: var(--text-primary);
    border-radius: 50%;
    width: 36px;
    height: 36px;
    font-size: 22px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease;
}

.library-modal-close:focus-visible {
    outline: 2px solid rgba(var(--accent-primary-rgb), 0.95);
    outline-offset: 3px;
}

.library-modal-close:hover {
    background: rgba(255, 248, 235, 0.18);
}

.library-modal-body {
    display: flex;
    border-radius: 18px;
    overflow: hidden;
    background: #000;
}

.library-modal-body video {
    width: 100%;
    height: auto;
    max-height: 70vh;
    display: block;
    background: #000;
}

.library-video-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    border-radius: 999px;
    font-size: 12px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    border: 1px solid rgba(198, 168, 124, 0.42);
    background: rgba(198, 168, 124, 0.14);
    color: rgba(220, 230, 255, 0.92);
}

.library-video-pill.secondary {
    border-color: rgba(255, 248, 235, 0.16);
    background: rgba(255, 248, 235, 0.06);
    color: var(--text-secondary);
}

.library-video-card[data-status="failed"] .library-video-pill,
.library-video-card[data-status="failed"] .library-video-pill.secondary {
    border-color: rgba(196, 94, 94, 0.45);
    background: rgba(196, 94, 94, 0.12);
    color: rgba(255, 209, 226, 0.9);
}


.library-columns {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 20px;
}

.catalog-column.segment-card {
    gap: 18px;
    padding: 24px 24px 28px;
    background: rgba(15, 19, 34, 0.64);
    border-color: rgba(255, 248, 235, 0.12);
    box-shadow: 0 26px 60px -34px rgba(12, 20, 42, 0.82);
}

.catalog-column.segment-card::before {
    background: linear-gradient(125deg, transparent 48%, rgba(198, 168, 124, 0.18) 70%, transparent 90%);
    opacity: 0.45;
}

.catalog-column-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
}

.catalog-column-header h3 {
    margin: 0;
    font-size: 15px;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--text-secondary);
}

.catalog-count {
    font-size: 12px;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: rgba(245, 238, 226, 0.6);
}

.catalog-column.segment-card .catalog-list {
    gap: 16px;
}

.catalog-column.segment-card .catalog-card {
    background: rgba(12, 16, 32, 0.82);
    border: 1px solid rgba(255, 248, 235, 0.12);
    box-shadow: inset 0 1px 0 rgba(255, 248, 235, 0.04), 0 18px 40px -30px rgba(12, 22, 48, 0.82);
}

.library-metric-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 16px;
    margin-top: 24px;
}

.library-metric {
    border-radius: 18px;
    padding: 18px 20px;
    border: 1px solid rgba(255, 248, 235, 0.08);
    background: rgba(28, 24, 20, 0.56);
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.library-metric[data-variant="success"] {
    border-color: rgba(124, 184, 138, 0.32);
    background: rgba(124, 184, 138, 0.08);
}

.library-metric[data-variant="warning"] {
    border-color: rgba(125, 157, 255, 0.28);
    background: rgba(125, 157, 255, 0.08);
}

.library-metric[data-variant="danger"] {
    border-color: rgba(196, 94, 94, 0.28);
    background: rgba(196, 94, 94, 0.08);
}

/* Accent variant for clickable metric cards */
.library-metric[data-variant="accent"] {
    border-color: rgba(198, 168, 124, 0.32);
    background: rgba(198, 168, 124, 0.08);
    cursor: pointer;
    transition: all 0.2s ease;
}

.library-metric[data-variant="accent"]:hover {
    border-color: rgba(198, 168, 124, 0.5);
    background: rgba(198, 168, 124, 0.12);
    transform: translateY(-2px);
}

.library-metric-link .library-metric-action {
    display: flex;
    flex-direction: column;
    gap: 6px;
    text-decoration: none;
    color: inherit;
}

.library-metric-link .library-metric-label {
    color: var(--accent-primary);
}

.library-metric-link .library-metric-value {
    color: var(--accent-primary);
}

.library-metric-label {
    font-size: 12px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.library-metric-value {
    font-size: 28px;
    font-weight: 600;
    color: var(--text-primary);
}

.pipeline-form .segment-card textarea {
    min-height: 200px;
}


.form-actions {
    margin-top: 18px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.form-actions .helper {
    margin: 0;
    max-width: 520px;
}

.pipeline-overview {
    margin: 0 0 22px;
    color: var(--text-secondary);
    line-height: 1.7;
}

.pipeline-summary {
    margin: 0 0 18px;
    color: var(--text-secondary);
    line-height: 1.6;
}

.pipeline-output {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.pipeline-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin: 0 0 22px;
}

.pipeline-actions .button {
    align-self: flex-start;
}

.pipeline-actions-helper {
    font-size: 13px;
    color: var(--text-secondary);
}

.pipeline-builder-layout {
    display: grid;
    grid-template-columns: minmax(280px, 320px) 1fr;
    gap: clamp(24px, 3vw, 32px);
    align-items: flex-start;
}

@media (max-width: 1080px) {
    .pipeline-builder-layout {
        grid-template-columns: 1fr;
    }
}

.pipeline-generating,
.pipeline-error {
    grid-column: 1 / -1;
    min-height: 400px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.generating-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    max-width: 500px;
    padding: 40px;
}

.generating-content h2 {
    font-size: 24px;
    font-weight: 600;
    margin: 0;
}

.generating-content p {
    font-size: 15px;
    color: var(--text-muted);
    margin: 0;
}

.generating-hint {
    font-size: 13px;
    opacity: 0.7;
}

.pipeline-progress {
    display: flex;
    flex-direction: column;
    gap: 18px;
    position: relative;
    overflow: hidden;
    background: radial-gradient(circle at 0% 0%, rgba(166, 124, 82, 0.25), transparent 60%),
        radial-gradient(circle at 80% -10%, rgba(124, 184, 138, 0.18), transparent 55%),
        rgba(14, 12, 10, 0.9);
    border: 1px solid rgba(255, 248, 235, 0.08);
}

.pipeline-progress::after {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: linear-gradient(135deg, rgba(198, 168, 124, 0.15), transparent 60%);
    opacity: 0.8;
}

.pipeline-progress > * {
    position: relative;
    z-index: 1;
}

.clip-run-header {
    display: flex;
    justify-content: space-between;
    gap: 18px;
    align-items: flex-start;
}

.clip-run-header-left {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.clip-run-header-left p {
    margin: 10px 0 0;
    color: var(--text-secondary);
    line-height: 1.6;
}

.clip-run-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px;
    border-radius: 999px;
    font-size: 12px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--text-primary);
    background: rgba(39, 63, 120, 0.7);
    border: 1px solid rgba(255, 248, 235, 0.12);
    backdrop-filter: blur(10px);
}


.clip-run-count {
    display: inline-flex;
    align-items: baseline;
    gap: 10px;
    min-width: 0;
}

.clip-run-count-number {
    font-size: 36px;
    font-weight: 700;
    line-height: 1;
}

.clip-run-count-label {
    font-size: 13px;
    letter-spacing: 0.28em;
    text-transform: uppercase;
    color: rgba(245, 238, 226, 0.7);
}

.clip-run-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px;
}

.clip-run-stat {
    padding: 14px;
    border-radius: 16px;
    border: 1px solid rgba(255, 248, 235, 0.1);
    background: rgba(10, 14, 28, 0.6);
}

.clip-run-stat-label {
    display: block;
    font-size: 12px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 6px;
}

.clip-run-stat strong {
    font-size: 18px;
    font-weight: 600;
}

.clip-run-hint {
    margin: 0;
    font-size: 13px;
    color: var(--text-muted);
}

.clip-stepper {
    list-style: none;
    margin: 12px 0 0;
    padding: 0;
    display: grid;
    gap: 12px;
}

.clip-stepper-item {
    border: 1px solid rgba(255, 248, 235, 0.08);
    border-radius: 18px;
    overflow: hidden;
    background: rgba(12, 10, 6, 0.7);
}

.clip-stepper-link {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    text-decoration: none;
    color: inherit;
    transition: background 0.15s ease, transform 0.15s ease;
}

.clip-stepper-item.active .clip-stepper-link {
    background: linear-gradient(135deg, rgba(198, 168, 124, 0.16), rgba(18, 15, 12, 0.8));
    border-left: 3px solid var(--accent);
    transform: translateX(4px);
}

.clip-stepper-item.status-approved .clip-stepper-link {
    border-left: 3px solid rgba(118, 214, 155, 0.9);
}

.clip-stepper-item.status-ready:not(.active) .clip-stepper-link {
    border-left: 3px solid rgba(198, 168, 124, 0.4);
}

.clip-stepper-item.status-error .clip-stepper-link {
    border-left: 3px solid rgba(255, 117, 117, 0.9);
}

.clip-stepper-item.disabled .clip-stepper-link,
.clip-stepper-link.disabled {
    opacity: 0.55;
    pointer-events: none;
}

.clip-stepper-link:hover {
    background: rgba(198, 168, 124, 0.08);
}

.clip-stepper-index {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    font-weight: 600;
    border-radius: 50%;
    background: linear-gradient(135deg, rgba(198, 168, 124, 0.4), rgba(124, 184, 138, 0.35));
    color: #0f0d0b;
}

.clip-stepper-copy {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.clip-stepper-copy strong {
    font-size: 14px;
    color: var(--text-primary);
}

.clip-stepper-copy span {
    font-size: 12px;
    color: var(--text-muted);
}

.clip-stepper-badge {
    font-size: 12px;
    font-weight: 600;
    color: rgba(118, 214, 155, 0.9);
}

.clip-stepper-badge.badge-error {
    color: var(--danger);
}

.pipeline-overview-card,
.pipeline-callouts-card {
    border: 1px solid var(--border-soft);
    border-radius: 16px;
    padding: 16px;
    background: rgba(28, 24, 20, 0.68);
}

.pipeline-overview-card h3,
.pipeline-callouts-card h3 {
    margin: 0 0 12px;
    font-size: 16px;
}

.pipeline-overview-card p {
    margin: 0;
    color: var(--text-secondary);
    line-height: 1.6;
}

.pipeline-callouts-card ul {
    margin: 0;
    padding-left: 20px;
    display: grid;
    gap: 6px;
    color: var(--text-secondary);
}

.pipeline-workspace {
    display: grid;
    gap: 24px;
}

.clip-workspace-header h1 {
    margin: 4px 0 10px;
}

.clip-detail {
    margin: 0 0 16px;
    color: var(--text-secondary);
    line-height: 1.7;
}

/* Storyboard Preview Styles */
.storyboard-preview {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 24px;
    padding: 20px;
    background: rgba(255, 248, 235, 0.02);
    border: 1px solid rgba(255, 248, 235, 0.06);
    border-radius: 12px;
}

@media (max-width: 900px) {
    .storyboard-preview {
        grid-template-columns: 1fr;
    }
}

.storyboard-image-container {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.storyboard-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    min-height: 180px;
    padding: 24px;
    background: rgba(0, 0, 0, 0.25);
    border: 2px dashed rgba(255, 248, 235, 0.1);
    border-radius: 8px;
}

.storyboard-placeholder-text {
    font-size: 13px;
    color: var(--text-muted);
}

.generate-storyboard-btn {
    font-size: 13px;
    padding: 10px 20px;
    background: rgba(255, 248, 235, 0.08);
    border: 1px solid rgba(255, 248, 235, 0.15);
    transition: all 0.2s ease;
}

.generate-storyboard-btn:hover:not(:disabled) {
    background: rgba(255, 248, 235, 0.12);
    border-color: var(--accent-primary);
}

.generate-storyboard-btn:disabled {
    opacity: 0.6;
    cursor: wait;
}

.storyboard-image {
    width: 100%;
    max-height: none;
    height: auto;
    object-fit: contain;
    border-radius: 8px;
    border: 1px solid rgba(255, 248, 235, 0.1);
}

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

/* Clickable storyboard image styles */
.storyboard-image-wrapper {
    position: relative;
    cursor: pointer;
    border-radius: 8px;
    overflow: hidden;
}

.storyboard-image-clickable {
    transition: filter 0.2s ease, transform 0.2s ease;
}

.storyboard-image-wrapper:hover .storyboard-image-clickable {
    filter: brightness(0.7);
}

.storyboard-image-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: rgba(0, 0, 0, 0.5);
    opacity: 0;
    transition: opacity 0.2s ease;
    pointer-events: none;
}

.storyboard-image-wrapper:hover .storyboard-image-overlay {
    opacity: 1;
}

.storyboard-image-overlay svg {
    color: white;
}

.storyboard-image-overlay span {
    color: white;
    font-size: 13px;
    font-weight: 600;
}

/* Storyboard regenerate controls */
.storyboard-regenerate-controls {
    margin-top: 12px;
    padding: 16px;
    background: rgba(15, 19, 32, 0.8);
    border: 1px solid var(--border-soft);
    border-radius: 12px;
    animation: slideDown 0.2s ease;
}

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

.storyboard-modification-input {
    width: 100%;
    min-height: 60px;
    margin-bottom: 12px;
    font-size: 13px;
    resize: vertical;
}

.storyboard-regenerate-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

.storyboard-regenerate-actions .button {
    display: inline-flex;
    align-items: center;
}

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

.scene-prompt-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 16px;
    background: rgba(12, 10, 6, 0.6);
    border: 1px solid rgba(198, 168, 124, 0.4);
    border-radius: 12px;
    box-shadow: 0 0 15px rgba(198, 168, 124, 0.25), 0 0 30px rgba(198, 168, 124, 0.1), inset 0 0 20px rgba(198, 168, 124, 0.05);
}

.scene-prompt-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.scene-prompt-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.scene-prompt-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--accent-primary);
    font-weight: 600;
}

.scene-prompt-text {
    margin: 0;
    padding: 14px 16px;
    background: rgba(0, 0, 0, 0.25);
    border-radius: 8px;
    font-size: 13px;
    line-height: 1.65;
    color: var(--text-primary);
    border: 1px solid rgba(255, 248, 235, 0.06);
    min-height: 200px;
    max-height: 400px;
    overflow-y: auto;
}

.scene-prompt-helper {
    margin: 0;
    font-size: 12px;
    color: var(--text-muted);
}

.scene-prompt-empty {
    padding: 16px;
    background: rgba(0, 0, 0, 0.15);
    border-radius: 8px;
    text-align: center;
}

.copy-scene-prompt {
    font-size: 11px;
    padding: 4px 10px;
}

/* Storyboard in pipeline results */
.pipeline-storyboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 16px;
    margin: 20px 0;
}

.storyboard-card {
    background: rgba(255, 248, 235, 0.03);
    border: 1px solid rgba(255, 248, 235, 0.08);
    border-radius: 10px;
    overflow: hidden;
    transition: border-color 0.2s ease, transform 0.2s ease;
}

.storyboard-card:hover {
    border-color: rgba(255, 248, 235, 0.15);
    transform: translateY(-2px);
}

.storyboard-card-image {
    width: 100%;
    aspect-ratio: 16 / 9;
    object-fit: cover;
    border-bottom: 1px solid rgba(255, 248, 235, 0.06);
}

.storyboard-card-placeholder {
    width: 100%;
    aspect-ratio: 16 / 9;
    background: rgba(255, 248, 235, 0.02);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: 12px;
    border-bottom: 1px solid rgba(255, 248, 235, 0.06);
}

.storyboard-card-content {
    padding: 14px 16px;
}

.storyboard-card-index {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--accent-primary);
    font-weight: 600;
    margin-bottom: 6px;
}

.storyboard-card-title {
    margin: 0;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    line-height: 1.4;
}

.storyboard-card-prompt {
    margin: 10px 0 0;
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.pipeline-storyboard-section {
    margin: 24px 0;
    padding-top: 20px;
    border-top: 1px solid rgba(255, 248, 235, 0.08);
}

.pipeline-storyboard-section h3 {
    margin: 0 0 6px;
    font-size: 16px;
    font-weight: 600;
}

.storyboard-section-helper {
    margin: 0 0 16px;
    font-size: 13px;
    color: var(--text-secondary);
}

.clip-form {
    display: grid;
    gap: 16px;
}

.clip-grid {
    display: grid;
    gap: 18px;
    margin-bottom: 20px;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.clip-grid .segment-card {
    padding: 18px 20px;
}

.clip-grid .segment-card.segment-wide {
    grid-column: span 2;
}

@media (max-width: 700px) {
    .clip-grid .segment-card.segment-wide {
        grid-column: 1 / -1;
    }
}

.clip-actions {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-top: 8px;
}

.clip-review header {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 16px;
}

.clip-review header h2 {
    margin: 0;
}

.clip-review header span {
    font-size: 12px;
    color: var(--text-muted);
}

.clip-review-actions {
    display: flex;
    justify-content: flex-end;
}

.clip-review-controls {
    margin-top: 12px;
    display: flex;
    gap: 16px;
    align-items: center;
}

.clip-review-controls form {
    margin: 0;
}

.clip-review-controls .ghost-link {
    padding: 8px 0;
}

.clip-complete {
    border: 1px solid rgba(118, 214, 155, 0.4);
    background: rgba(118, 214, 155, 0.12);
}

.clip-complete h2 {
    margin: 0 0 8px;
}

.clip-complete p {
    margin: 0 0 16px;
    color: var(--text-secondary);
    line-height: 1.6;
}

.clip-complete-actions {
    display: flex;
    gap: 16px;
    align-items: center;
}

/* Prompt library */
.prompt-library-capture {
    border-width: 5px;
    border-color: rgba(198, 168, 124, 0.95);
    box-shadow:
        0 0 28px rgba(198, 168, 124, 0.4),
        0 0 70px rgba(198, 168, 124, 0.3),
        var(--shadow-soft);
}

.prompt-library-capture::after {
    content: "";
    position: absolute;
    inset: 8px;
    border-radius: inherit;
    border: 1px solid rgba(147, 189, 255, 0.45);
    box-shadow: inset 0 0 35px rgba(198, 168, 124, 0.25);
    pointer-events: none;
    z-index: 0;
}

.prompt-library-capture header,
.prompt-library-shelf header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.prompt-capture-form {
    display: grid;
    gap: 16px;
}

.source-fields {
    margin-top: 16px;
}

.source-fields[hidden] {
    display: none;
}

.prompt-capture-grid {
    display: grid;
    gap: 16px;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.prompt-capture-form .form-field {
    display: grid;
    gap: 6px;
    font-size: 13px;
    color: var(--text-secondary);
}

.prompt-capture-form .form-field span {
    font-weight: 600;
    color: var(--text-primary);
}

.prompt-capture-form .form-helper {
    margin: 0;
    font-size: 12px;
    color: var(--text-muted);
}

.prompt-capture-form .form-actions {
    display: flex;
    justify-content: flex-start;
}

/* Saved prompts source filter tabs */
.saved-prompts-filter {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.filter-chip {
    background: rgba(20, 24, 38, 0.88);
    border: 1px solid rgba(255, 248, 235, 0.08);
    color: var(--text-secondary);
    padding: 6px 14px;
    border-radius: 999px;
    font-size: 12px;
    letter-spacing: 0.04em;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease, border 0.2s ease, color 0.2s ease;
}

.filter-chip:focus-visible {
    outline: 2px solid rgba(var(--accent-primary-rgb), 0.95);
    outline-offset: 3px;
}

.filter-chip:hover {
    border-color: rgba(198, 168, 124, 0.28);
    color: var(--text-primary);
    transform: translateY(-1px);
}

.filter-chip.is-active {
    background: linear-gradient(135deg, rgba(198, 168, 124, 0.95), rgba(180, 150, 110, 0.88));
    color: var(--text-primary);
    border-color: transparent;
    box-shadow: 0 12px 24px -14px rgba(198, 168, 124, 0.7);
    transform: translateY(-1px);
}

.prompt-card-grid {
    display: grid;
    gap: 18px;
    grid-template-columns: repeat(4, 1fr);
}

@media (max-width: 1400px) {
    .prompt-card-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 1024px) {
    .prompt-card-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 640px) {
    .prompt-card-grid {
        grid-template-columns: 1fr;
    }
}

.prompt-card {
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-height: auto;
}

.prompt-card-header {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: flex-start;
}

.prompt-card-header .eyebrow {
    display: block;
    margin-bottom: 8px;
}

.prompt-card-header h3 {
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.prompt-meta {
    font-size: 12px;
    color: var(--text-muted);
}

.prompt-preview-actions {
    margin-top: 12px;
    display: flex;
    justify-content: flex-end;
}

.prompt-card .prompt-summary {
    margin: 0;
    color: var(--text-secondary);
    line-height: 1.6;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    flex: 1 1 auto;
}

.prompt-details {
    flex: 0 0 auto;
}

.prompt-details summary {
    font-weight: 600;
    cursor: pointer;
}

.prompt-details pre {
    margin: 12px 0 0;
    padding: 12px;
    border-radius: 12px;
    background: rgba(28, 24, 20, 0.72);
    font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
    font-size: 13px;
    line-height: 1.5;
    max-height: 260px;
    overflow: auto;
}

.prompt-metadata {
    display: none; /* Hide metadata to keep cards clean */
}

.prompt-metadata dt {
    font-weight: 600;
}

.prompt-metadata dd {
    margin: 0;
}

.prompt-card-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: auto;
    padding-top: 12px;
    border-top: 1px solid rgba(255, 248, 235, 0.08);
}

.prompt-card-actions .ghost-button {
    flex: 1 1 calc(50% - 4px);
    text-align: center;
    font-size: 13px;
    padding: 8px 12px;
}

.prompt-card .prompt-copy {
    align-self: flex-start;
}

.prompt-preview-save {
    align-self: flex-start;
}

/* Prompt Detail Modal */
.prompt-detail-modal {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: clamp(16px, 4vw, 48px);
    z-index: 1200;
}

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

.prompt-detail-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(12, 10, 6, 0.88);
    backdrop-filter: blur(18px);
    cursor: pointer;
}

.prompt-detail-modal-dialog {
    position: relative;
    width: min(720px, 100%);
    max-height: calc(100vh - 80px);
    background: rgba(28, 24, 20, 0.98);
    border: 2px solid rgba(198, 168, 124, 0.4);
    border-radius: 24px;
    padding: clamp(24px, 4vw, 32px);
    box-shadow: 
        0 0 30px rgba(198, 168, 124, 0.15),
        0 0 60px rgba(198, 168, 124, 0.1),
        0 32px 88px -36px rgba(5, 6, 18, 0.9);
    backdrop-filter: var(--glass-blur);
    z-index: 1;
    display: flex;
    flex-direction: column;
    gap: 24px;
    overflow: hidden;
}

.prompt-detail-modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    border: none;
    background: rgba(255, 248, 235, 0.08);
    color: var(--text-primary);
    border-radius: 50%;
    width: 36px;
    height: 36px;
    font-size: 22px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease;
    z-index: 2;
}

.prompt-detail-modal-close:hover {
    background: rgba(255, 248, 235, 0.18);
}

.prompt-detail-modal-header {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding-right: 48px;
}

.prompt-detail-modal-header h2 {
    margin: 0;
    font-size: 22px;
    font-weight: 600;
}

.prompt-detail-modal-body {
    display: flex;
    flex-direction: column;
    gap: 20px;
    overflow-y: auto;
    flex: 1;
    padding-right: 8px;
}

.prompt-detail-section {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.prompt-detail-label {
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.prompt-detail-modal-body .control {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 248, 235, 0.12);
    border-radius: 12px;
    padding: 14px 16px;
    color: var(--text-primary);
    font-size: 15px;
    line-height: 1.5;
    transition: border-color 0.2s ease;
}

.prompt-detail-modal-body .control:focus {
    outline: none;
    border-color: rgba(198, 168, 124, 0.6);
}

.prompt-detail-modal-body textarea.control {
    resize: vertical;
    min-height: 200px;
    font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
    font-size: 14px;
}

.prompt-detail-metadata {
    display: grid;
    gap: 12px;
    padding: 16px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 12px;
}

.prompt-detail-metadata:empty {
    display: none;
}

.prompt-detail-metadata-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    font-size: 13px;
}

.prompt-detail-metadata-item dt {
    color: var(--text-muted);
    font-weight: 500;
}

.prompt-detail-metadata-item dd {
    margin: 0;
    color: var(--text-secondary);
    text-align: right;
}

.prompt-detail-modal-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    padding-top: 16px;
    border-top: 1px solid rgba(255, 248, 235, 0.08);
}

.prompt-detail-modal-actions-left,
.prompt-detail-modal-actions-right {
    display: flex;
    gap: 12px;
}

.prompt-detail-modal-footer .ghost-button {
    border-color: rgba(198, 168, 124, 0.5);
    color: #8ab4ff;
}

.prompt-detail-modal-footer .ghost-button:hover {
    background: rgba(198, 168, 124, 0.12);
    border-color: rgba(198, 168, 124, 0.7);
    color: #a8c8ff;
}

.prompt-detail-modal-footer .ghost-button.danger {
    color: #ff6b6b;
    border-color: rgba(255, 107, 107, 0.5);
}

.prompt-detail-modal-footer .ghost-button.danger:hover {
    background: rgba(255, 69, 58, 0.15);
    border-color: rgba(255, 107, 107, 0.7);
    color: #ff8a8a;
}

.prompt-detail-modal-footer .ghost-button.danger:hover {
    background: rgba(255, 69, 58, 0.12);
}

.prompt-detail-modal-footer .ghost-button.primary {
    color: #c6a87c;
    border-color: rgba(198, 168, 124, 0.7);
    background: rgba(198, 168, 124, 0.1);
}

.prompt-detail-modal-footer .ghost-button.primary:hover {
    background: rgba(198, 168, 124, 0.22);
    border-color: rgba(198, 168, 124, 0.9);
    color: #7da3ff;
    box-shadow: 0 0 16px rgba(198, 168, 124, 0.25);
}

/* Make prompt cards clickable */
.prompt-card {
    cursor: pointer;
    transition: border-color 0.2s ease, transform 0.2s ease;
}

.prompt-card:hover {
    border-color: rgba(255, 248, 235, 0.24);
}

.prompt-card:active {
    transform: scale(0.995);
}

.pipeline-talking-points h3,
.pipeline-talking-points h4 {
    margin: 0 0 8px;
    font-size: 18px;
}

.pipeline-talking-points ol {
    margin: 12px 0 0;
    padding-left: 22px;
    display: grid;
    gap: 16px;
    color: var(--text-secondary);
}

.pipeline-talking-points li p {
    margin: 0;
    line-height: 1.6;
}

.pipeline-scripts {
    display: grid;
    gap: 18px;
    margin-top: 28px;
}

.script-card {
    border: 1px solid var(--border-soft);
    border-radius: 18px;
    padding: 20px;
    background: rgba(28, 24, 20, 0.68);
}

.script-card header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.script-card header h4 {
    margin: 0;
    font-size: 16px;
    letter-spacing: 0.01em;
}

.script-dialog {
    margin: 0 0 14px;
    font-size: 16px;
    line-height: 1.6;
    color: var(--text-primary);
}

.script-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 12px;
}

.script-note {
    margin: 0 0 8px;
    font-size: 14px;
    color: var(--text-secondary);
}

.script-note strong {
    color: var(--text-primary);
}

.script-warning {
    margin: 0;
    font-size: 13px;
    color: var(--danger);
}

.pipeline-callouts {
    margin-top: 28px;
}

.pipeline-callouts h3 {
    margin: 0 0 12px;
    font-size: 18px;
}

.pipeline-callouts ul {
    margin: 0;
    padding-left: 20px;
    display: grid;
    gap: 8px;
    color: var(--text-secondary);
    line-height: 1.6;
}

.pipeline-raw {
    margin-top: 30px;
}

.pipeline-raw summary {
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    color: var(--accent);
}

.pipeline-raw pre {
    margin: 12px 0 0;
    padding: 16px;
    border-radius: 14px;
    border: 1px solid var(--border-soft);
    background: rgba(8, 12, 24, 0.72);
    color: var(--text-secondary);
    max-height: 320px;
    overflow: auto;
    font-size: 13px;
    line-height: 1.5;
}

.prompt-window code {
    font-family: 'Manrope', 'Inter', system-ui, sans-serif;
    font-weight: 500;
    color: inherit;
}

.prompt-box,
.reference-image-card {
    display: flex;
    flex-direction: column;
    gap: 20px;
    width: 100%;
    max-width: none;
}

/* ── Reference Image Card ── */
.reference-image-card header h2 { margin: 0; }
.reference-image-card header span {
    font-size: 13px;
    color: var(--text-muted);
}

.ref-image-sources {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.ref-image-source-btn {
    flex: 1 1 180px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 28px 18px;
    background: rgba(12, 18, 42, 0.55);
    border: 2px dashed rgba(198, 168, 124, 0.35);
    border-radius: 16px;
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s, color 0.2s;
}

.ref-image-source-btn:hover {
    border-color: var(--accent);
    background: rgba(198, 168, 124, 0.08);
    color: var(--text-primary);
}

.ref-image-preview-area {
    position: relative;
    border-radius: 16px;
    overflow: hidden;
    border: 2px solid rgba(198, 168, 124, 0.35);
    background: rgba(12, 18, 42, 0.55);
    text-align: center;
    padding: 16px;
}

.ref-image-preview-area img {
    max-width: 100%;
    max-height: 280px;
    border-radius: 10px;
    object-fit: contain;
}

.ref-image-remove-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: none;
    background: rgba(0,0,0,0.65);
    color: #fff;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    transition: background 0.2s;
}

.ref-image-remove-btn:hover {
    background: rgba(239, 68, 68, 0.8);
}

.ref-image-preview-label {
    margin: 10px 0 0;
    font-size: 12px;
    color: var(--text-muted);
}

/* ── Library Picker Modal ── */
.ref-library-modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 9000;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}

.ref-library-modal-overlay[hidden] { display: none; }

.ref-library-modal {
    background: var(--bg-card, #111827);
    border: 1px solid rgba(198, 168, 124, 0.2);
    border-radius: 20px;
    width: 94vw;
    max-width: 1100px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: gen-stages-slide-up 0.25s ease-out;
}

.ref-library-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 24px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}

.ref-library-modal-header h3 {
    margin: 0;
    font-size: 17px;
}

.ref-library-close-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 24px;
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
}

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

.ref-library-grid {
    padding: 24px 28px;
    overflow-y: auto;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    grid-auto-rows: 180px;
    gap: 16px;
}

.ref-library-loading {
    grid-column: 1 / -1;
    text-align: center;
    color: var(--text-muted);
    padding: 40px 0;
}

.ref-library-item {
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    border: 2px solid transparent;
    cursor: pointer;
    transition: border-color 0.2s, transform 0.15s;
    width: 100%;
    height: 100%;
    min-height: 0;
    background: rgba(12, 18, 42, 0.55);
}

.ref-library-item:hover {
    border-color: var(--accent);
    transform: scale(1.03);
}

.ref-library-item img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.ref-library-item-label {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 6px 8px;
    background: linear-gradient(transparent, rgba(0,0,0,0.75));
    font-size: 11px;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ── Bottom action row in Prompt Composer ── */
.composer-bottom-actions {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
}

.composer-bottom-actions .prompt-save-button {
    flex: 0 0 auto;
}

.composer-bottom-actions .prompt-submit {
    flex: 1 1 auto;
    justify-content: center;
    text-align: center;
}

.prompt-meta-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
}

.prompt-meta-field {
    flex: 1 1 220px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.prompt-meta-label {
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    color: rgba(226, 233, 255, 0.72);
}

.prompt-meta-controls .select-wrapper {
    flex: 1 1 auto;
}

.prompt-editor-wrapper {
    position: relative;
}

.prompt-box .prompt-editor {
    min-height: 320px;
    resize: vertical;
    border-radius: 20px;
    background: rgba(12, 18, 42, 0.72);
    border: 1px solid rgba(198, 168, 124, 0.25);
    color: var(--text-primary);
    font-size: 15px;
    line-height: 1.6;
    padding: 18px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.prompt-box .prompt-editor:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 1px rgba(198, 168, 124, 0.45);
    outline: none;
}

.prompt-box .prompt-editor::placeholder {
    color: rgba(229, 233, 255, 0.4);
}

.prompt-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
    align-items: stretch;
}

.prompt-box .prompt-actions .ghost-button,
.prompt-box .prompt-actions .button-outline,
.prompt-box .prompt-save-button,
.prompt-box .prompt-submit {
    width: 100%;
    justify-content: center;
    text-align: center;
    box-sizing: border-box;
}

.ghost-button {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: transparent;
    border: 1px solid rgba(198, 168, 124, 0.4);
    color: var(--text-secondary);
    border-radius: 999px;
    padding: 10px 18px;
    font-size: 14px;
    letter-spacing: 0.02em;
    cursor: pointer;
    transition: all 0.2s ease;
}

.ghost-button svg {
    flex-shrink: 0;
}

.ghost-button:focus-visible {
    outline: 2px solid rgba(var(--accent-primary-rgb), 0.95);
    outline-offset: 3px;
}

.ghost-button:hover {
    color: var(--text-primary);
    border-color: rgba(198, 168, 124, 0.7);
    background: rgba(198, 168, 124, 0.08);
}

.ghost-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.button-outline {
    background: transparent;
    border: 1px solid rgba(198, 168, 124, 0.55);
    color: var(--text-primary);
    box-shadow: none;
}

.button-outline:focus-visible {
    outline: 2px solid rgba(var(--accent-primary-rgb), 0.95);
    outline-offset: 3px;
}

.button-outline:hover {
    background: rgba(198, 168, 124, 0.12);
}

.button-outline:active {
    transform: translateY(0);
}

.button-outline:disabled {
    opacity: 0.35;
    cursor: default;
    pointer-events: none;
}

.button-danger,
.button-outline.button-danger {
    border-color: rgba(239, 68, 68, 0.5);
    color: #f87171;
}

.button-danger:hover,
.button-outline.button-danger:hover {
    background: rgba(239, 68, 68, 0.15);
    border-color: rgba(239, 68, 68, 0.7);
}

.prompt-actions .button-outline {
    padding: 10px 18px;
    border-radius: 999px;
    font-size: 14px;
    letter-spacing: 0.02em;
    box-shadow: none;
}

.prompt-submit {
    padding-inline: 22px;
}

.prompt-status {
    margin: 0;
    font-size: 13px;
    letter-spacing: 0.02em;
    color: var(--text-muted);
    min-height: 18px;
    visibility: hidden;
}

.prompt-status[data-variant="info"] {
    color: var(--text-secondary);
}

.prompt-status[data-variant="error"] {
    color: var(--danger);
}

fieldset {
    border: none;
    padding: 0;
    margin: 0;
    display: grid;
    gap: 18px;
}

label {
    display: flex;
    flex-direction: column;
    gap: 12px;
    color: var(--text-secondary);
    font-size: 14px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.control {
    width: 100%;
    padding: 18px 20px;
    border-radius: 16px;
    border: 1px solid rgba(255, 248, 235, 0.1);
    background: rgba(8, 11, 20, 0.62);
    color: var(--text-primary);
    font-size: 16px;
    line-height: 1.6;
    font-family: 'Inter', system-ui, sans-serif;
    transition: border 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
    backdrop-filter: blur(12px);
}

textarea.control {
    min-height: 210px;
    resize: vertical;
}

input.control {
    height: 58px;
}

input[type="file"].control-file {
    height: auto;
    padding: 18px 20px;
    border-style: dashed;
    border-color: rgba(198, 168, 124, 0.38);
    background: rgba(10, 14, 25, 0.52);
    color: var(--text-secondary);
    cursor: pointer;
    transition: border-color 0.2s ease, background 0.2s ease;
}

input[type="file"].control-file:hover {
    border-color: rgba(198, 168, 124, 0.62);
    background: rgba(12, 18, 32, 0.68);
}

input[type="file"].control-file::file-selector-button,
input[type="file"].control-file::-webkit-file-upload-button {
    margin-right: 16px;
    padding: 10px 16px;
    border-radius: 12px;
    border: 1px solid rgba(198, 168, 124, 0.4);
    background: rgba(198, 168, 124, 0.18);
    color: var(--text-primary);
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s ease, border-color 0.2s ease;
}

input[type="file"].control-file::file-selector-button:hover,
input[type="file"].control-file::-webkit-file-upload-button:hover {
    background: rgba(198, 168, 124, 0.32);
    border-color: rgba(198, 168, 124, 0.62);
}

.select-wrapper {
    position: relative;
    display: block;
    padding: 2px;
    border-radius: 18px;
    background: linear-gradient(140deg, rgba(198, 168, 124, 0.35), rgba(166, 124, 82, 0.15));
    transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.3s ease;
    box-shadow: 0 12px 28px -18px rgba(28, 20, 12, 0.6);
}

.select-wrapper::before {
    content: "";
    position: absolute;
    inset: 3px;
    border-radius: 16px;
    background: linear-gradient(150deg, rgba(18, 15, 12, 0.94), rgba(28, 24, 20, 0.88));
    pointer-events: none;
    z-index: 0;
    transition: opacity 0.3s ease;
}

.select-wrapper:hover {
    transform: translateY(-1px);
    box-shadow: 0 16px 38px -18px rgba(166, 124, 82, 0.4);
}

.select-wrapper:focus-within {
    background: linear-gradient(140deg, rgba(198, 168, 124, 0.5), rgba(166, 124, 82, 0.3));
    box-shadow: 0 18px 44px -16px rgba(166, 124, 82, 0.5);
}

.select-wrapper:focus-within::before {
    opacity: 0.85;
}

.select-wrapper .control {
    background: transparent;
    border: none;
    box-shadow: none;
    padding: 18px 20px;
}

.faux-select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    padding-right: 64px;
    cursor: pointer;
    color: transparent;
    -webkit-text-fill-color: transparent;
    caret-color: var(--text-primary);
    text-shadow: 0 0 0 transparent;
    position: relative;
    z-index: 1;
    background: transparent;
}

.select-value {
    position: absolute;
    inset: 0;
    margin: 3px;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    padding: 0 60px 0 20px;
    pointer-events: none;
    font-size: 16px;
    line-height: 1.6;
    color: var(--text-primary);
    background: linear-gradient(140deg, rgba(28, 24, 20, 0.94), rgba(18, 15, 12, 0.90));
    border-radius: 14px;
    border: 1px solid rgba(198, 168, 124, 0.08);
    box-shadow: inset 0 1px 0 rgba(255, 248, 235, 0.06);
    transition: border 0.2s ease, background 0.3s ease;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    z-index: 2;
}

.select-value > * {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
}

.faux-select:focus + .select-value {
    color: var(--text-primary);
    border-color: rgba(198, 168, 124, 0.3);
    background: linear-gradient(140deg, rgba(36, 30, 24, 0.94), rgba(24, 20, 16, 0.90));
}

.faux-select option {
    color: #0f0d0b;
    -webkit-text-fill-color: #0f0d0b;
    background: #faf6f0;
}

.select-icon {
    position: absolute;
    top: 50%;
    right: 28px;
    width: 18px;
    height: 18px;
    color: var(--text-muted);
    transform: translateY(-50%);
    pointer-events: none;
    z-index: 3;
    transition: color 0.3s ease;
}

.select-icon svg {
    width: 100%;
    height: 100%;
}

.select-wrapper:focus-within .select-icon,
.select-wrapper:hover .select-icon {
    color: rgba(198, 168, 124, 0.85);
}

/* Color theme swatch dots inside select-value */
.color-swatch-group {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-right: 10px;
    flex-shrink: 0;
}

.color-dot {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    display: inline-block;
    border: 1.5px solid rgba(255, 255, 255, 0.18);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.color-theme-label {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.select-value:has(.color-swatch-group) {
    display: flex;
    align-items: center;
    gap: 0;
}

.control:focus {
    outline: none;
    border-color: rgba(198, 168, 124, 0.65);
    box-shadow: 0 0 0 4px rgba(198, 168, 124, 0.18);
    transform: translateY(-1px);
}

.link {
    color: var(--accent);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s ease;
}

.link:hover,
.link:focus {
    color: var(--accent-strong);
    text-decoration: underline;
}

.link.subtle {
    color: var(--text-muted);
    font-weight: 400;
}

.link.subtle:hover,
.link.subtle:focus {
    color: var(--text-primary);
}

.custom-textarea {
    margin-top: 14px;
}

.custom-textarea[hidden] {
    display: none;
}

.custom-input {
    margin-top: 10px;
}

.custom-input[hidden] {
    display: none;
}

.select-wrapper-inline {
    margin-bottom: 14px;
}

.look-attributes-selects .select-wrapper {
    width: 100%;
}

[data-companion-card] {
    border-width: 3px;
    border-color: rgba(124, 184, 138, 0.55);
    box-shadow: 0 22px 48px -28px rgba(124, 184, 138, 0.4);
}

.helper {
    font-size: 13px;
    color: var(--text-muted);
    line-height: 1.6;
}

.segment-grid {
    display: grid;
    gap: 18px;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}
.home-layout #prompt-composer {
    width: 100%;
}

@media (min-width: 1200px) {
    .home-layout {
        grid-template-columns: minmax(340px, 460px) minmax(720px, 1fr);
        align-items: start;
    }

    .home-layout #prompt-composer {
        grid-column: 2;
        max-width: min(1200px, 100%);
        margin-left: auto;
        margin-right: 0;
    }

    .home-layout #prompt-composer .segment-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 20px;
    }
}

/* Prompt Library page specific overrides */
@media (min-width: 1200px) {
    .prompt-library-page .home-layout #prompt-composer .segment-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .prompt-library-page .home-layout #prompt-composer .segment-card.segment-upload,
    .prompt-library-page .home-layout #prompt-composer .segment-card.segment-text {
        grid-column: span 1;
    }

    .prompt-library-page .home-layout #prompt-composer .segment-card.segment-wide {
        grid-column: 1 / -1;
    }
}

.segment-card {
    background: linear-gradient(135deg, rgba(198, 168, 124, 0.06), rgba(28, 24, 20, 0.54));
    border: 1px solid rgba(198, 168, 124, 0.2);
    border-radius: 20px;
    padding: 20px 22px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    position: relative;
    overflow: hidden;
}

.look-attributes {
    display: grid;
    gap: 12px;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
}

.look-attribute label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

@media (min-width: 900px) {
    .pipeline-hero {
        gap: 28px;
    }

    .pipeline-guide {
        padding: 24px 28px;
    }

    .form-actions {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        gap: 24px;
    }

    .form-actions .button {
        flex-shrink: 0;
    }

    .pipeline-form .segment-grid {
        grid-template-columns: repeat(12, minmax(0, 1fr));
        column-gap: 14px;
        row-gap: 18px;
    }

    .pipeline-form .segment-card {
        grid-column: span 12;
    }

    .pipeline-form .segment-card.segment-compact,
    .pipeline-form .segment-card.segment-upload {
        grid-column: span 4;
    }

    .pipeline-form .segment-card.segment-text {
        grid-column: span 8;
    }

    .segment-grid-stacked {
        grid-template-columns: repeat(12, minmax(0, 1fr));
    }

    .segment-grid-stacked .segment-inline {
        grid-column: 1 / -1;
    }

    .segment-grid-stacked .segment-upload {
        grid-column: span 4;
    }

    .segment-grid-stacked .segment-text {
        grid-column: span 8;
    }

    .segment-inline .inline-controls {
        flex-direction: row;
        align-items: center;
        justify-content: flex-end;
        gap: 16px;
    }

    .segment-inline .inline-controls .control {
        width: auto;
        min-width: 220px;
    }

    .pipeline-form #pipeline_duration,
    .pipeline-form #source_file {
        width: 100%;
        min-width: 0;
        max-width: none;
    }
}

.segment-card.segment-wide {
    grid-column: 1 / -1;
}

@media (min-width: 1200px) {
    .home-layout #prompt-composer .segment-card.segment-wide {
        grid-column: span 2;
    }

    .home-layout .library-panel {
        grid-column: 2;
        width: 100%;
        max-width: min(1200px, 100%);
        margin-left: auto;
        margin-right: 0;
    }

    body.video-library .home-layout .library-panel {
        max-width: none;
        margin-left: 0;
        margin-right: 0;
    }

    body.video-library .home-layout #prompt-composer {
        max-width: none;
        margin-left: 0;
        margin-right: 0;
    }

    body.image-cloud-library-page .home-layout .library-panel {
        max-width: none;
        margin-left: 0;
        margin-right: 0;
    }

    body.composer:not(.video-library) .home-layout #prompt-composer {
        max-width: none;
        margin-left: 0;
        margin-right: 0;
    }
}

/* ── Community Feed — TikTok / Reels style ── */
body.feed-page {
    overflow: hidden;
    margin: 0;
    padding: 0;
}

/* ── Feed page: pin the top-nav and account for its height ── */
body.feed-page .top-nav {
    position: fixed;
    top: 14px;
    left: 24px;
    right: 24px;
    margin: 0;
    z-index: 200;
    background: rgba(15, 13, 11, 0.78);
}
body.feed-page .top-nav.scrolled { top: 8px; }

/* Floating top bar (legacy — kept for compat, hidden when top-nav present) */
.feed-top-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 20px;
    background: linear-gradient(180deg, rgba(0,0,0,0.6) 0%, transparent 100%);
    pointer-events: none;
}

.feed-top-bar > * { pointer-events: auto; }

.feed-top-brand { display: flex; align-items: center; gap: 12px; text-decoration: none; }
.feed-top-logo {
    width: 54px;
    height: 54px;
    border-radius: 50%;
    border: 3px solid #c6a87c;
    object-fit: cover;
    box-shadow: 0 0 8px rgba(198, 168, 124, 0.3);
}
.feed-top-title {
    font-size: 16px;
    font-weight: 700;
    color: rgba(255, 248, 235, 0.7);
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.feed-top-links {
    display: flex;
    align-items: center;
    gap: 16px;
}

.feed-top-links a {
    color: rgba(255,255,255,0.75);
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    transition: color 0.2s;
}

.feed-top-links a:hover { color: white; }

.feed-top-avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: rgba(198, 168, 124, 0.25);
    border: 1.5px solid rgba(255,255,255,0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    color: white;
}

/* Snap-scroll reel container — offset by the fixed nav bar */
.feed-reel-container {
    --feed-nav-h: 57px;                    /* top-nav height (padding + content) */
    height: calc(100vh - var(--feed-nav-h));
    margin-top: var(--feed-nav-h);
    overflow-y: scroll;
    scroll-snap-type: y mandatory;
    -webkit-overflow-scrolling: touch;
}

/* Each item fills the viewport below the nav */
.feed-reel-item {
    position: relative;
    height: calc(100vh - var(--feed-nav-h, 57px));
    scroll-snap-align: start;
    scroll-snap-stop: always;
    background: #000;
    overflow: hidden;
}

/* ── Media container — standardized landscape layout ── */
.feed-reel-media {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    /* Consistent padding: top 20px, sides 52px for sidebar clearance,
       bottom 88px for caption overlay */
    padding: 20px 52px 88px;
}

/* ── Landscape media: fixed max dimensions for consistency ── */
.feed-reel-media img,
.feed-reel-video {
    max-width: min(100%, 1075px);          /* cap at 1075px for ultra-wide screens */
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 12px;
    box-shadow:
        0 0 0 1px rgba(255, 248, 235, 0.06),
        0 4px 12px rgba(0, 0, 0, 0.4),
        0 16px 48px rgba(0, 0, 0, 0.5),
        0 0 80px rgba(198, 168, 124, 0.08),
        0 0 120px rgba(168, 85, 247, 0.06);
    transform: perspective(1200px) translateZ(24px);
    transition: transform 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94),
                box-shadow 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.feed-reel-media img:hover,
.feed-reel-media:hover .feed-reel-video {
    transform: perspective(1200px) translateZ(40px) scale(1.015);
    box-shadow:
        0 0 0 1px rgba(255, 248, 235, 0.1),
        0 8px 24px rgba(0, 0, 0, 0.5),
        0 24px 64px rgba(0, 0, 0, 0.6),
        0 0 100px rgba(198, 168, 124, 0.12),
        0 0 160px rgba(168, 85, 247, 0.1);
}

.feed-reel-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    color: rgba(255,255,255,0.3);
    text-align: center;
    padding: 24px;
}

.feed-reel-placeholder h2 { color: rgba(255,255,255,0.6); margin: 0; }
.feed-reel-placeholder p { color: rgba(255,255,255,0.4); margin: 0; }

/* Pause flash overlay */
.feed-video-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.feed-video-overlay.flash {
    opacity: 1;
    animation: feed-pause-flash 0.6s ease forwards;
}

@keyframes feed-pause-flash {
    0% { opacity: 0.9; }
    100% { opacity: 0; }
}

/* Progress bar at bottom of video */
.feed-video-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: rgba(255, 248, 235, 0.15);
    z-index: 5;
}

.feed-progress-fill {
    height: 100%;
    width: 0;
    background: linear-gradient(90deg, rgba(198, 168, 124, 0.9), rgba(168, 85, 247, 0.9));
    transition: width 0.15s linear;
}

/* Right-side action buttons (TikTok layout) */
.feed-reel-sidebar {
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 24px;
    z-index: 10;
}

.feed-reel-action {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    padding: 0;
    transition: transform 0.15s ease;
    text-shadow: 0 1px 4px rgba(0,0,0,0.5);
}

.feed-reel-action:hover { transform: scale(1.15); }
.feed-reel-action:active { transform: scale(0.92); }

.feed-reel-action svg {
    filter: drop-shadow(0 1px 3px rgba(0,0,0,0.4));
}

.feed-reel-action.liked { color: #f87171; }
.feed-reel-action.liked svg {
    fill: #f87171;
    stroke: #f87171;
    animation: feed-like-pop 0.35s ease;
}

@keyframes feed-like-pop {
    0% { transform: scale(1); }
    30% { transform: scale(1.35); }
    60% { transform: scale(0.9); }
    100% { transform: scale(1); }
}

/* Mute icon toggle */
.feed-reel-action[data-mute-btn] { color: #1a1a1a; }
.feed-reel-action .icon-unmuted { display: none; }
.feed-reel-action .icon-muted { display: block; }
.feed-reel-action.is-unmuted .icon-unmuted { display: block; }
.feed-reel-action.is-unmuted .icon-muted { display: none; }

/* Left-side caption overlay — vertically centered */
.feed-reel-caption {
    position: absolute;
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
    right: 80px;
    max-width: 340px;
    z-index: 10;
    color: white;
    text-shadow: 0 1px 6px rgba(0,0,0,0.6);
}

.feed-reel-author {
    font-size: 14px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
}

.feed-author-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid rgba(255, 248, 235, 0.3);
    flex-shrink: 0;
}

.feed-author-avatar--placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(198, 168, 124, 0.35);
    color: white;
    font-size: 17px;
    font-weight: 700;
    text-transform: uppercase;
}

.feed-reel-title {
    font-size: 14px;
    margin: 0 0 4px;
    line-height: 1.4;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 30ch;
}

.feed-reel-prompt {
    font-size: 12px;
    margin: 0;
    opacity: 0.75;
    line-height: 1.4;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 30ch;
}

.feed-reel-meta-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 4px;
}

.feed-reel-model {
    font-size: 11px;
    opacity: 0.7;
    text-transform: capitalize;
    background: rgba(255, 248, 235, 0.12);
    padding: 2px 8px;
    border-radius: 4px;
}

.feed-reel-source {
    font-size: 11px;
    opacity: 0.6;
    text-transform: capitalize;
}

.feed-reel-duration {
    font-size: 11px;
    opacity: 0.6;
    margin-top: 0;
    display: inline-block;
}

/* Dark gradient behind caption and sidebar for readability */
.feed-reel-item::after {
    content: "";
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 40%;
    background: linear-gradient(transparent, rgba(0,0,0,0.7));
    pointer-events: none;
    z-index: 4;
}

.feed-reel-sidebar,
.feed-reel-caption {
    z-index: 10;
}

/* Loading spinner */
.feed-loading-spinner {
    position: fixed;
    bottom: 40px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 8px;
    z-index: 50;
}

.feed-spinner-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(198, 168, 124, 0.7);
    animation: feed-dot-pulse 1.2s ease-in-out infinite;
}

.feed-spinner-dot:nth-child(2) { animation-delay: 0.15s; }
.feed-spinner-dot:nth-child(3) { animation-delay: 0.3s; }

@keyframes feed-dot-pulse {
    0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
    40% { transform: scale(1); opacity: 1; }
}

.segment-card::before {
    content: "";
    position: absolute;
    inset: -50% 40% 55% -40%;
    background: linear-gradient(120deg, transparent 48%, rgba(198, 168, 124, 0.12) 70%, transparent 92%);
    opacity: 0.45;
    pointer-events: none;
}

.segment-card > * {
    position: relative;
    z-index: 1;
}

.segment-card.optional {
    border-style: dashed;
    border-color: rgba(255, 248, 235, 0.12);
}

#actor-composer .segment-card {
    border-color: rgba(124, 184, 138, 0.32);
    box-shadow:
        0 0 0 1px rgba(124, 184, 138, 0.18),
        0 14px 48px -22px rgba(42, 188, 148, 0.55),
        var(--shadow-soft);
}

#actor-composer .segment-card::before {
    background: linear-gradient(125deg, transparent 42%, rgba(124, 184, 138, 0.18) 68%, transparent 90%);
}

#actor-composer .segment-card.optional {
    border-style: dashed;
    border-color: rgba(124, 184, 138, 0.35);
}

#actor-composer .segment-header .segment-title {
    font-family: 'Manrope', 'Inter', system-ui, sans-serif;
    font-size: 15px;
    letter-spacing: 0.2em;
    color: var(--text-secondary);
    background-image: linear-gradient(135deg, rgba(124, 184, 138, 0.95), rgba(125, 100, 255, 0.8));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 0 12px 30px rgba(18, 58, 48, 0.42);
}

.segment-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.segment-title {
    font-size: 14px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--text-secondary);
}

.segment-chip {
    font-size: 11px;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    padding: 6px 12px;
    border-radius: 999px;
    background: rgba(198, 168, 124, 0.16);
    border: 1px solid rgba(198, 168, 124, 0.28);
    color: var(--text-primary);
}

.segment-chip.success {
    background: rgba(52, 199, 89, 0.16);
    border-color: rgba(52, 199, 89, 0.28);
    color: #34c759;
}

.segment-chip.danger {
    background: rgba(255, 69, 58, 0.16);
    border-color: rgba(255, 69, 58, 0.28);
    color: #ff453a;
}

.segment-card.optional .segment-chip {
    background: rgba(210, 196, 174, 0.12);
    border-color: rgba(210, 196, 174, 0.2);
    color: var(--text-muted);
}

.segment-helper {
    font-size: 13px;
    color: var(--text-muted);
    line-height: 1.6;
}

/* Video Details card footer row */
.segment-footer-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}
.segment-footer-row .segment-helper {
    flex: 1 1 0;
    min-width: 0;
}
.button-outline.refine-prompt-btn {
    flex-shrink: 0;
    font-size: 14px;
    padding: 10px 20px;
    border-radius: 12px;
    white-space: nowrap;
    border: 1.5px solid rgba(168, 85, 247, 0.8);
    box-shadow: 0 0 8px rgba(168, 85, 247, 0.5), 0 0 20px rgba(168, 85, 247, 0.25);
    transition: box-shadow 0.3s ease, border-color 0.3s ease;
}
.button-outline.refine-prompt-btn:hover {
    border-color: rgba(192, 132, 252, 0.9);
    box-shadow: 0 0 12px rgba(168, 85, 247, 0.7), 0 0 30px rgba(168, 85, 247, 0.35);
    background: rgba(168, 85, 247, 0.1);
}
.refine-prompt-btn.is-loading {
    pointer-events: none;
    opacity: 0.7;
}

/* ── Refine Prompt Modal ── */
.refine-modal {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: clamp(16px, 4vw, 48px);
    z-index: 1200;
}
.refine-modal[hidden] { display: none !important; }

.refine-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(12, 10, 6, 0.85);
    backdrop-filter: blur(18px);
}
.refine-modal-dialog {
    position: relative;
    width: min(640px, 100%);
    max-height: 85vh;
    overflow-y: auto;
    background: rgba(28, 24, 20, 0.94);
    border: 1px solid rgba(255, 248, 235, 0.14);
    border-radius: 24px;
    padding: clamp(20px, 3vw, 28px);
    box-shadow: 0 32px 88px -36px rgba(5, 6, 18, 0.9);
    backdrop-filter: var(--glass-blur);
    z-index: 1;
    display: flex;
    flex-direction: column;
    gap: 18px;
}
/* Golden glow around the Generating Designs box while images are generating */
.gen-modal-dialog.is-generating {
    border-color: rgba(198, 168, 124, 0.55);
    animation: genGoldGlow 2.4s ease-in-out infinite;
}
@keyframes genGoldGlow {
    0%, 100% {
        box-shadow:
            0 32px 88px -36px rgba(5, 6, 18, 0.9),
            0 0 0 1px rgba(198, 168, 124, 0.35),
            0 0 22px 2px rgba(198, 168, 124, 0.30),
            0 0 48px 8px rgba(166, 124, 82, 0.18);
    }
    50% {
        box-shadow:
            0 32px 88px -36px rgba(5, 6, 18, 0.9),
            0 0 0 1px rgba(214, 188, 142, 0.6),
            0 0 34px 6px rgba(214, 188, 142, 0.5),
            0 0 70px 16px rgba(198, 168, 124, 0.32);
    }
}
@media (prefers-reduced-motion: reduce) {
    .gen-modal-dialog.is-generating {
        animation: none;
        box-shadow:
            0 32px 88px -36px rgba(5, 6, 18, 0.9),
            0 0 0 1px rgba(214, 188, 142, 0.55),
            0 0 30px 6px rgba(214, 188, 142, 0.4);
    }
}
.refine-modal-close {
    position: absolute;
    top: 12px;
    right: 12px;
    border: none;
    background: rgba(255, 248, 235, 0.08);
    color: var(--text-primary);
    border-radius: 50%;
    width: 36px;
    height: 36px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease;
}
.refine-modal-close:hover { background: rgba(255, 248, 235, 0.18); }
.refine-modal-header h3 {
    margin: 0;
    font-size: 18px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}
.refine-modal-meta {
    display: block;
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 4px;
}
.refine-modal-body {
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.refine-modal-original,
.refine-modal-refined {
    background: rgba(255, 248, 235, 0.04);
    border: 1px solid rgba(255, 248, 235, 0.08);
    border-radius: 14px;
    padding: 14px 16px;
}
.refine-modal-refined {
    border-color: rgba(198, 168, 124, 0.4);
    background: rgba(198, 168, 124, 0.06);
}
.refine-modal-label {
    display: block;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    margin-bottom: 6px;
    font-weight: 600;
}
.refine-modal-original p,
.refine-modal-refined p {
    margin: 0;
    font-size: 14px;
    line-height: 1.65;
    color: var(--text-primary);
    white-space: pre-wrap;
}
.refine-modal-arrow {
    display: flex;
    justify-content: center;
    color: rgba(198, 168, 124, 0.6);
}
.refine-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding-top: 4px;
}
.refine-modal-footer .button {
    padding: 12px 22px;
    font-size: 14px;
}

/* ── Generation Stages Modal ── */
.gen-stages-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(5, 8, 22, 0.88);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    animation: gen-stages-fade-in 0.3s ease;
}

.gen-stages-overlay[hidden] { display: none !important; }

@keyframes gen-stages-fade-in {
    from { opacity: 0; }
    to   { opacity: 1; }
}

.gen-stages-modal {
    background: var(--bg-card);
    border: 1px solid var(--border-soft);
    border-radius: 20px;
    padding: 36px 40px 32px;
    width: 420px;
    max-width: 92vw;
    box-shadow: var(--shadow-intense);
    animation: gen-stages-slide-up 0.35s ease;
}

@keyframes gen-stages-slide-up {
    from { opacity: 0; transform: translateY(18px) scale(0.97); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

.gen-stages-header {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 28px;
}

.gen-stages-icon {
    color: var(--accent-primary);
    animation: gen-stages-icon-pulse 2.5s ease-in-out infinite;
    flex-shrink: 0;
}

@keyframes gen-stages-icon-pulse {
    0%, 100% { filter: drop-shadow(0 0 8px rgba(198, 168, 124, 0.4)); transform: scale(1); }
    50%      { filter: drop-shadow(0 0 16px rgba(198, 168, 124, 0.7)); transform: scale(1.08); }
}

.gen-stages-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
    letter-spacing: 0.01em;
}

.gen-stages-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.gen-stage {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 12px 14px;
    border-radius: 12px;
    transition: background 0.3s ease, opacity 0.3s ease;
    opacity: 0.38;
}

.gen-stage.is-active {
    opacity: 1;
    background: rgba(var(--accent-primary-rgb), 0.08);
}

.gen-stage.is-done {
    opacity: 0.65;
}

.gen-stage-indicator {
    position: relative;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: 2px solid rgba(255, 248, 235, 0.15);
    flex-shrink: 0;
    margin-top: 1px;
    transition: border-color 0.3s ease, background 0.3s ease;
    box-sizing: border-box;
}

.gen-stage.is-active .gen-stage-indicator {
    border-color: var(--accent-primary);
    background: transparent;
}

.gen-stage.is-active .gen-stage-indicator::after {
    content: '';
    position: absolute;
    inset: 3px;
    border-radius: 50%;
    border: 2px solid var(--accent-primary);
    border-top-color: transparent;
    animation: gen-stage-spin 0.8s linear infinite;
}

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

.gen-stage.is-done .gen-stage-indicator {
    border-color: var(--success);
    background: var(--success);
}

.gen-stage.is-done .gen-stage-indicator::after {
    content: '';
    position: absolute;
    top: 4px;
    left: 3px;
    width: 10px;
    height: 5px;
    border-left: 2px solid var(--bg-primary);
    border-bottom: 2px solid var(--bg-primary);
    transform: rotate(-45deg);
    animation: none;
}

.gen-stage-body {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.gen-stage-label {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    transition: color 0.3s ease;
}

.gen-stage.is-done .gen-stage-label {
    color: var(--text-secondary);
}

.gen-stage-desc {
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.4;
}

.gen-stages-progress {
    margin-top: 24px;
    height: 3px;
    border-radius: 2px;
    background: rgba(255, 248, 235, 0.06);
    overflow: hidden;
}

.gen-stages-progress-bar {
    height: 100%;
    width: 0;
    border-radius: 2px;
    background: linear-gradient(90deg, var(--accent), var(--accent-strong));
    transition: width 0.5s ease;
}

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 16px 22px;
    border-radius: 16px;
    border: none;
    font-weight: 600;
    font-size: 15px;
    background: linear-gradient(135deg, var(--accent), var(--accent-strong));
    color: var(--text-primary);
    cursor: pointer;
    box-shadow: 0 16px 38px -22px rgba(var(--accent-primary-rgb), 0.9);
    transition: transform 0.18s ease, box-shadow 0.18s ease, filter 0.18s ease;
    text-decoration: none;
}

.button-pill {
    border-radius: 999px;
    padding-inline: 26px;
}

.button:hover {
    transform: translateY(-1px);
    box-shadow: 0 22px 52px -22px rgba(var(--accent-primary-rgb), 1);
    filter: brightness(1.02);
}

.button:active {
    transform: translateY(0);
}

.button span {
    font-size: 13px;
    letter-spacing: 0.01em;
    text-transform: none;
    font-weight: 500;
    opacity: 0.86;
}

.button:focus-visible {
    outline: 2px solid rgba(var(--accent-primary-rgb), 0.95);
    outline-offset: 3px;
}

/* Pipeline Progress Overlay */
.pipeline-progress-overlay[hidden] { display: none !important; }
.pipeline-progress-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.pipeline-progress-card {
    min-width: min(560px, 92vw);
    max-width: 92vw;
    background: linear-gradient(135deg, rgba(28, 24, 20, 0.92), rgba(10, 13, 26, 0.88));
    border: 1px solid rgba(255, 248, 235, 0.12);
    border-radius: 16px;
    padding: 20px 20px 18px;
    box-shadow: 0 24px 60px -24px rgba(20, 16, 10, 0.9);
}

.pipeline-progress-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 8px;
}

.pipeline-progress-header strong { font-size: 16px; }
.pipeline-progress-header span { color: var(--text-muted); font-weight: 600; }

.pipeline-progress-stage {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 10px;
}

.pipeline-progress-bar {
    position: relative;
    width: 100%;
    height: 10px;
    border-radius: 999px;
    background: rgba(255, 248, 235, 0.08);
    overflow: hidden;
}

.pipeline-progress-fill {
    position: absolute;
    top: 0; left: 0; bottom: 0;
    width: 0%;
    background: linear-gradient(90deg, var(--accent), var(--accent-strong));
    box-shadow: 0 0 20px rgba(var(--accent-primary-rgb), 0.6);
    transition: width 300ms ease;
}

.pipeline-progress-hint {
    margin-top: 10px;
    font-size: 12px;
    color: var(--text-muted);
}

.pipeline-progress-spinner {
    position: absolute;
    width: 18px; height: 18px;
    border-radius: 50%;
    border: 3px solid rgba(255,255,255,0.2);
    border-top-color: rgba(255,255,255,0.85);
    animation: spin 1s linear infinite;
    top: 18px; right: 18px;
}

.pipeline-progress-cancel { display: none; }

.subtext {
    margin-top: 18px;
    font-size: 13px;
    color: var(--text-muted);
    display: flex;
    gap: 8px;
    align-items: center;
}

.subtext svg {
    width: 16px;
    height: 16px;
    opacity: 0.6;
}

.results-grid {
    display: grid;
    gap: 24px;
}

.catalog-grid {
    display: flex;
    flex-direction: column;
    gap: 32px;
}

.catalog-grid.library-columns {
    display: grid;
}

.catalog-column h3 {
    margin: 0 0 12px;
    font-size: 16px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-secondary);
}

.catalog-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.catalog-tiles {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
    gap: 24px;
}

.catalog-tiles .catalog-card {
    height: 100%;
}

.catalog-card {
    padding: 22px 24px;
    border-radius: 20px;
    background: rgba(28, 24, 20, 0.6);
    border: 1px solid rgba(255, 248, 235, 0.1);
    display: flex;
    flex-direction: column;
    gap: 16px;
    box-shadow: 0 22px 44px -28px rgba(20, 16, 10, 0.72);
}


.library-empty {
    display: flex;
    flex-direction: column;
    gap: 12px;
    align-items: flex-start;
    padding: 32px;
    border-radius: 20px;
    border: 1px solid var(--border-soft);
    background: rgba(28, 24, 20, 0.58);
    box-shadow: var(--shadow-soft);
    backdrop-filter: var(--glass-blur);
}

.library-empty h3 {
    margin: 0;
    font-size: 18px;
    color: var(--text-primary);
}

.library-empty p {
    margin: 0;
    color: var(--text-secondary);
}

.library-empty[hidden] {
    display: none;
}

.image-results {
    margin-top: 36px;
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.image-results h3 {
    margin: 0;
    font-size: 18px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--text-secondary);
}

.image-grid {
    display: grid;
    gap: 24px;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.image-card {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 18px;
    border-radius: 20px;
    background: rgba(28, 24, 20, 0.6);
    border: 1px solid rgba(255, 248, 235, 0.08);
    box-shadow: 0 20px 44px -30px rgba(20, 16, 10, 0.76);
}

.image-card img {
    width: 100%;
    border-radius: 16px;
    border: 1px solid rgba(255, 248, 235, 0.08);
    background: rgba(0, 0, 0, 0.4);
}

.image-card figcaption {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    font-size: 13px;
    color: var(--text-secondary);
}

.alert {
    margin-top: 18px;
    padding: 16px 18px;
    border-radius: 14px;
    font-size: 14px;
    line-height: 1.6;
    border: 1px solid rgba(255, 248, 235, 0.12);
    background: rgba(28, 24, 20, 0.6);
}

.alert-error {
    border-color: rgba(196, 94, 94, 0.3);
    color: var(--danger);
    background: rgba(196, 94, 94, 0.08);
}

.info-callout {
    margin-bottom: 28px;
    padding: 20px 24px;
    border-radius: 18px;
    background: rgba(28, 24, 20, 0.58);
    border: 1px solid rgba(255, 248, 235, 0.1);
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.info-callout h3 {
    margin: 0;
    font-size: 18px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-secondary);
}

.process-list {
    margin: 0;
    padding-left: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    color: var(--text-secondary);
    font-size: 14px;
    line-height: 1.6;
}

.info-note {
    margin: 0;
    font-size: 13px;
    color: var(--text-muted);
}

.button.is-loading {
    position: relative;
    pointer-events: none;
    opacity: 0.75;
}

.button.is-loading::after {
    content: '';
    position: absolute;
    right: 18px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 2px solid rgba(255, 248, 235, 0.4);
    border-top-color: rgba(255, 248, 235, 0.9);
    animation: spin 0.8s linear infinite;
}

.catalog-metadata {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.catalog-id {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.catalog-meta {
    font-size: 12px;
    color: var(--text-muted);
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.catalog-tags {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.catalog-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.catalog-empty {
    padding: 18px 20px;
    border-radius: 16px;
    background: rgba(8, 11, 20, 0.5);
    border: 1px dashed rgba(255, 248, 235, 0.12);
    font-size: 13px;
    color: var(--text-muted);
}

.empty-state {
    display: flex;
    flex-direction: column;
    gap: 14px;
    text-align: center;
    align-items: center;
    justify-content: center;
    padding: 40px 24px;
}

.empty-state[hidden] {
    display: none;
}

.empty-state h2 {
    margin: 0;
    font-size: 24px;
}

.empty-state p {
    margin: 0;
    max-width: 380px;
    color: var(--text-secondary);
}

.video-card {
    background: var(--bg-card-alt);
    border-radius: 22px;
    padding: 24px;
    border: 1px solid rgba(255, 248, 235, 0.08);
    box-shadow: 0 18px 40px -26px rgba(14, 23, 56, 0.6);
    transition: transform 0.24s ease, border 0.24s ease;
}

.video-card.best {
    border-color: rgba(124, 184, 138, 0.7);
    background: linear-gradient(145deg, rgba(33, 43, 72, 0.9), rgba(33, 43, 72, 0.6));
    box-shadow: 0 24px 48px -26px rgba(124, 184, 138, 0.5);
}

.video-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 18px;
}

.video-header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.video-header h2 {
    margin: 0;
    font-size: 20px;
}

.status-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 16px;
}

.status-badge {
    padding: 8px 14px;
    border-radius: 999px;
    font-size: 12px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    background: rgba(198, 168, 124, 0.18);
    border: 1px solid rgba(198, 168, 124, 0.28);
    color: var(--text-primary);
}

.status-badge.ready {
    background: rgba(124, 184, 138, 0.2);
    border-color: rgba(124, 184, 138, 0.35);
    color: var(--success);
}

.status-badge.danger {
    background: rgba(196, 94, 94, 0.2);
    border-color: rgba(196, 94, 94, 0.35);
    color: var(--danger);
}

.status-meta {
    font-size: 12px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.progress-track {
    position: relative;
    width: 100%;
    height: 10px;
    border-radius: 999px;
    background: rgba(255, 248, 235, 0.06);
    border: 1px solid rgba(255, 248, 235, 0.08);
    margin-bottom: 18px;
    overflow: hidden;
}

.progress-bar {
    position: absolute;
    inset: 0;
    width: 0;
    border-radius: inherit;
    background: linear-gradient(135deg, rgba(198, 168, 124, 0.9), rgba(166, 124, 82, 0.9));
    transition: width 0.3s ease;
}

[data-progress-wrapper][data-complete="true"] .progress-bar {
    background: linear-gradient(135deg, rgba(124, 184, 138, 0.9), rgba(122, 255, 214, 0.8));
}

[data-progress-wrapper][data-error="true"] .progress-bar {
    background: linear-gradient(135deg, rgba(196, 94, 94, 0.9), rgba(255, 129, 164, 0.8));
}

[data-progress-wrapper][data-error="true"] {
    border-color: rgba(196, 94, 94, 0.4);
}

/* ============================================
   Enhanced Error State Styling
   ============================================ */

/* Error state placeholder container */
.video-placeholder.error-state {
    background: linear-gradient(135deg, rgba(196, 94, 94, 0.08) 0%, rgba(20, 22, 27, 0.95) 100%);
    border: 1px solid rgba(196, 94, 94, 0.25);
    border-radius: 12px;
}

/* Error message content wrapper */
.error-message-content {
    display: block;
    text-align: center;
    padding: 24px 20px;
    color: rgba(255, 248, 235, 0.9);
    font-size: 14px;
    line-height: 1.6;
    max-width: 380px;
    margin: 0 auto;
    background: rgba(196, 94, 94, 0.1);
    border-radius: 10px;
    border: 1px solid rgba(196, 94, 94, 0.2);
    backdrop-filter: blur(8px);
    animation: error-fade-in 0.4s ease-out;
}

@keyframes error-fade-in {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Error message text styling - first part (emoji + title) */
.error-message-content::first-line {
    font-weight: 600;
    color: rgba(255, 129, 164, 1);
}

/* Moderation-specific styling - add subtle icon background */
.video-placeholder.error-state [data-progress-text] {
    position: relative;
}

.video-placeholder.error-state [data-progress-text]::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 120px;
    height: 120px;
    background: radial-gradient(circle, rgba(196, 94, 94, 0.08) 0%, transparent 70%);
    border-radius: 50%;
    pointer-events: none;
    z-index: -1;
}

/* Error state status indicator */
.video-card[data-status="error"] .status-indicator {
    color: var(--danger);
}

.video-card[data-status="error"] .status-text {
    color: rgba(255, 129, 164, 1);
    font-weight: 500;
}

/* Error state progress label styling */
.video-card[data-status="error"] .progress-label {
    color: rgba(255, 129, 164, 1);
}

/* Error state ETA text */
.video-card[data-status="error"] .progress-eta {
    color: rgba(196, 94, 94, 0.7);
}

[data-progress-wrapper][data-stalled="true"] .progress-bar {
    background: linear-gradient(135deg, rgba(255, 193, 7, 0.9), rgba(255, 213, 79, 0.8));
    animation: pulse-stalled 1.5s ease-in-out infinite;
}

[data-progress-wrapper][data-stalled="true"] {
    border-color: rgba(255, 193, 7, 0.4);
}

@keyframes pulse-stalled {
    0%, 100% { opacity: 0.7; }
    50% { opacity: 1; }
}

.progress-label {
    display: block;
    font-size: 12px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 10px;
}

.pill {
    padding: 6px 12px;
    border-radius: 999px;
    font-size: 12px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    backdrop-filter: blur(12px);
    background: rgba(124, 184, 138, 0.18);
    color: var(--success);
    border: 1px solid rgba(124, 184, 138, 0.32);
}

.pill-action {
    cursor: pointer;
    border: 1px solid rgba(124, 184, 138, 0.32);
    background: rgba(124, 184, 138, 0.18);
    color: var(--success);
    font-family: inherit;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.pill-action:hover:not(:disabled) {
    background: rgba(124, 184, 138, 0.28);
}

.pill-action:disabled {
    cursor: not-allowed;
    opacity: 0.55;
}

.video {
    width: 100%;
    border-radius: 18px;
    border: 1px solid rgba(255, 248, 235, 0.08);
    margin-bottom: 18px;
    background: rgba(0, 0, 0, 0.3);
}

.video[hidden],
.video-placeholder[hidden] {
    display: none;
}

.actor-placeholder {
    min-height: 320px;
}

.actor-frame {
    position: relative;
    width: 100%;
    border-radius: 18px;
    overflow: hidden;
    margin-bottom: 18px;
    display: flex;
    justify-content: center;
    background: rgba(0, 0, 0, 0.3);
}

.actor-image {
    max-width: 100%;
    max-height: 1280px;
    width: auto;
    height: auto;
    display: block;
    border-radius: 18px;
    border: 1px solid rgba(255, 248, 235, 0.08);
    background: rgba(0, 0, 0, 0.3);
    object-fit: contain;
}

.video-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 32px 18px;
    border-radius: 18px;
    border: 1px dashed rgba(255, 248, 235, 0.18);
    background: rgba(8, 11, 20, 0.42);
    margin-bottom: 18px;
    min-height: 220px;
    color: var(--text-secondary);
}

.video-loading-loop {
    width: 100%;
    max-width: 520px;
    height: 160px;
    object-fit: cover;
    border-radius: 14px;
    border: 1px solid rgba(255, 248, 235, 0.1);
    background: rgba(0, 0, 0, 0.28);
}

.spinner {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    border: 3px solid rgba(198, 168, 124, 0.2);
    border-top-color: rgba(255, 248, 235, 0.9);
    animation: spin 1s linear infinite;
}

.status-hint {
    font-size: 12px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.retry-btn {
    margin-top: 12px;
    padding: 8px 16px;
    font-size: 12px;
    background: rgba(255, 193, 7, 0.2);
    border: 1px solid rgba(255, 193, 7, 0.5);
    color: #ffc107;
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.retry-btn:hover:not(:disabled) {
    background: rgba(255, 193, 7, 0.35);
}

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

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

.score-board {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 12px;
}

.video-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 16px;
}

.pipeline-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid rgba(255, 248, 235, 0.08);
}

.action-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 1 1 140px;
    padding: 12px 16px;
    border-radius: 14px;
    border: 1px solid rgba(255, 248, 235, 0.14);
    background: rgba(19, 24, 40, 0.6);
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 500;
    letter-spacing: 0.02em;
    text-decoration: none;
    cursor: pointer;
    box-shadow: 0 10px 24px -18px rgba(0, 0, 0, 0.75);
    transition: border-color 0.18s ease, background 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease;
}

.action-button:hover {
    border-color: rgba(var(--accent-primary-rgb), 0.5);
    background: rgba(var(--accent-primary-rgb), 0.16);
    transform: translateY(-1px);
    box-shadow: 0 16px 34px -22px rgba(0, 0, 0, 0.78);
}

.action-button:focus-visible {
    outline: 2px solid rgba(var(--accent-primary-rgb), 0.95);
    outline-offset: 3px;
}

.action-button:disabled {
    cursor: not-allowed;
    opacity: 0.5;
    transform: none;
}

.action-button.is-disabled {
    cursor: not-allowed;
    opacity: 0.5;
    transform: none;
}

.action-button.subtle {
    flex: 0 0 auto;
    background: rgba(198, 168, 124, 0.12);
    border-color: rgba(198, 168, 124, 0.28);
    font-size: 13px;
    padding: 10px 16px;
}

.action-button.primary {
    flex: 0 0 auto;
    background: linear-gradient(135deg, rgba(98, 149, 255, 0.95), rgba(71, 118, 255, 0.85));
    border-color: rgba(134, 176, 255, 0.9);
    color: #f6f8ff;
    box-shadow: 0 8px 18px rgba(45, 76, 149, 0.28);
}

.remix-secondary-actions .action-button {
    flex: 1 1 0;
    min-width: 0;
    text-align: center;
}

.action-button.primary:hover {
    background: linear-gradient(135deg, rgba(128, 174, 255, 0.98), rgba(86, 133, 255, 0.93));
    border-color: rgba(158, 196, 255, 0.95);
}

.action-button.danger {
    flex: 0 0 auto;
    background: rgba(196, 94, 94, 0.12);
    border-color: rgba(255, 112, 146, 0.4);
    color: rgba(255, 228, 234, 0.95);
}

.action-button.danger:hover {
    background: rgba(196, 94, 94, 0.2);
    border-color: rgba(255, 138, 166, 0.65);
}

.action-button.accent {
    flex: 1 1 100%;
    background: linear-gradient(135deg, rgba(102, 153, 255, 0.92), rgba(76, 122, 255, 0.78));
    border-color: rgba(122, 169, 255, 0.9);
    color: #f6f8ff;
    box-shadow: 0 14px 28px rgba(48, 82, 156, 0.28);
}

.action-button.accent:hover {
    background: linear-gradient(135deg, rgba(132, 176, 255, 0.98), rgba(89, 133, 255, 0.92));
    border-color: rgba(146, 190, 255, 0.95);
}

.remix-panel {
    margin-top: 18px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding: 18px 20px;
    border-radius: 18px;
    background: rgba(10, 14, 28, 0.6);
    border: 1px solid rgba(198, 168, 124, 0.22);
}

.remix-label {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--text-muted);
}

.remix-input {
    width: 100%;
    min-height: 120px;
    padding: 16px;
    border-radius: 14px;
    border: 1px solid rgba(255, 248, 235, 0.1);
    background: rgba(8, 11, 20, 0.62);
    color: var(--text-primary);
    font-family: 'Inter', system-ui, sans-serif;
    font-size: 14px;
    line-height: 1.6;
    resize: vertical;
}

.remix-input:focus {
    outline: none;
    border-color: rgba(198, 168, 124, 0.65);
    box-shadow: 0 0 0 4px rgba(198, 168, 124, 0.18);
}

.remix-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
}

.remix-controls .ghost-link {
    padding: 8px 12px;
}

.remix-status {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 14px 16px;
    border-radius: 16px;
    background: rgba(28, 24, 20, 0.56);
    border: 1px dashed rgba(198, 168, 124, 0.24);
}

.remix-progress-track {
    position: relative;
    width: 100%;
    height: 8px;
    border-radius: 999px;
    background: rgba(255, 248, 235, 0.08);
    overflow: hidden;
}

.remix-progress-bar {
    position: absolute;
    inset: 0;
    width: 0;
    border-radius: inherit;
    background: linear-gradient(135deg, rgba(198, 168, 124, 0.9), rgba(166, 124, 82, 0.9));
    transition: width 0.3s ease;
}

[data-remix-progress-wrapper][data-error="true"] .remix-progress-bar {
    background: linear-gradient(135deg, rgba(196, 94, 94, 0.9), rgba(255, 129, 164, 0.8));
}

.remix-status-text {
    font-size: 13px;
    color: var(--text-secondary);
}

.remix-error {
    font-size: 13px;
    color: var(--danger);
}

.remix-video {
    width: 100%;
    border-radius: 16px;
    border: 1px solid rgba(255, 248, 235, 0.12);
    background: rgba(0, 0, 0, 0.3);
}

.remix-video[hidden] {
    display: none;
}

.remix-secondary-actions {
    display: flex;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 10px;
}

/* ============================================
   ENHANCED RESULTS PAGE STYLES
   ============================================ */

/* Collapsible Panel */
.results-hero-panel[data-collapsible-panel] {
    position: relative;
    transition: all 0.3s ease;
    gap: 0; /* Override .hero gap for tighter control */
}

.results-hero-panel.is-collapsed {
    width: 60px;
    min-width: 60px;
    max-width: 60px;
    padding: 16px 12px;
    overflow: hidden;
}

/* When sidebar is collapsed, give shot reel more space */
.results-layout:has(.results-hero-panel.is-collapsed) {
    grid-template-columns: 60px 1fr;
}

/* Header row with eyebrow and collapse button */
.panel-header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 20px;
}

.panel-header-row .eyebrow {
    margin: 0;
}

.panel-collapsed-info[hidden] {
    display: none !important;
}

.panel-header-row + .panel-collapsed-info + .panel-content,
.panel-header-row ~ .panel-content {
    margin-top: 0;
}

.panel-content h1 {
    margin-top: 0;
}

.panel-collapse-toggle {
    position: absolute;
    top: 24px;
    right: 24px;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: rgba(198, 168, 124, 0.15);
    border: 1px solid rgba(198, 168, 124, 0.3);
    border-radius: 999px;
    color: var(--text-secondary);
    font-size: 12px;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
    z-index: 10;
}

/* When collapsed, center the button */
.results-hero-panel.is-collapsed .panel-collapse-toggle {
    position: relative;
    top: auto;
    right: auto;
    margin: 0 auto;
}

.panel-collapse-toggle:hover {
    background: rgba(198, 168, 124, 0.25);
    color: var(--text-primary);
}

.panel-collapse-toggle .collapse-icon {
    transition: transform 0.3s ease;
}

.results-hero-panel.is-collapsed .panel-collapse-toggle .collapse-icon {
    transform: rotate(180deg);
}

.results-hero-panel.is-collapsed .collapse-label {
    display: none;
}

.panel-collapsed-info {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding-top: 50px;
}

.eyebrow-mini {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: var(--text-muted);
    writing-mode: vertical-rl;
    text-orientation: mixed;
}

.collapsed-tag {
    font-size: 10px;
    padding: 4px 8px;
    background: rgba(198, 168, 124, 0.15);
    border-radius: 6px;
    color: var(--text-secondary);
    writing-mode: vertical-rl;
}

.panel-content {
    transition: opacity 0.3s ease;
}

.results-hero-panel.is-collapsed .panel-content {
    opacity: 0;
    visibility: hidden;
    height: 0;
    overflow: hidden;
}

.results-hero-panel.is-collapsed .panel-header-row {
    opacity: 0;
    visibility: hidden;
    height: 0;
    overflow: hidden;
}

.results-hero-panel.is-collapsed [data-collapsed-info] {
    display: flex !important;
}

/* Generation Details Accordion */
.generation-details-accordion,
.prompt-box-accordion {
    margin-top: 20px;
    border: 1px solid rgba(255, 248, 235, 0.1);
    border-radius: 16px;
    background: rgba(10, 14, 28, 0.5);
    overflow: hidden;
}

.generation-details-summary,
.prompt-box-summary {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    cursor: pointer;
    list-style: none;
    user-select: none;
    transition: background 0.2s ease;
}

.generation-details-summary::-webkit-details-marker,
.prompt-box-summary::-webkit-details-marker {
    display: none;
}

.generation-details-summary:hover,
.prompt-box-summary:hover {
    background: rgba(198, 168, 124, 0.08);
}

.accordion-chevron {
    transition: transform 0.2s ease;
    color: var(--text-muted);
}

details[open] .accordion-chevron {
    transform: rotate(180deg);
}

.generation-details-summary span:first-of-type,
.prompt-box-summary span:first-of-type {
    font-weight: 600;
    color: var(--text-primary);
}

.details-meta {
    margin-left: auto;
    font-size: 12px;
    color: var(--text-muted);
}

.generation-details-content {
    padding: 0 20px 20px;
}

.prompt-box-accordion-content {
    border: none;
    border-radius: 0;
    background: transparent;
    margin-top: 0;
    padding-top: 0;
}

.prompt-box-accordion .prompt-box {
    border-top: 1px solid rgba(255, 248, 235, 0.08);
    border-radius: 0 0 16px 16px;
}

/* Enhanced Shot Reel */
.surface-shot-reel-enhanced {
    padding: clamp(24px, 3vw, 36px);
    flex: 1;
    min-width: 0;
}

.results-grid-enhanced {
    display: grid;
    grid-template-columns: 1fr;
    gap: 28px;
}

/* Enhanced Video Card */
.video-card-enhanced {
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    max-width: 100%;
}

/* When there's only one video, make it even larger */
.results-grid-enhanced .video-card-enhanced:only-child {
    max-width: 100%;
}

.video-header-enhanced {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 0;
}

.video-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.video-title-row h2 {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
}

/* Status Indicator */
.status-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
}

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

.status-dot-ready {
    background: var(--success);
    box-shadow: 0 0 8px rgba(124, 184, 138, 0.6);
}

.status-dot-processing {
    background: var(--accent);
    box-shadow: 0 0 8px rgba(198, 168, 124, 0.6);
    animation: pulse-status 1.5s ease-in-out infinite;
}

.status-dot-error {
    background: var(--danger);
    box-shadow: 0 0 8px rgba(196, 94, 94, 0.6);
}

@keyframes pulse-status {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.status-text {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
}

/* Top Pick Pill Enhanced */
.pill-top-pick {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    background: linear-gradient(135deg, rgba(124, 184, 138, 0.2), rgba(122, 255, 214, 0.15));
    border: 1px solid rgba(124, 184, 138, 0.4);
    color: var(--success);
}

.pill-top-pick svg {
    width: 14px;
    height: 14px;
}

/* Progress Section */
.progress-section {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.progress-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.progress-eta {
    font-size: 12px;
    color: var(--text-muted);
}

/* Enhanced Video Player Container - MUCH LARGER */
.video-player-container {
    position: relative;
    border-radius: 16px;
    overflow: hidden;
    background: rgba(0, 0, 0, 0.4);
    width: 100%;
}

.video-enhanced {
    width: 100%;
    display: block;
    border-radius: 16px;
    min-height: 420px;
    max-height: none;
    object-fit: contain;
    background: #000;
}

.video-placeholder-enhanced {
    min-height: 420px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border-radius: 16px;
}

.video-fullscreen-btn {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.6);
    border: 1px solid rgba(255, 248, 235, 0.2);
    border-radius: 8px;
    color: var(--text-primary);
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.2s ease, background 0.2s ease;
}

.video-player-container:hover .video-fullscreen-btn {
    opacity: 1;
}

.video-fullscreen-btn:hover {
    background: rgba(0, 0, 0, 0.8);
}

/* Video Metadata */
.video-metadata {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    padding: 12px 16px;
    background: rgba(10, 14, 28, 0.5);
    border-radius: 12px;
    border: 1px solid rgba(255, 248, 235, 0.06);
}

.metadata-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--text-muted);
}

.metadata-item svg {
    opacity: 0.6;
}

.metadata-id {
    margin-left: auto;
    font-family: monospace;
    font-size: 11px;
}

/* Consolidated Action Bar */
.video-action-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 12px 0;
    border-top: 1px solid rgba(255, 248, 235, 0.06);
}

.action-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 14px;
    background: rgba(255, 248, 235, 0.06);
    border: 1px solid rgba(255, 248, 235, 0.1);
    border-radius: 10px;
    color: var(--text-secondary);
    font-size: 13px;
    font-family: inherit;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.action-btn:hover:not(:disabled) {
    background: rgba(255, 248, 235, 0.1);
    color: var(--text-primary);
    border-color: rgba(255, 248, 235, 0.2);
}

.action-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.action-btn svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.action-btn-primary {
    background: linear-gradient(135deg, rgba(198, 168, 124, 0.9), rgba(166, 124, 82, 0.85));
    border-color: rgba(198, 168, 124, 0.5);
    color: white;
}

.action-btn-primary:hover:not(:disabled) {
    background: linear-gradient(135deg, rgba(113, 155, 255, 0.95), rgba(142, 112, 255, 0.9));
    border-color: rgba(113, 155, 255, 0.6);
}

.action-btn-divider {
    width: 1px;
    height: 24px;
    background: rgba(255, 248, 235, 0.1);
    margin: 0 4px;
    align-self: center;
}

.action-btn-social {
    padding: 8px 12px;
    font-size: 12px;
}

.action-btn-social:hover:not(:disabled) {
    background: rgba(198, 168, 124, 0.15);
    border-color: rgba(198, 168, 124, 0.3);
    color: var(--accent);
}

/* Coming Soon wrapper and tooltip */
.action-btn-coming-soon-wrapper {
    position: relative;
    display: inline-flex;
}

.action-btn-coming-soon {
    pointer-events: none;
    opacity: 0.5;
}

.action-btn-coming-soon-wrapper::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    padding: 6px 12px;
    background: rgba(198, 168, 124, 0.95);
    color: #fff;
    font-size: 12px;
    font-weight: 500;
    border-radius: 6px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease, transform 0.2s ease;
    margin-bottom: 8px;
    z-index: 100;
}

.action-btn-coming-soon-wrapper:hover::after {
    opacity: 1;
}

/* Enhanced Remix Panel */
.remix-panel-enhanced {
    margin-top: 0;
    padding: 20px;
    background: linear-gradient(135deg, rgba(10, 14, 28, 0.8), rgba(18, 22, 48, 0.6));
    border: 1px solid rgba(198, 168, 124, 0.25);
    border-radius: 16px;
}

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

.remix-title {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
}

.remix-title svg {
    color: var(--accent);
}

.remix-close-btn {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 248, 235, 0.06);
    border: 1px solid rgba(255, 248, 235, 0.1);
    border-radius: 8px;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s ease;
}

.remix-close-btn:hover {
    background: rgba(196, 94, 94, 0.15);
    border-color: rgba(196, 94, 94, 0.3);
    color: var(--danger);
}

.remix-description {
    margin: 0 0 16px;
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.5;
}

.remix-panel-enhanced .remix-input {
    min-height: 100px;
    margin-bottom: 16px;
}

.remix-panel-enhanced .remix-controls {
    justify-content: flex-start;
}

.remix-panel-enhanced .remix-controls .action-button {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

/* Responsive adjustments */
@media (max-width: 1199px) {
    .video-enhanced,
    .video-placeholder-enhanced {
        min-height: 360px;
    }
}

@media (max-width: 900px) {
    .content.results-layout {
        grid-template-columns: 1fr;
        grid-template-areas: "hero" "shot";
    }
    
    .results-layout > .results-hero-panel {
        max-width: 100%;
    }
    
    .results-grid-enhanced {
        grid-template-columns: 1fr;
    }
    
    .video-action-bar {
        justify-content: center;
    }
    
    .action-btn-divider {
        display: none;
    }
    
    .video-metadata {
        justify-content: center;
    }
    
    .metadata-id {
        margin-left: 0;
    }
    
    .video-enhanced,
    .video-placeholder-enhanced {
        min-height: 300px;
    }
}

@media (max-width: 600px) {
    .action-btn span {
        display: none;
    }
    
    .action-btn {
        padding: 10px;
    }
    
    .action-btn-primary span {
        display: inline;
    }
    
    .video-enhanced,
    .video-placeholder-enhanced {
        min-height: 220px;
    }
}

/* Multiple videos layout - 2 columns when there's space */
@media (min-width: 1400px) {
    .results-grid-enhanced:has(.video-card-enhanced:nth-child(2)) {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .results-grid-enhanced:has(.video-card-enhanced:nth-child(2)) .video-enhanced,
    .results-grid-enhanced:has(.video-card-enhanced:nth-child(2)) .video-placeholder-enhanced {
        min-height: 320px;
    }
}

/* ============================================
   END ENHANCED RESULTS PAGE STYLES
   ============================================ */

.segment-summary {
    margin-top: 28px;
    display: grid;
    gap: 16px;
}

.summary-row {
    border-radius: 16px;
    border: 1px solid rgba(255, 248, 235, 0.08);
    background: rgba(28, 24, 20, 0.56);
    padding: 16px 18px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.summary-row span {
    font-size: 12px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.summary-row p {
    margin: 0;
    font-size: 14px;
    line-height: 1.7;
    color: var(--text-secondary);
}

.catalog-hint {
    margin-top: 10px;
    font-size: 12px;
    letter-spacing: 0.02em;
    color: var(--text-muted);
}

.pill-success {
    background: rgba(61, 217, 159, 0.18);
    border-color: rgba(61, 217, 159, 0.38);
    color: #5ff0c2;
}

.pill-muted {
    background: rgba(207, 211, 255, 0.14);
    border-color: rgba(207, 211, 255, 0.32);
    color: rgba(227, 229, 255, 0.78);
}

.pill-accent {
    background: rgba(198, 168, 124, 0.16);
    border-color: rgba(198, 168, 124, 0.42);
    color: var(--accent);
}

.actor-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 28px;
}

.actor-card.video-card {
    display: flex;
    flex-direction: column;
    gap: 18px;
    overflow: hidden;
    height: 680px;
}

.actor-card.video-card .actor-frame {
    flex-shrink: 0;
    max-height: 280px;
}

.actor-card.video-card .actor-image {
    max-height: 280px;
    object-fit: contain;
}

.actor-card-body {
    display: flex;
    flex-direction: column;
    gap: 18px;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

.actor-card-content {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding-right: 6px;
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.actor-card-content::-webkit-scrollbar {
    width: 6px;
}

.actor-card-content::-webkit-scrollbar-track {
    background: transparent;
}

.actor-card-content::-webkit-scrollbar-thumb {
    background: rgba(255, 248, 235, 0.18);
    border-radius: 999px;
}

.actor-card-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 12px;
}

.actor-card-title {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
}

.actor-card-subtitle {
    margin: 0;
    font-size: 14px;
    line-height: 1.7;
    color: var(--text-secondary);
}

.actor-card-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.actor-card-list {
    display: grid;
    gap: 12px;
    margin: 0;
}

.actor-card-list div {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.actor-card-list dt {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    color: var(--text-muted);
}

.actor-card-list dd {
    margin: 0;
    font-size: 13px;
    line-height: 1.7;
    color: var(--text-secondary);
}

.actor-card-actions,
.library-video-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding-top: 12px;
    border-top: 1px solid rgba(255, 248, 235, 0.06);
    background: linear-gradient(180deg, rgba(9, 11, 24, 0) 0%, rgba(9, 11, 24, 0.35) 100%);
    margin-top: auto;
}

.actor-card-actions .action-button,
.library-video-actions .action-button {
    flex: 1 1 auto;
    width: 100%;
}

.actor-card-prompt {
    border-top: 1px solid rgba(255, 248, 235, 0.06);
    padding-top: 12px;
}

.actor-card-prompt summary {
    cursor: pointer;
    font-size: 13px;
    color: var(--text-secondary);
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.actor-card-prompt p {
    margin: 8px 0 0;
    font-size: 13px;
    line-height: 1.7;
    color: var(--text-secondary);
}

.metric {
    padding: 12px 14px;
    border-radius: 14px;
    background: rgba(198, 168, 124, 0.1);
    border: 1px solid rgba(198, 168, 124, 0.16);
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.metric span {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
}

.metric strong {
    font-size: 18px;
    font-weight: 600;
}

.actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 32px;
    flex-wrap: wrap;
    gap: 16px;
}

.ghost-link {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 14px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    border-radius: 12px;
    background: rgba(255, 248, 235, 0.04);
    border: 1px solid rgba(255, 248, 235, 0.08);
    transition: background 0.18s ease, border-color 0.18s ease, color 0.18s ease, transform 0.18s ease;
}

.ghost-link.is-disabled {
    pointer-events: none;
    opacity: 0.4;
}

.ghost-link:hover {
    background: rgba(255, 248, 235, 0.06);
    border-color: rgba(255, 248, 235, 0.14);
    color: var(--text-primary);
    transform: translateY(-1px);
}

.ghost-link:focus-visible {
    outline: 2px solid rgba(var(--accent-primary-rgb), 0.95);
    outline-offset: 3px;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

.button-small {
    padding: 10px 16px;
    font-size: 13px;
    line-height: 1.3;
}

.studio-layout {
    grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
}

@media (min-width: 1200px) {
    .studio-layout {
        grid-template-columns: minmax(340px, 420px) minmax(360px, 1fr) minmax(320px, 420px);
        align-items: start;
    }
}

.studio-hero-metrics {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 14px;
    margin-top: 16px;
}

.studio-metric {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 14px 16px;
    border-radius: 16px;
    background: rgba(255, 248, 235, 0.04);
    border: 1px solid rgba(255, 248, 235, 0.08);
}

.studio-metric-label {
    font-size: 11px;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.studio-metric-value {
    font-size: 20px;
    font-weight: 600;
}

.studio-panel {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.studio-panel-wide {
    grid-column: 1 / -1;
    border: 4px solid rgba(198, 168, 124, 0.95);
    box-shadow:
        0 0 24px rgba(198, 168, 124, 0.45),
        0 0 64px rgba(198, 168, 124, 0.35),
        var(--shadow-soft);
    position: relative;
    overflow: hidden;
}

.studio-panel-wide::after {
    content: "";
    position: absolute;
    inset: -6px;
    border-radius: inherit;
    background:
        radial-gradient(circle at 20% 15%, rgba(111, 203, 255, 0.35), transparent 60%),
        radial-gradient(circle at 80% 80%, rgba(121, 106, 255, 0.32), transparent 65%);
    filter: blur(20px);
    opacity: 0.9;
    pointer-events: none;
    z-index: 0;
}

.studio-render-panel {
    gap: 24px;
    border: 4px solid rgba(198, 168, 124, 0.95);
    box-shadow:
        0 0 26px rgba(198, 168, 124, 0.4),
        0 0 80px rgba(37, 74, 170, 0.32),
        var(--shadow-soft);
    position: relative;
    overflow: hidden;
}

.studio-render-panel::after {
    content: "";
    position: absolute;
    inset: 12px;
    border-radius: inherit;
    border: 1px solid rgba(147, 189, 255, 0.4);
    box-shadow: inset 0 0 38px rgba(198, 168, 124, 0.25);
    pointer-events: none;
    z-index: 0;
}

.studio-timeline-panel {
    gap: 24px;
    border: 4px solid rgba(198, 168, 124, 0.95);
    box-shadow:
        0 0 24px rgba(198, 168, 124, 0.45),
        0 0 64px rgba(198, 168, 124, 0.35),
        var(--shadow-soft);
    position: relative;
    overflow: hidden;
}

.studio-timeline-panel::after {
    content: "";
    position: absolute;
    inset: -6px;
    border-radius: inherit;
    background:
        radial-gradient(circle at 20% 15%, rgba(111, 203, 255, 0.35), transparent 60%),
        radial-gradient(circle at 80% 80%, rgba(121, 106, 255, 0.32), transparent 65%);
    filter: blur(20px);
    opacity: 0.9;
    pointer-events: none;
    z-index: 0;
}

.timeline-editor-overlay {
    position: fixed;
    inset: 0;
    background: rgba(5, 8, 20, 0.82);
    backdrop-filter: blur(12px);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 32px;
    z-index: 1200;
}

.timeline-editor-overlay.is-visible {
    display: flex;
}

.timeline-editor-dialog {
    width: min(1920px, 95vw);
    max-height: 99vh;
    background: var(--bg-card);
    border-radius: 28px;
    border: 1px solid rgba(255, 248, 235, 0.12);
    box-shadow: 0 40px 140px -60px rgba(8, 10, 26, 0.9);
    padding: clamp(24px, 4vw, 36px);
    display: flex;
    flex-direction: column;
    gap: 22px;
}

.timeline-editor-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 24px;
    flex-wrap: wrap;
}

.timeline-editor-heading {
    flex: 1 1 320px;
}

.timeline-editor-header-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    flex-wrap: wrap;
}

.timeline-editor-body {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.timeline-editor-hero.hero {
    max-width: none;
}

.timeline-editor-hero-highlights {
    margin-top: 4px;
}

.timeline-editor-hero-highlights .tag {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 12px;
    letter-spacing: 0.08em;
    min-width: 140px;
}

.timeline-editor-hero-highlights strong {
    font-size: 18px;
    color: var(--text-primary);
    letter-spacing: normal;
}

.timeline-editor-workspace {
    display: flex;
    flex-direction: column;
    gap: 28px;
}

.timeline-editor-workspace-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}

.timeline-editor-workspace-header h2 {
    margin: 0;
}

.timeline-editor-workspace-header span {
    color: var(--text-secondary);
    font-size: 14px;
}

.timeline-editor-grid {
    display: grid;
    grid-template-columns: minmax(260px, 340px) minmax(780px, 1fr);
    gap: 24px;
    height: 100%;
}

@media (max-width: 1024px) {
    .timeline-editor-grid {
        grid-template-columns: 1fr;
        overflow-y: auto;
        max-height: inherit;
    }
}

@media (min-width: 1025px) {
    .timeline-editor-preview-card {
        margin-top: -22px;
    }

    .timeline-editor-selected-clip {
        margin-top: -142px;
    }
}

.timeline-editor-pane {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    max-height: calc(100vh - 320px);
}

.timeline-editor-clip-reel {
    border: 4px solid rgba(198, 168, 124, 0.9);
    border-radius: 24px;
    padding: 24px;
    background: rgba(8, 14, 32, 0.9);
    box-shadow: 0 0 36px rgba(198, 168, 124, 0.45), inset 0 0 12px rgba(198, 168, 124, 0.2);
    transition: box-shadow 0.3s ease, border-color 0.3s ease;
    display: flex;
    flex-direction: column;
    min-height: 760px;
}

.timeline-editor-clip-reel:hover,
.timeline-editor-clip-reel:focus-within {
    border-color: rgba(131, 163, 255, 1);
    box-shadow: 0 0 48px rgba(124, 160, 255, 0.7), inset 0 0 18px rgba(124, 160, 255, 0.25);
}

.timeline-editor-clip-reel .timeline-editor-list {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding-right: 6px;
    scrollbar-gutter: stable;
}

@media (max-width: 1024px) {
    .timeline-editor-clip-reel {
        min-height: auto;
    }

    .timeline-editor-pane {
        max-height: none;
        overflow: visible;
    }
}

.timeline-editor-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.timeline-editor-row {
    border: 1px solid rgba(255, 248, 235, 0.12);
    border-radius: 18px;
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: rgba(8, 14, 32, 0.7);
    cursor: grab;
    transition: border-color 0.2s ease, background 0.2s ease, transform 0.18s ease;
    align-items: stretch;
}

.timeline-editor-row:active {
    cursor: grabbing;
}

.timeline-editor-row.is-active {
    border-color: rgba(198, 168, 124, 0.8);
    background: rgba(15, 22, 48, 0.85);
    transform: translateX(4px);
}

.timeline-editor-row.is-dragging {
    opacity: 0.7;
    border-color: var(--accent);
    box-shadow: 0 18px 48px -26px rgba(198, 168, 124, 0.9);
}

.timeline-editor-row-thumb {
    width: 100%;
    aspect-ratio: 16 / 9;
    border-radius: 12px;
    overflow: hidden;
    flex-shrink: 0;
    background: rgba(255, 248, 235, 0.04);
    display: flex;
    align-items: center;
    justify-content: center;
    order: 2;
}

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

.timeline-editor-row-thumb span {
    font-size: 11px;
    text-align: center;
    padding: 6px;
    color: var(--text-secondary);
}

.timeline-editor-row-body {
    flex: 0 0 auto;
    display: flex;
    flex-direction: column;
    gap: 4px;
    order: 1;
}

.timeline-editor-row-title {
    font-size: 14px;
    font-weight: 600;
    margin: 0;
}

.timeline-editor-row-meta {
    font-size: 11px;
    color: var(--text-secondary);
    display: flex;
    flex-wrap: wrap;
    gap: 4px 10px;
}

.timeline-editor-row-duration {
    font-size: 11px;
    color: var(--text-muted);
}

.timeline-editor-row-actions {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
    justify-content: flex-start;
    flex-shrink: 0;
    order: 3;
}

.timeline-editor-row-button {
    background: rgba(255, 248, 235, 0.04);
    border: 1px solid rgba(255, 248, 235, 0.2);
    border-radius: 999px;
    padding: 4px 12px;
    font-size: 11px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    transition: border-color 0.2s ease, color 0.2s ease, background 0.2s ease;
    cursor: pointer;
}

.timeline-editor-row-button:hover,
.timeline-editor-row-button:focus-visible {
    border-color: rgba(131, 163, 255, 0.8);
    color: var(--text-primary);
    background: rgba(198, 168, 124, 0.12);
}

.timeline-editor-row-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.timeline-editor-row-button.is-danger {
    border-color: rgba(255, 123, 123, 0.5);
    color: #ffbdbd;
}

.timeline-editor-row-button.is-danger:hover,
.timeline-editor-row-button.is-danger:focus-visible {
    border-color: rgba(255, 165, 165, 0.8);
    background: rgba(255, 126, 126, 0.16);
    color: #ffe0e0;
}

.timeline-editor-section {
    background: rgba(8, 10, 26, 0.9);
    border-radius: 22px;
    border: 1px solid rgba(255, 248, 235, 0.08);
    padding: 18px;
    display: flex;
    flex-direction: column;
    gap: 18px;
    min-height: 0;
    box-shadow: 0 20px 50px -40px rgba(8, 10, 26, 0.9);
}

.timeline-editor-adjustments-grid {
    display: grid;
    grid-template-columns: minmax(240px, 320px) minmax(360px, 1fr);
    gap: 18px;
    align-items: stretch;
}

@media (max-width: 1100px) {
    .timeline-editor-adjustments-grid {
        grid-template-columns: 1fr;
    }
}

.timeline-editor-transition-card {
    gap: 16px;
}

/* Desktop transition panel (Creator Studio) */
.cs-transition-panel {
    display: flex;
    flex-direction: column;
    gap: 18px;
    padding: 4px;
}

.cs-transition-panel .timeline-editor-transition-header {
    margin-bottom: 0;
}

.cs-transition-panel .timeline-editor-transition-header h4 {
    margin: 4px 0 0;
    font-size: 14px;
}

.cs-transition-toggle-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.cs-transition-toggle-label {
    font-size: 13px;
    color: var(--text-secondary);
}

.cs-transition-toggle-btn {
    border: 1px solid rgba(255, 248, 235, 0.15);
    border-radius: 999px;
    background: transparent;
    color: var(--text-muted);
    padding: 6px 18px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.cs-transition-toggle-btn.is-active {
    background: rgba(198, 168, 124, 0.15);
    color: var(--accent);
    border-color: rgba(198, 168, 124, 0.5);
}

.cs-transition-toggle-btn:disabled {
    opacity: 0.4;
    cursor: default;
}

.cs-transition-direction {
    display: flex;
    gap: 8px;
}

.cs-transition-direction-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 12px;
    background: rgba(255, 248, 235, 0.04);
    border: 1px solid rgba(255, 248, 235, 0.12);
    border-radius: 10px;
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.cs-transition-direction-btn.is-active {
    background: rgba(198, 168, 124, 0.12);
    border-color: rgba(198, 168, 124, 0.45);
    color: var(--text-primary);
}

.cs-transition-direction-btn:disabled {
    opacity: 0.4;
    cursor: default;
}

.cs-transition-direction-btn:hover:not(:disabled):not(.is-active) {
    background: rgba(255, 248, 235, 0.06);
    border-color: rgba(255, 248, 235, 0.2);
}

.cs-transition-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

.cs-transition-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 16px 10px 12px;
    border-radius: 12px;
    border: 1px solid rgba(255, 248, 235, 0.08);
    background: rgba(255, 248, 235, 0.03);
    color: var(--text-secondary);
    cursor: pointer;
    transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
    text-align: center;
}

.cs-transition-card:hover:not(:disabled):not(.is-active) {
    background: rgba(255, 248, 235, 0.06);
    border-color: rgba(255, 248, 235, 0.18);
}

.cs-transition-card.is-active {
    background: rgba(198, 168, 124, 0.12);
    border-color: rgba(198, 168, 124, 0.45);
    color: var(--text-primary);
    box-shadow: 0 4px 16px rgba(198, 168, 124, 0.15);
}

.cs-transition-card:disabled {
    opacity: 0.4;
    cursor: default;
}

.cs-transition-card-icon {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cs-transition-card-icon svg {
    width: 100%;
    height: 100%;
}

.cs-transition-card-name {
    font-size: 13px;
    font-weight: 600;
    line-height: 1.2;
}

.cs-transition-card-desc {
    font-size: 11px;
    color: var(--text-muted);
    line-height: 1.2;
}

.cs-transition-card.is-active .cs-transition-card-desc {
    color: var(--text-secondary);
}

.cs-transition-duration {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.cs-transition-duration-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.cs-transition-duration-header label {
    font-size: 13px;
    font-weight: 600;
}

.cs-transition-duration-value {
    font-size: 13px;
    color: var(--accent);
}

.cs-transition-duration input[type="range"] {
    width: 100%;
    accent-color: var(--accent);
}

/* ── Audio panel ── */
.cs-audio-panel {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 4px 0;
}

.cs-audio-panel > header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 4px;
}

.cs-audio-panel > header .button {
    padding: 8px 16px;
    font-size: 13px;
    border-radius: 12px;
    white-space: nowrap;
}

.cs-audio-volume-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.cs-audio-volume-header label {
    font-size: 13px;
    font-weight: 600;
}

.cs-audio-volume-value {
    font-size: 13px;
    color: var(--accent);
    min-width: 36px;
    text-align: right;
}

.cs-audio-volume-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.cs-audio-volume-row input[type="range"] {
    flex: 1;
    accent-color: var(--accent);
}

.cs-audio-icon-quiet,
.cs-audio-icon-loud {
    flex-shrink: 0;
    color: var(--text-muted);
}

.cs-audio-mute-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.cs-audio-mute-row label {
    font-size: 13px;
    font-weight: 600;
}

.cs-audio-mute-btn {
    border: 1px solid rgba(168, 130, 255, 0.5);
    border-radius: 999px;
    background: transparent;
    color: var(--text-secondary);
    padding: 6px 18px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, color 0.2s, border-color 0.2s;
}

.cs-audio-mute-btn.is-active {
    background: rgba(168, 130, 255, 0.18);
    color: #dfc8ff;
    border-color: var(--accent);
}

.cs-audio-mute-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.timeline-editor-transition-header h4 {
    margin: 4px 0;
}

.timeline-editor-transition-header p {
    margin: 0;
    color: var(--text-secondary);
}

.timeline-editor-transition-field {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.timeline-editor-transition-field label {
    font-size: 13px;
    color: var(--text-secondary);
}

.timeline-editor-transition-direction {
    display: inline-flex;
    gap: 10px;
}

.timeline-editor-direction-button {
    border: 1px solid rgba(102, 255, 210, 0.6);
    border-radius: 999px;
    background: transparent;
    color: var(--text-secondary);
    padding: 8px 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.timeline-editor-direction-button.is-active {
    background: rgba(102, 255, 210, 0.15);
    color: #c9fff0;
    border-color: rgba(102, 255, 210, 0.95);
    box-shadow: 0 8px 20px rgba(102, 255, 210, 0.25);
}

.timeline-editor-direction-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.timeline-editor-transition-slider {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.timeline-editor-transition-slider-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.timeline-editor-transition-slider-header label {
    font-weight: 600;
}

.timeline-editor-transition-slider input[type="range"] {
    width: 100%;
    accent-color: rgba(102, 255, 210, 1);
}

.timeline-editor-adjustments {
    gap: 12px;
}

.timeline-editor-adjustments-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}

.timeline-editor-mode-toggle {
    display: inline-flex;
    background: rgba(255, 248, 235, 0.06);
    border-radius: 999px;
    padding: 6px;
    gap: 6px;
}

.timeline-editor-mode-button {
    border: none;
    background: transparent;
    color: var(--text-secondary);
    padding: 8px 16px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
}

.timeline-editor-mode-button:focus-visible {
    outline: 2px solid rgba(166, 124, 82, 0.8);
    outline-offset: 2px;
}

.timeline-editor-mode-button.is-active {
    background: linear-gradient(90deg, var(--accent), #a67c52);
    color: #050a1f;
    box-shadow: 0 6px 18px rgba(166, 124, 82, 0.35);
}

.timeline-editor-mode-panel {
    display: none;
}

.timeline-editor-mode-panel.is-active {
    display: block;
}

.timeline-editor-mode-panel h5 {
    margin: 0;
    font-size: 14px;
}

.timeline-editor-mode-panel header p {
    margin: 4px 0 0;
}

.timeline-editor-preview-card {
    background: rgba(8, 10, 26, 0.9);
    border-radius: 22px;
    border: 1px solid rgba(255, 248, 235, 0.08);
    padding: 18px;
    display: flex;
    flex-direction: column;
    gap: 18px;
    min-height: 0;
}

.timeline-editor-selected-clip {
    border: 2px solid rgba(102, 255, 210, 0.85);
    box-shadow: 0 0 24px rgba(102, 255, 210, 0.35), inset 0 0 10px rgba(102, 255, 210, 0.18);
    transition: box-shadow 0.3s ease, border-color 0.3s ease;
    max-height: calc(100vh - 180px);
    overflow-y: auto;
    padding-right: 12px;
    scrollbar-gutter: stable;
    margin-top: -100px;
}

.timeline-editor-selected-clip:hover,
.timeline-editor-selected-clip:focus-within {
    border-color: rgba(140, 255, 224, 1);
    box-shadow: 0 0 38px rgba(140, 255, 224, 0.6), inset 0 0 16px rgba(140, 255, 224, 0.25);
}

.timeline-editor-preview-card .timeline-editor-helper {
    margin: 0;
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.5;
}


.timeline-editor-preview-video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.timeline-editor-preview-empty {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: 6px;
    color: var(--text-secondary);
    pointer-events: none;
}


.timeline-editor-preview-meta {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.selected-clip-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    flex-wrap: wrap;
}

.selected-clip-player {
    position: relative;
    border-radius: 16px;
    border: 1px solid rgba(255, 248, 235, 0.08);
    overflow: hidden;
    aspect-ratio: 16 / 9;
    background: rgba(5, 8, 20, 0.65);
    --trim-start-percent: 0%;
    --trim-end-percent: 100%;
}

.selected-clip-player.is-portrait {
    aspect-ratio: 9 / 16;
    max-height: 900px;
    width: auto;
    margin: 0 auto;
}

.selected-clip-player.is-square {
    aspect-ratio: 1 / 1;
}

.timeline-editor-selected-clip .selected-clip-player {
    width: 70%;
    margin: 0 auto;
}

.timeline-editor-selected-clip .selected-clip-player.is-portrait {
    width: auto;
    max-height: 840px;
    aspect-ratio: 9 / 16;
}

@media (max-width: 768px) {
    .timeline-editor-selected-clip .selected-clip-player {
        width: 100%;
    }
}

@media (max-width: 1024px) {
    .timeline-editor-selected-clip {
        max-height: none;
        overflow: visible;
        padding-right: 18px;
        margin-top: 0;
    }
}

.selected-clip-player::after {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    left: var(--trim-start-percent);
    right: calc(100% - var(--trim-end-percent));
    background: rgba(5, 8, 20, 0.18);
    pointer-events: none;
    transition: opacity 0.2s ease;
    opacity: 0;
}

.selected-clip-player.has-clip.has-trim-delta::after {
    opacity: 1;
}

.selected-clip-video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.selected-clip-placeholder {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 18px;
    font-size: 14px;
    color: var(--text-secondary);
    background: rgba(5, 8, 20, 0.55);
}

.selected-clip-player.has-clip .selected-clip-placeholder {
    display: none;
}

.timeline-editor-transition-visual,
.preview-transition-visual {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 2;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: flex-end;
    gap: 10px;
    padding: 16px;
    opacity: 0;
    transition: opacity 0.2s ease;
    background: linear-gradient(180deg, rgba(5, 8, 20, 0.3), rgba(5, 8, 20, 0));
    --transition-progress: 0;
    --transition-label-bg: rgba(5, 8, 20, 0.82);
    --transition-bar-color: linear-gradient(90deg, var(--accent), #a67c52);
}

.timeline-editor-transition-visual[data-transition-active="true"],
.preview-transition-visual[data-transition-active="true"] {
    opacity: 1;
}

.timeline-editor-transition-visual::before,
.preview-transition-visual::before {
    content: '';
    width: 150px;
    max-width: 65%;
    height: 4px;
    border-radius: 999px;
    background: var(--transition-bar-color);
    transform-origin: left center;
    transform: scaleX(var(--transition-progress));
    box-shadow: 0 6px 16px rgba(12, 7, 37, 0.35);
}

.timeline-editor-transition-visual::after,
.preview-transition-visual::after {
    content: attr(data-transition-label);
    font-size: 11px;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    font-weight: 600;
    padding: 6px 14px;
    border-radius: 999px;
    border: 1px solid rgba(255, 248, 235, 0.25);
    background: var(--transition-label-bg);
    color: #fff;
    box-shadow: 0 10px 28px rgba(5, 8, 20, 0.45);
    text-align: center;
}

.timeline-editor-transition-visual[data-transition-direction="out"],
.preview-transition-visual[data-transition-direction="out"] {
    align-items: flex-start;
}

.timeline-editor-transition-visual[data-transition-direction="out"]::before,
.preview-transition-visual[data-transition-direction="out"]::before {
    transform-origin: right center;
}

.timeline-editor-transition-visual[data-transition-type="cut"],
.preview-transition-visual[data-transition-type="cut"] {
    --transition-bar-color: linear-gradient(90deg, #f87171, #f43f5e);
    --transition-label-bg: rgba(148, 24, 49, 0.78);
}

.timeline-editor-transition-visual[data-transition-type="slide"],
.preview-transition-visual[data-transition-type="slide"] {
    --transition-bar-color: linear-gradient(90deg, #38bdf8, #818cf8);
    --transition-label-bg: rgba(9, 20, 58, 0.78);
}

.timeline-editor-transition-visual[data-transition-type="wipe"],
.preview-transition-visual[data-transition-type="wipe"] {
    --transition-bar-color: linear-gradient(90deg, #facc15, #fb923c);
    --transition-label-bg: rgba(77, 42, 4, 0.82);
}

.timeline-editor-preview-meta h3 {
    margin: 4px 0 0;
}

.timeline-editor-trim-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.timeline-editor-trim-times {
    display: flex;
    gap: 18px;
    font-size: 13px;
    color: var(--text-secondary);
}

.timeline-editor-trim-track {
    position: relative;
    height: 42px;
    margin-top: 12px;
}

.trim-track-bg {
    position: absolute;
    inset: 18px 0 18px;
    border-radius: 999px;
    background: rgba(255, 248, 235, 0.08);
}

.trim-track-active {
    position: absolute;
    inset: 18px 0 18px;
    border-radius: 999px;
    background: linear-gradient(90deg, var(--accent), #a67c52);
}

.timeline-editor-trim-track input[type="range"] {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    appearance: none;
    -webkit-appearance: none;
    background: none;
    pointer-events: none;
}

.timeline-editor-transition-preview {
    position: absolute;
    top: 16px;
    left: 16px;
    background: rgba(5, 8, 20, 0.8);
    border: 1px solid rgba(255, 248, 235, 0.2);
    border-radius: 999px;
    padding: 6px 14px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: 0.02em;
    text-transform: none;
    box-shadow: 0 10px 28px rgba(5, 8, 20, 0.45);
    pointer-events: none;
    display: inline-flex;
    gap: 6px;
    align-items: center;
    z-index: 3;
}

.timeline-editor-trim-track input[type="range"]::-webkit-slider-thumb {
    appearance: none;
    -webkit-appearance: none;
    width: 6px;
    height: 28px;
    border-radius: 3px;
    background: #fff;
    border: none;
    pointer-events: auto;
    box-shadow: 0 2px 8px rgba(9, 15, 36, 0.5);
    cursor: ew-resize;
}

.timeline-editor-trim-track input[type="range"]::-moz-range-thumb {
    width: 6px;
    height: 28px;
    border-radius: 3px;
    background: #fff;
    border: none;
    pointer-events: auto;
    box-shadow: 0 2px 8px rgba(9, 15, 36, 0.5);
    cursor: ew-resize;
}

.timeline-editor-trim-track input[type="range"]::-webkit-slider-runnable-track,
.timeline-editor-trim-track input[type="range"]::-moz-range-track {
    background: transparent;
}

.timeline-editor-crop {
    border-radius: 18px;
    border: 1px solid rgba(255, 248, 235, 0.08);
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.timeline-editor-crop header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.timeline-editor-crop-controls {
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-height: 80px;
    justify-content: center;
}

.timeline-editor-filters {
    border-radius: 18px;
    border: 1px solid rgba(255, 248, 235, 0.08);
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.timeline-editor-filters header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.timeline-editor-filters-controls {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
}

.timeline-editor-filter-button {
    border-radius: 16px;
    border: 1px solid rgba(255, 248, 235, 0.14);
    background: rgba(15, 19, 32, 0.75);
    padding: 16px;
    text-align: left;
    display: flex;
    flex-direction: column;
    gap: 6px;
    cursor: pointer;
    transition: border 0.2s ease, box-shadow 0.2s ease, background 0.2s ease, transform 0.2s ease;
    font-size: 14px;
    color: var(--text-primary);
}

.timeline-editor-filter-title {
    font-size: 12px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-secondary);
}

.timeline-editor-filter-button small {
    font-size: 12px;
    color: var(--text-secondary);
}

.timeline-editor-filter-button.is-active {
    border-color: rgba(198, 168, 124, 0.9);
    box-shadow: 0 10px 24px -14px rgba(198, 168, 124, 0.9);
    background: rgba(198, 168, 124, 0.16);
    transform: translateY(-2px);
}

.timeline-editor-filter-description {
    font-size: 13px;
    color: var(--text-muted);
    min-height: 18px;
}

/* Adjust Panel Styles */
.timeline-editor-adjust {
    border-radius: 18px;
    border: 1px solid rgba(255, 248, 235, 0.08);
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.timeline-editor-adjust header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.timeline-editor-adjust-controls {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.timeline-editor-adjust-controls label {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.timeline-editor-adjust-controls label > span {
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 500;
}

.timeline-editor-adjust-controls label > small {
    font-size: 12px;
    color: var(--text-muted);
    min-width: 40px;
    text-align: right;
}

.timeline-editor-adjust-controls label > input[type="range"] {
    flex: 1;
}

/* Text Panel Styles */
.timeline-editor-text {
    border-radius: 18px;
    border: 1px solid rgba(255, 248, 235, 0.08);
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.timeline-editor-text header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.timeline-editor-text-controls {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.timeline-editor-text-input-row {
    display: flex;
    flex-direction: column;
    gap: 7px;
}

.timeline-editor-text-input-row label {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 0;
}

.timeline-editor-text-input-row input[type="text"] {
    width: 100%;
    box-sizing: border-box;
}

.timeline-editor-text-input-row .button {
    align-self: flex-start;
    flex-shrink: 0;
}

.timeline-editor-text-style-row,
.timeline-editor-text-color-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 12px;
}

.timeline-editor-text-style-row label,
.timeline-editor-text-color-row label {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.timeline-editor-text-style-row label > span,
.timeline-editor-text-color-row label > span {
    font-size: 12px;
    color: var(--text-secondary);
}

.timeline-editor-text-style-row label > small,
.timeline-editor-text-color-row label > small {
    font-size: 11px;
    color: var(--text-muted);
}

.timeline-editor-text-color-row input[type="color"] {
    width: 100%;
    height: 36px;
    border: 1px solid rgba(255, 248, 235, 0.12);
    border-radius: 8px;
    background: rgba(15, 19, 32, 0.75);
    cursor: pointer;
    padding: 2px;
}

.timeline-editor-text-position-row label > span {
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 8px;
    display: block;
}

.timeline-editor-text-position-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 4px;
    max-width: 140px;
}

.text-position-btn {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    border: 1px solid rgba(255, 248, 235, 0.12);
    background: rgba(15, 19, 32, 0.75);
    color: var(--text-secondary);
    font-size: 16px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.text-position-btn:hover:not(:disabled) {
    border-color: rgba(255, 248, 235, 0.24);
    background: rgba(30, 35, 55, 0.9);
}

.text-position-btn.is-active {
    border-color: rgba(198, 168, 124, 0.9);
    background: rgba(198, 168, 124, 0.2);
    color: var(--accent-primary);
}

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

.timeline-editor-text-divider {
    border: none;
    border-top: 1px solid rgba(255, 248, 235, 0.08);
    margin: 0;
}

.timeline-editor-text-layers {
    border-top: 1px solid rgba(255, 248, 235, 0.08);
    padding-top: 12px;
}

.timeline-editor-text-layers > .eyebrow {
    display: block;
    margin-bottom: 8px;
}

.timeline-editor-text-layers-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 150px;
    overflow-y: auto;
}

.timeline-editor-text-empty {
    font-size: 13px;
    color: var(--text-muted);
    font-style: italic;
}

.text-layer-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    border-radius: 8px;
    border: 1px solid rgba(255, 248, 235, 0.08);
    background: rgba(15, 19, 32, 0.5);
    cursor: pointer;
    transition: all 0.2s ease;
}

.text-layer-item:hover {
    border-color: rgba(255, 248, 235, 0.16);
    background: rgba(30, 35, 55, 0.7);
}

.text-layer-item.is-selected {
    border-color: rgba(198, 168, 124, 0.6);
    background: rgba(198, 168, 124, 0.1);
}

.text-layer-preview {
    font-size: 13px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 180px;
}

.text-layer-actions {
    display: flex;
    gap: 4px;
}

.text-layer-select-btn,
.text-layer-delete-btn {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.text-layer-select-btn:hover {
    background: rgba(198, 168, 124, 0.2);
    color: var(--accent-primary);
}

.text-layer-delete-btn:hover {
    background: rgba(255, 100, 100, 0.2);
    color: #ff6464;
}

/* Video Text Overlay Container */
.video-text-overlay-container {
    z-index: 10;
}

.video-text-overlay {
    transition: border-color 0.2s ease;
}

.video-text-overlay:hover {
    border-color: rgba(198, 168, 124, 0.5) !important;
}

@media (min-width: 1200px) {
    .studio-hero {
        grid-row: 1 / span 2;
    }

    .studio-render-panel {
        grid-column: 2 / 4;
        grid-row: 1;
        align-self: stretch;
    }

    .studio-timeline-panel {
        grid-column: 2;
        grid-row: 2;
        align-self: stretch;
    }

    .studio-preview-panel {
        grid-column: 3;
        grid-row: 2;
        align-self: stretch;
    }

    .studio-layout--no-render .studio-hero {
        grid-row: 1;
    }

    .studio-layout--no-render .studio-timeline-panel {
        grid-row: 1;
    }

    .studio-layout--no-render .studio-preview-panel {
        grid-row: 1;
    }
}

.studio-panel-header {
    width: 100%;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
    flex-wrap: wrap;
}
.segment-primary-look {
    grid-column: span 2;
}

@media (max-width: 900px) {
    .segment-primary-look {
        grid-column: span 1;
    }
}

.segment-primary-look .look-attributes {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px 18px;
}

@media (max-width: 900px) {
    .segment-primary-look .look-attributes {
        grid-template-columns: 1fr;
    }
}

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

.studio-panel-actions .ghost-button,
.studio-panel-actions .button {
    white-space: nowrap;
}

.studio-panel-actions .button {
    border-radius: 999px;
    padding: 10px 18px;
    font-size: 14px;
    letter-spacing: 0.02em;
}

.studio-selected-preset {
    font-size: 14px;
    font-weight: 600;
    color: var(--accent);
}

.timeline-controls {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 20px;
    flex-wrap: wrap;
}

.timeline-field {
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-width: 240px;
}

.timeline-field label {
    font-size: 13px;
    letter-spacing: 0.08em;
    text-transform: none;
    color: var(--text-muted);
}

.control.control-compact {
    height: auto;
    padding: 14px 16px;
    border-radius: 14px;
    font-size: 14px;
}

.timeline-selection {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 200px;
}

.timeline-selection-label {
    font-size: 12px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.timeline-selection-value {
    font-size: 16px;
    font-weight: 500;
    color: var(--text-primary);
}

.studio-preview-panel {
    gap: 22px;
    border: 1px solid #4ade80;
}

.studio-preview-stage {
    position: relative;
    display: grid;
    place-items: center;
    width: 100%;
    aspect-ratio: 16 / 9;
    border-radius: 22px;
    border: 1px solid rgba(255, 248, 235, 0.08);
    background: linear-gradient(160deg, rgba(18, 26, 46, 0.92), rgba(10, 16, 30, 0.82));
    overflow: hidden;
    box-shadow: inset 0 0 0 1px rgba(255, 248, 235, 0.02);
}

.studio-preview-stage img,
.studio-preview-stage video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    background: rgba(0, 0, 0, 0.6);
}

.studio-preview-stage.is-portrait {
    aspect-ratio: 9 / 16;
}

.studio-preview-stage.is-square {
    aspect-ratio: 1 / 1;
}

.preview-play-button {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: inline-flex;
    align-items: center;
    gap: 12px;
    padding: 16px 24px;
    border-radius: 999px;
    border: 1px solid rgba(198, 168, 124, 0.38);
    background: rgba(10, 16, 32, 0.82);
    color: var(--text-primary);
    font-size: 15px;
    font-weight: 600;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    cursor: pointer;
    box-shadow: 0 24px 48px -28px rgba(10, 12, 28, 0.9);
    transition: opacity 0.24s ease, transform 0.2s ease, background 0.2s ease, border 0.2s ease, box-shadow 0.2s ease;
    z-index: 3;
    backdrop-filter: blur(8px);
    opacity: 0;
    pointer-events: none;
    visibility: hidden;
}

.preview-play-button.is-visible {
    opacity: 1;
    pointer-events: auto;
    visibility: visible;
}

.preview-play-button.is-fading-out {
    visibility: visible;
    pointer-events: none;
    opacity: 0;
}

.preview-play-button:hover {
    transform: translate(-50%, -50%) scale(1.04);
    background: rgba(16, 24, 46, 0.9);
    border-color: rgba(198, 168, 124, 0.6);
    box-shadow: 0 28px 60px -26px rgba(20, 32, 68, 0.92);
}

.preview-play-button:disabled {
    cursor: wait;
    opacity: 0.72;
}

.preview-play-button:focus-visible {
    outline: 2px solid rgba(198, 168, 124, 0.85);
    outline-offset: 4px;
}

.preview-play-button.is-fading-out:focus-visible {
    outline: none;
}

.preview-play-icon {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: linear-gradient(135deg, rgba(198, 168, 124, 0.42), rgba(166, 124, 82, 0.28));
    display: inline-flex;
    align-items: center;
    justify-content: center;
    position: relative;
    color: var(--text-primary);
}

.preview-play-icon::before {
    content: '';
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 9px 0 9px 15px;
    border-color: transparent transparent transparent currentColor;
    margin-left: 4px;
}

.preview-play-label {
    letter-spacing: 0.24em;
}

.studio-preview-fallback {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 26px;
    text-align: center;
    color: var(--text-muted);
}

[data-preview-overlay] {
    transition: opacity 0.3s ease;
}

[data-preview-overlay].is-muted {
    opacity: 0;
    pointer-events: none;
}

.studio-preview-fallback svg {
    opacity: 0.7;
}

.studio-preview-fallback p {
    margin: 0;
    font-size: 14px;
    line-height: 1.6;
}

.studio-preview-error {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    padding: 18px;
    text-align: center;
    gap: 8px;
    color: var(--warning-200, #ffde9b);
    background: rgba(12, 18, 36, 0.82);
    backdrop-filter: blur(4px);
    font-size: 14px;
    line-height: 1.6;
    pointer-events: none;
}

.studio-preview-meta {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.studio-preview-meta h3 {
    margin: 0;
    font-size: 20px;
}

.studio-preview-meta p {
    margin: 0;
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.7;
}

.studio-preview-controls {
    margin-top: 18px;
    padding: 18px 20px;
    border-radius: 18px;
    border: 1px solid rgba(255, 248, 235, 0.05);
    background: rgba(9, 14, 28, 0.72);
    display: grid;
    gap: 18px;
}

.studio-preview-controls.is-disabled {
    opacity: 0.5;
    pointer-events: none;
}

.studio-preview-controls-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.studio-preview-controls-title {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.studio-preview-controls-heading {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
}

.studio-preview-controls-subheading {
    font-size: 13px;
    color: var(--text-secondary);
}

.studio-preview-control {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.studio-preview-control-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    font-size: 13px;
    letter-spacing: 0.02em;
    color: var(--text-secondary);
}

.studio-preview-control-header label {
    font-size: 13px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.studio-preview-control-value {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
}

.studio-preview-control input[type="range"] {
    width: 100%;
    accent-color: var(--accent-primary);
    cursor: pointer;
}

.studio-timeline {
    min-height: 220px;
    padding: 22px;
    border-radius: 20px;
    border: 1px dashed rgba(255, 248, 235, 0.16);
    background: rgba(9, 15, 30, 0.62);
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.studio-timeline-empty {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
    border-radius: 16px;
    border: 1px dashed rgba(255, 248, 235, 0.12);
    background: rgba(255, 248, 235, 0.02);
}

.studio-timeline-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 16px 20px;
    border-radius: 18px;
    background: rgba(18, 24, 44, 0.86);
    border: 1px solid rgba(255, 248, 235, 0.08);
    transition: border 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

.studio-timeline-item.is-dragging {
    opacity: 0.7;
    border-color: var(--accent);
    box-shadow: 0 18px 48px -26px rgba(198, 168, 124, 0.9);
}

.studio-timeline-item.is-active {
    border-color: rgba(198, 168, 124, 0.55);
    box-shadow: 0 18px 50px -30px rgba(198, 168, 124, 0.8);
}

.timeline-item-body {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1 1 auto;
}

.timeline-item-title {
    font-weight: 600;
    font-size: 16px;
    color: var(--text-primary);
}

.timeline-item-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    font-size: 13px;
    color: var(--text-secondary);
}

.timeline-item-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.timeline-item-actions .ghost-button {
    padding: 8px 12px;
    font-size: 12px;
}

.studio-timeline-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 14px;
}

.studio-stat {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 14px 16px;
    border-radius: 16px;
    background: rgba(255, 248, 235, 0.04);
    border: 1px solid rgba(255, 248, 235, 0.08);
}

.studio-stat-label {
    font-size: 11px;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.studio-stat-value {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
}

.studio-presets-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 18px;
}

.studio-preset-card {
    padding: 22px;
    border-radius: 20px;
    background: rgba(255, 248, 235, 0.04);
    border: 1px solid rgba(255, 248, 235, 0.08);
    cursor: pointer;
    transition: transform 0.18s ease, border 0.18s ease, box-shadow 0.18s ease;
    outline: none;
}

.studio-preset-card:hover,
.studio-preset-card:focus-visible {
    border-color: rgba(198, 168, 124, 0.4);
    transform: translateY(-2px);
}

.studio-preset-card.is-selected {
    border-color: var(--accent);
    box-shadow: 0 18px 48px -24px rgba(198, 168, 124, 0.9);
    background: rgba(198, 168, 124, 0.18);
}

.studio-preset-card header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}

.studio-preset-card h3 {
    margin: 0;
    font-size: 18px;
}

.studio-preset-card p {
    margin: 0 0 20px;
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.6;
}

.studio-preset-tag {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    color: var(--text-muted);
}

.studio-preset-actions {
    display: flex;
    align-items: center;
}

.studio-library-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: clamp(20px, 3vw, 28px);
    align-items: stretch;
}

@media (max-width: 1024px) {
    .studio-library-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}
@media (max-width: 640px) {
    .studio-library-grid {
        grid-template-columns: 1fr;
    }
}

.studio-clip-card {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 20px;
    border-radius: 22px;
    background: rgba(16, 20, 36, 0.78);
    border: 1px solid rgba(255, 248, 235, 0.08);
    transition: transform 0.18s ease, border 0.18s ease, box-shadow 0.18s ease;
    outline: none;
    height: 100%;
}

.studio-clip-card:hover {
    transform: translateY(-3px);
    border-color: rgba(198, 168, 124, 0.42);
    box-shadow: 0 24px 50px -32px rgba(198, 168, 124, 0.8);
}

.studio-clip-card:focus-visible {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(198, 168, 124, 0.35);
}

.studio-clip-media {
    position: relative;
    border-radius: 18px;
    overflow: hidden;
    background: rgba(255, 248, 235, 0.04);
    aspect-ratio: 16 / 9;
    cursor: pointer;
    transition: transform 0.15s ease;
}

.studio-clip-media:hover {
    transform: scale(1.02);
}

.studio-clip-media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.studio-clip-placeholder {
    height: 100%;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: 13px;
}

.studio-clip-body {
    display: flex;
    flex-direction: column;
    gap: 12px;
    flex: 1;
}

.studio-clip-header {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-height: 52px;
}

.studio-clip-header h3 {
    margin: 0;
    font-size: 18px;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.studio-clip-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    font-size: 12px;
    color: var(--text-muted);
    min-height: 22px;
}

.studio-clip-badge {
    padding: 4px 10px;
    border-radius: 999px;
    border: 1px solid rgba(198, 168, 124, 0.4);
    background: rgba(198, 168, 124, 0.18);
    letter-spacing: 0.14em;
    text-transform: uppercase;
    font-size: 11px;
}

.studio-clip-description {
    margin: 0;
    font-size: 14px;
    line-height: 1.6;
    color: var(--text-secondary);
    min-height: 44px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.studio-clip-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    min-height: 28px;
    align-items: flex-start;
}

.studio-clip-tags .pill {
    background: rgba(255, 248, 235, 0.08);
    border-color: rgba(255, 248, 235, 0.16);
}

.studio-clip-actions {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 12px;
    margin-top: auto;
    padding-top: 12px;
}

.studio-clip-actions .button {
    flex: 1;
}

.studio-clip-actions .ghost-link {
    padding: 8px 12px;
    background: transparent;
    border: none;
    font-size: 13px;
}

/* Play button - black background with blue border */
.studio-clip-actions [data-clip-play],
.studio-clip-actions [data-edited-play] {
    background: rgba(198, 168, 124, 0.1);
    border: 1px solid var(--accent);
    color: var(--text-primary);
    box-shadow: none;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-width: 180px;
    justify-content: center;
}

.studio-clip-actions [data-clip-play] svg,
.studio-clip-actions [data-edited-play] svg {
    flex-shrink: 0;
}

.studio-clip-actions [data-clip-play]:hover,
.studio-clip-actions [data-edited-play]:hover {
    background: rgba(198, 168, 124, 0.2);
    border-color: var(--accent);
}

/* Add to timeline button - same width as Play */
.studio-clip-actions [data-clip-add],
.studio-clip-actions [data-edited-add] {
    min-width: 180px;
}

/* Download button - black background with blue border */
.studio-clip-actions [data-clip-download],
.studio-clip-actions [data-edited-download] {
    background: #000000;
    border: 1px solid var(--accent);
    color: var(--text-primary);
    box-shadow: none;
    text-decoration: none;
}

.studio-clip-actions [data-clip-download]:hover,
.studio-clip-actions [data-edited-download]:hover {
    background: rgba(198, 168, 124, 0.15);
    border-color: var(--accent);
}

.studio-catalog-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
}

.studio-search {
    flex: 1 1 220px;
}

.studio-search .control {
    width: 100%;
}

.studio-catalog-toolbar .select-wrapper {
    position: relative;
    min-width: 180px;
    flex: 0 0 auto;
}

.studio-catalog-toolbar .select-wrapper .select-value {
    font-size: 14px;
    padding-right: 56px;
}

.studio-catalog-toolbar .select-wrapper .select-icon {
    right: 22px;
}

.catalog-toggle {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    border-radius: 12px;
    background: rgba(255, 248, 235, 0.04);
    border: 1px solid rgba(255, 248, 235, 0.08);
    font-size: 13px;
    color: var(--text-secondary);
}

.catalog-toggle input {
    accent-color: var(--accent);
}

.catalog-toggle span {
    pointer-events: none;
}

.studio-catalog-mode {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    justify-content: flex-end;
}

.studio-chip {
    border-radius: 999px;
    border: 1px solid rgba(255, 248, 235, 0.16);
    padding: 9px 18px;
    font-size: 13px;
    letter-spacing: 0.04em;
    background: rgba(16, 22, 40, 0.78);
    color: var(--text-secondary);
    cursor: pointer;
    transition: color 0.2s ease, border 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.studio-chip:not(.is-disabled):hover {
    color: var(--text-primary);
    border-color: rgba(198, 168, 124, 0.45);
    transform: translateY(-1px);
}

.studio-chip.is-active {
    color: #60a5fa;
    border-color: rgba(96, 165, 250, 0.85);
    box-shadow: 0 12px 30px -18px rgba(96, 165, 250, 0.9);
    background: linear-gradient(120deg, rgba(198, 168, 124, 0.25), rgba(12, 18, 34, 0.9));
}

.studio-chip.is-disabled {
    opacity: 0.35;
    cursor: default;
    pointer-events: none;
}

.studio-catalog-toolbar.is-disabled {
    opacity: 0.5;
    pointer-events: none;
}

.studio-catalog-panels {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.studio-catalog-panel {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.studio-catalog-panels [data-catalog-panel] {
    transition: opacity 0.2s ease;
}

.studio-catalog-panels [data-catalog-panel][hidden] {
    display: none !important;
}

.studio-catalog-panels [data-catalog-panel].is-active {
    opacity: 1;
}

.studio-edited-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 18px;
}

.studio-edited-card {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 18px;
    border-radius: 18px;
    border: 1px solid rgba(255, 248, 235, 0.08);
    background: rgba(8, 14, 30, 0.8);
    box-shadow: inset 0 0 0 1px rgba(255, 248, 235, 0.04);
}

.studio-edited-thumb {
    position: relative;
    border-radius: 16px;
    overflow: hidden;
    aspect-ratio: 16 / 9;
    background: rgba(12, 18, 32, 0.8);
    border: 1px solid rgba(255, 248, 235, 0.08);
    cursor: pointer;
    transition: border-color 0.15s ease, transform 0.15s ease;
}

.studio-edited-thumb:hover {
    border-color: rgba(255, 248, 235, 0.2);
    transform: scale(1.02);
}

.studio-edited-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.studio-edited-duration {
    position: absolute;
    bottom: 10px;
    right: 10px;
    padding: 6px 12px;
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.65);
    font-size: 12px;
    letter-spacing: 0.08em;
}

.studio-edited-body header {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.studio-edited-body h3 {
    margin: 0;
    font-size: 18px;
}

.studio-edited-pill {
    align-self: flex-start;
    padding: 4px 10px;
    border-radius: 999px;
    border: 1px solid rgba(255, 248, 235, 0.2);
    font-size: 12px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-secondary);
}

.studio-edited-body p {
    margin: 0;
    font-size: 14px;
    color: var(--text-secondary);
}

.studio-edited-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 14px;
    font-size: 12px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.studio-edited-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

.studio-edited-actions .button {
    padding: 8px 16px;
}

.studio-edited-actions .ghost-link {
    font-size: 13px;
}

.studio-catalog-empty {
    margin-top: 28px;
    text-align: center;
    padding: 26px;
    border-radius: 18px;
    border: 1px dashed rgba(255, 248, 235, 0.14);
    background: rgba(8, 13, 28, 0.52);
}

.studio-catalog-empty h3 {
    margin: 0 0 8px;
    font-size: 20px;
}

.studio-catalog-empty p {
    margin: 0 0 14px;
    color: var(--text-secondary);
    font-size: 14px;
}

.studio-toast {
    position: fixed;
    right: clamp(18px, 6vw, 48px);
    bottom: clamp(18px, 8vh, 48px);
    padding: 16px 20px;
    border-radius: 18px;
    border: 1px solid rgba(198, 168, 124, 0.4);
    background: rgba(8, 14, 28, 0.92);
    box-shadow: var(--shadow-intense);
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.2s ease, transform 0.2s ease;
    pointer-events: none;
    z-index: 30;
}

.studio-toast span {
    font-size: 14px;
    color: var(--text-primary);
}

.studio-toast.is-visible {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.studio-toast[data-variant="success"] {
    border-color: rgba(124, 184, 138, 0.45);
}

.studio-toast[data-variant="warning"] {
    border-color: rgba(255, 160, 90, 0.45);
}

.studio-toast[data-variant="neutral"] {
    border-color: rgba(255, 248, 235, 0.22);
}

.studio-toast[data-variant="info"] {
    border-color: rgba(198, 168, 124, 0.4);
}

.studio-toast[data-variant="info"] span {
    color: var(--text-primary);
}

.studio-toast[data-variant="warning"] span {
    color: #ffb469;
}

.studio-toast[data-variant="success"] span {
    color: #69f3ce;
}

.studio-toast[data-variant="neutral"] span {
    color: var(--text-secondary);
}

.login-page::before {
    display: none;
}

body.login-page {
    background: rgba(15, 13, 11, 0.9);
}

.login-shell {
    min-height: 100vh;
}

.login-layout {
    display: grid;
    grid-template-columns: minmax(320px, 520px) minmax(340px, 520px);
    gap: clamp(32px, 6vw, 72px);
    align-items: stretch;
    justify-content: center;
    margin: 20px auto 0;
    padding: 0 24px;
    width: min(1120px, 100%);
}

@media (max-width: 960px) {
    .login-layout {
        grid-template-columns: 1fr;
    }
}

body.login-page {
    font-family: 'DM Sans', 'Inter', 'Manrope', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-feature-settings: 'ss03' 1, 'cv02' 1, 'cv11' 1;
    letter-spacing: 0.01em;
}

.login-page h1,
.login-page h2,
.login-page .login-card header h2,
.login-page .pill,
.login-page .button,
.login-page .ghost-button,
.login-page .eyebrow {
    font-family: 'Space Grotesk', 'DM Sans', 'Inter', system-ui, sans-serif;
    letter-spacing: -0.01em;
}

.login-page .login-card p,
.login-page label,
.login-page input,
.login-page .login-sso-label,
.login-page .sso-text,
.login-page .remember span,
.login-page .login-footer,
.login-page .login-row,
.login-page .login-alert {
    font-family: 'DM Sans', 'Inter', 'Manrope', system-ui, sans-serif;
    letter-spacing: 0.01em;
}

.login-hero {
    display: flex;
    flex-direction: column;
    gap: 28px;
}

.login-hero-intro {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

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

.login-logo img {
    width: clamp(360px, 52vw, 520px);
    height: auto;
    display: block;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-soft);
}

.login-hero p {
    font-size: 16px;
    line-height: 1.8;
    color: var(--text-secondary);
    margin: 0;
}

.login-hero-features {
    margin: 0;
    padding: 0;
    list-style: none;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
}

.login-hero-features li {
    border-radius: 16px;
    padding: 16px;
    background: rgba(12, 18, 40, 0.55);
    border: 1px solid rgba(255, 248, 235, 0.08);
    box-shadow: inset 0 0 0 1px rgba(255, 248, 235, 0.04);
}

.login-hero-features strong {
    display: block;
    font-size: 15px;
    margin-bottom: 6px;
}

.login-hero-features span {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.5;
}

/* ── Login hero capability grid ── */
.login-hero-capabilities {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 8px;
}

.capability-group {
    border-radius: 14px;
    padding: 10px 14px;
    background: rgba(10, 14, 32, 0.6);
    border: 1px solid rgba(255, 248, 235, 0.07);
    transition: border-color 0.25s ease, background 0.25s ease;
}

.capability-group:hover {
    border-color: rgba(198, 168, 124, 0.35);
    background: rgba(14, 20, 44, 0.7);
}

.capability-heading {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 600;
    margin: 0 0 6px;
    color: var(--text-primary);
    font-family: 'Space Grotesk', 'DM Sans', 'Inter', system-ui, sans-serif;
    letter-spacing: -0.01em;
}

.capability-heading svg {
    flex-shrink: 0;
    color: var(--accent);
    opacity: 0.85;
}

.capability-group p {
    margin: 0;
    font-size: 12px;
    line-height: 1.45;
    color: var(--text-muted);
}

@media (max-width: 960px) {
    .login-hero-capabilities {
        grid-template-columns: 1fr;
    }
}

.login-hero-card {
    position: relative;
    border-radius: 24px;
    padding: 24px;
    background: radial-gradient(circle at 20% 20%, rgba(198, 168, 124, 0.35), transparent 60%),
                radial-gradient(circle at 80% 0%, rgba(124, 184, 138, 0.35), transparent 55%),
                rgba(8, 12, 28, 0.8);
    border: 1px solid rgba(255, 248, 235, 0.12);
    display: flex;
    flex-direction: column;
    gap: 22px;
    box-shadow: 0 30px 80px -50px rgba(6, 10, 36, 0.9);
}

.login-hero-card::after {
    content: "";
    position: absolute;
    inset: 16px;
    border-radius: 22px;
    pointer-events: none;
    border: 1px solid rgba(255, 248, 235, 0.08);
    opacity: 0.4;
}

.login-hero-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
}

.login-hero-card-header p {
    text-transform: uppercase;
    font-size: 12px;
    letter-spacing: 0.2em;
    margin: 0;
    color: var(--text-secondary);
}

.login-hero-card-header strong {
    display: block;
    font-size: 20px;
}

.status-pill {
    padding: 6px 14px;
    border-radius: 999px;
    background: rgba(105, 243, 206, 0.2);
    color: #69f3ce;
    font-size: 13px;
    border: 1px solid rgba(105, 243, 206, 0.5);
}

.login-hero-stats {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
}

.login-hero-stats span {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.2em;
    color: var(--text-secondary);
}

.login-hero-stats strong {
    display: block;
    font-size: 26px;
}

.login-hero-preview {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.login-hero-preview-track {
    display: grid;
    gap: 10px;
}

.preview-step {
    border-radius: 16px;
    padding: 14px;
    background: rgba(6, 8, 20, 0.6);
    border: 1px solid rgba(255, 248, 235, 0.08);
}

.preview-step.is-active {
    border-color: rgba(198, 168, 124, 0.8);
    box-shadow: 0 10px 30px -20px rgba(198, 168, 124, 0.9);
}

.preview-step span {
    display: block;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.2em;
    color: var(--text-secondary);
}

.preview-step strong {
    font-size: 15px;
}

.login-hero-avatars {
    display: flex;
    align-items: center;
    gap: 8px;
}

.login-hero-avatars .avatar,
.login-hero-avatars .avatar-count {
    width: 40px;
    height: 40px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 600;
}

.avatar-one {
    background: rgba(198, 168, 124, 0.35);
}

.avatar-two {
    background: rgba(255, 133, 102, 0.35);
}

.avatar-three {
    background: rgba(124, 184, 138, 0.35);
}

.avatar-count {
    background: rgba(255, 248, 235, 0.08);
    color: var(--text-secondary);
}

.login-card {
    position: relative;
    padding: clamp(24px, 4vw, 36px);
    display: flex;
    flex-direction: column;
    gap: 24px;
    box-shadow: var(--shadow-soft);
}

.login-card-modern header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
}

.login-card-modern header .eyebrow {
    margin-bottom: 4px;
}

.button-glow {
    box-shadow: 0 15px 50px -20px rgba(99, 132, 255, 0.8);
}

.button-glow:hover {
    box-shadow: 0 20px 60px -20px rgba(99, 132, 255, 0.9);
}

.login-legal {
    font-size: 12px;
    color: var(--text-secondary);
    margin: 6px 0 0;
}

.login-card header span {
    font-size: 14px;
    color: var(--text-secondary);
}

.login-sso {
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding: 18px;
    border-radius: 18px;
    background: rgba(12, 18, 40, 0.6);
    border: 1px solid rgba(198, 168, 124, 0.24);
}

.login-sso-label {
    margin: 0;
    font-size: 14px;
    color: var(--text-secondary);
}

.login-sso-buttons {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

@media (max-width: 960px) {
    .login-hero-card {
        order: -1;
    }
    .login-hero-avatars {
        justify-content: flex-end;
    }
}

.sso-button {
    display: flex;
    align-items: center;
    gap: 14px;
    width: 100%;
    border-radius: 16px;
    padding: 12px 16px;
    border: 1px solid rgba(255, 248, 235, 0.12);
    background: rgba(16, 24, 48, 0.75);
    color: var(--text-primary);
    font-size: 15px;
    text-align: left;
    cursor: pointer;
    transition: border-color 0.2s ease, transform 0.2s ease;
}

.sso-button:hover {
    border-color: rgba(255, 248, 235, 0.3);
    transform: translateY(-1px);
}

.sso-button:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.sso-icon {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 248, 235, 0.08);
}

.sso-icon svg {
    width: 100%;
    height: 100%;
}

.sso-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
    line-height: 1.3;
}

.sso-text strong {
    font-size: 15px;
}

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

.sso-microsoft .sso-icon {
    background: #1b1f3b;
}

.sso-apple .sso-icon {
    background: #0f111a;
    color: #fff;
}

.sso-google .sso-icon {
    width: 24px;
    height: 24px;
    background: transparent;
    border: 0;
    border-radius: 0;
}

.login-divider {
    display: flex;
    align-items: center;
    gap: 16px;
    text-transform: uppercase;
    letter-spacing: 0.16em;
    font-size: 11px;
    color: var(--text-muted);
}

.login-divider::before,
.login-divider::after {
    content: "";
    flex: 1;
    height: 1px;
    background: rgba(255, 248, 235, 0.16);
}

.login-alert {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    padding: 16px 18px;
    border-radius: 16px;
    border: 1px solid;
    font-size: 14px;
    line-height: 1.6;
}

.login-alert svg {
    flex-shrink: 0;
}

.login-alert-success {
    background: rgba(124, 184, 138, 0.12);
    border-color: rgba(124, 184, 138, 0.42);
    color: #7ff3d2;
}

.login-alert-error {
    background: rgba(196, 94, 94, 0.12);
    border-color: rgba(196, 94, 94, 0.4);
    color: #ff90ad;
}

.login-form {
    display: grid;
    gap: 18px;
}

.login-form .form-field {
    display: grid;
    gap: 8px;
}

.login-form .form-field label {
    display: block;
}

.login-form label {
    font-size: 13px;
    letter-spacing: 0.08em;
    text-transform: none;
    color: var(--text-muted);
}

.login-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    font-size: 14px;
    color: var(--text-secondary);
}

.remember {
    display: inline-flex;
    align-items: center;
    flex-direction: row;
    gap: 10px;
    font-size: 14px;
    color: var(--text-secondary);
    letter-spacing: 0.02em;
}

.remember input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--accent);
}

.login-footer {
    border-top: 1px solid rgba(255, 248, 235, 0.08);
    padding-top: 18px;
    font-size: 13px;
    color: var(--text-muted);
}

.login-footer p {
    margin: 0;
}

.login-footer a {
    font-weight: 500;
}

@media (max-width: 900px) {
    .page {
        padding: 36px clamp(20px, 6vw, 32px) 64px;
    }

    .surface header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .studio-panel-actions {
        width: 100%;
        justify-content: flex-start;
        flex-wrap: wrap;
    }

    .login-layout {
        grid-template-columns: 1fr;
        margin-top: clamp(20px, 6vh, 60px);
    }

    .login-copy {
        text-align: center;
        align-items: center;
    }

    .login-logo {
        justify-content: center;
    }

    .login-card {
        margin: 0 auto;
        width: min(440px, 100%);
    }

    .timeline-controls {
        flex-direction: column;
        align-items: stretch;
    }

    .timeline-field,
    .timeline-selection {
        min-width: 100%;
    }

    .studio-catalog-toolbar {
        justify-content: flex-start;
    }

    .segment-grid {
        grid-template-columns: 1fr;
    }

    .pinned-actor-card {
        grid-template-columns: 1fr;
        padding: 22px;
    }
}

@media (max-width: 600px) {
    .hero {
        gap: 16px;
    }

    textarea {
        min-height: 180px;
        padding: 16px;
    }

    .actions {
        flex-direction: column;
        align-items: stretch;
    }

    .ghost-link {
        width: 100%;
        justify-content: center;
    }

    .button {
        width: 100%;
    }

    .login-copy {
        text-align: left;
        align-items: flex-start;
    }

    .login-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
    }

    .login-card {
        padding: 24px;
    }

    .studio-timeline {
        padding: 18px;
    }

    .studio-catalog-toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .studio-catalog-toolbar .select-wrapper {
        width: 100%;
    }

    .studio-panel-actions {
        align-items: stretch;
    }

    .pinned-actor-links {
        flex-direction: column;
        align-items: flex-start;
    }

    .timeline-selection-value {
        font-size: 15px;
    }
}


    .timeline-field .select-wrapper {
        width: 100%;
    }

    .timeline-field .select-value {
        font-size: 15px;
    }

/* Video Preview Modal */
.video-preview-modal {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
}

.video-preview-modal.is-visible {
    opacity: 1;
    pointer-events: auto;
}

.video-preview-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.video-preview-dialog {
    position: relative;
    width: 100%;
    max-width: 900px;
    max-height: 90vh;
    background: var(--surface-primary);
    border-radius: 20px;
    border: 1px solid rgba(255, 248, 235, 0.1);
    box-shadow: 0 25px 80px rgba(0, 0, 0, 0.6);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: scale(0.95) translateY(20px);
    transition: transform 0.25s ease;
}

.video-preview-modal.is-visible .video-preview-dialog {
    transform: scale(1) translateY(0);
}

.video-preview-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid rgba(255, 248, 235, 0.08);
}

.video-preview-header h2 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: calc(100% - 50px);
}

.video-preview-close {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: rgba(255, 248, 235, 0.06);
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s ease, color 0.15s ease;
    flex-shrink: 0;
}

.video-preview-close:hover {
    background: rgba(255, 248, 235, 0.12);
    color: var(--text-primary);
}

.video-preview-content {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #000;
    min-height: 300px;
    max-height: 60vh;
}

.video-preview-player {
    width: 100%;
    height: 100%;
    max-height: 60vh;
    object-fit: contain;
    background: #000;
}

.video-preview-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-top: 1px solid rgba(255, 248, 235, 0.08);
    gap: 16px;
    flex-wrap: wrap;
}

.video-preview-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 13px;
    color: var(--text-secondary);
}

.video-preview-meta span {
    display: flex;
    align-items: center;
    gap: 4px;
}

.video-preview-meta span::before {
    content: '';
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: var(--text-muted);
}

.video-preview-meta span:first-child::before {
    display: none;
}

.video-preview-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.video-preview-actions .button {
    white-space: nowrap;
}

/* Danger button variant */
.ghost-button.is-danger {
    color: #ef4444;
}

.ghost-button.is-danger:hover {
    background: rgba(239, 68, 68, 0.1);
    color: #f87171;
}

@media (max-width: 600px) {
    .video-preview-dialog {
        max-width: 100%;
        max-height: 100vh;
        border-radius: 0;
    }

    .video-preview-footer {
        flex-direction: column;
        align-items: stretch;
    }

    .video-preview-actions {
        flex-direction: column;
    }

    .video-preview-actions .button {
        width: 100%;
    }
}

/* Segment Edit Modal */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
}

#publish-confirm-modal {
    z-index: 1500;
}

.modal-overlay[hidden] {
    display: none;
}

.modal-container {
    background: linear-gradient(135deg, rgba(20, 28, 50, 0.98), rgba(12, 18, 38, 0.98));
    border: 1px solid rgba(255, 248, 235, 0.12);
    border-radius: 20px;
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 248, 235, 0.05) inset;
    width: 100%;
    max-width: 560px;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.modal-container-wide {
    max-width: 720px;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid rgba(255, 248, 235, 0.08);
}

.modal-title {
    font-size: 18px;
    font-weight: 600;
    margin: 0;
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 24px;
    cursor: pointer;
    padding: 4px 8px;
    line-height: 1;
    border-radius: 6px;
    transition: background 0.2s ease, color 0.2s ease;
}

.modal-close:hover {
    background: rgba(255, 248, 235, 0.08);
    color: var(--text-primary);
}

.modal-body {
    padding: 24px;
    overflow-y: auto;
    flex: 1;
}

.modal-field {
    margin-bottom: 20px;
}

.modal-field:last-child {
    margin-bottom: 0;
}

.modal-label {
    display: block;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--accent-primary);
    font-weight: 600;
    margin-bottom: 8px;
}

.modal-segment-headline {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
}

.modal-config-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px;
    padding: 14px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 10px;
    border: 1px solid rgba(255, 248, 235, 0.06);
}

.modal-config-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.modal-config-label {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    font-weight: 500;
}

.modal-config-value {
    font-size: 13px;
    color: var(--text-primary);
    font-weight: 500;
}

.modal-config-select {
    width: 100%;
    padding: 8px 10px;
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid rgba(255, 248, 235, 0.1);
    border-radius: 10px;
    color: var(--text-primary);
    font-size: 13px;
    line-height: 1.4;
}

.modal-config-select:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 2px rgba(198, 168, 124, 0.2);
}

.modal-two-column {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

@media (max-width: 640px) {
    .modal-two-column {
        grid-template-columns: 1fr;
    }
}

.modal-dialog-display {
    margin: 0;
    font-size: 14px;
    color: var(--text-muted);
    line-height: 1.5;
    padding: 12px 14px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 8px;
    border: 1px solid rgba(255, 248, 235, 0.05);
}

.modal-textarea {
    width: 100%;
    min-height: 160px;
    padding: 14px 16px;
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid rgba(255, 248, 235, 0.1);
    border-radius: 10px;
    color: var(--text-primary);
    font-size: 14px;
    line-height: 1.6;
    resize: vertical;
    font-family: inherit;
}

.modal-textarea:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 2px rgba(198, 168, 124, 0.2);
}

.modal-helper {
    margin: 8px 0 0;
    font-size: 12px;
    color: var(--text-muted);
}

.modal-status {
    margin-top: 16px;
    padding: 12px 14px;
    background: rgba(198, 168, 124, 0.15);
    border: 1px solid rgba(198, 168, 124, 0.3);
    border-radius: 8px;
    font-size: 13px;
    color: var(--text-primary);
}

.modal-status-error {
    background: rgba(239, 68, 68, 0.15);
    border-color: rgba(239, 68, 68, 0.3);
    color: #f87171;
}

.modal-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    padding: 16px 24px;
    border-top: 1px solid rgba(255, 248, 235, 0.08);
    background: rgba(0, 0, 0, 0.15);
}

.modal-footer .action-button {
    padding: 10px 18px;
}

@media (max-width: 600px) {
    .modal-container {
        max-width: 100%;
        max-height: 100vh;
        border-radius: 0;
    }
    
    .modal-footer {
        flex-direction: column;
    }
    
    .modal-footer .action-button,
    .modal-footer .ghost-link {
        width: 100%;
        text-align: center;
    }
}

/* ==============================================================================
   IMAGE STUDIO STYLES
   ============================================================================== */

/* Image Studio Composer Page - uses same home-layout as Composer */

/* Image Composer card with glowing blue border */
.image-studio-page #image-composer {
    border: 3px solid rgba(198, 168, 124, 0.6);
    box-shadow: 
        0 0 15px rgba(198, 168, 124, 0.4),
        0 0 30px rgba(198, 168, 124, 0.2),
        0 0 45px rgba(198, 168, 124, 0.1);
    border-radius: 16px;
}

/* Interactive cards inside Image Composer */
.image-studio-page #image-composer .segment-card {
    transition: all 0.3s ease;
    border: 1px solid rgba(198, 168, 124, 0.2);
}

.image-studio-page #image-composer .segment-card:hover {
    border: 2px solid rgba(198, 168, 124, 0.7);
    box-shadow: 
        0 0 12px rgba(198, 168, 124, 0.5),
        0 0 24px rgba(198, 168, 124, 0.25),
        0 0 36px rgba(198, 168, 124, 0.1);
    transform: translateY(-4px) scale(1.01);
}

/* Disabled select options styling */
.image-studio-page select option:disabled {
    color: rgba(255, 248, 235, 0.3);
    background: rgba(0, 0, 0, 0.2);
}

/* Title and Prompt side by side grid */
.segment-grid-title-prompt {
    display: grid;
    grid-template-columns: calc(33.33% - 50px) 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

.segment-grid-title-prompt .segment-title-bar {
    align-self: stretch;
    display: flex;
    flex-direction: column;
    border: 1px solid rgba(198, 168, 124, 0.2) !important;
}

.segment-grid-title-prompt .segment-prompt-main {
    background: linear-gradient(135deg, rgba(198, 168, 124, 0.08), rgba(138, 93, 255, 0.05));
    border: 1px solid rgba(198, 168, 124, 0.2) !important;
}

.image-studio-page .segment-prompt-main .prompt-editor {
    min-height: 120px;
}

.image-studio-page .segment-prompt-main .segment-chip.accent {
    background: linear-gradient(135deg, rgba(198, 168, 124, 0.3), rgba(138, 93, 255, 0.25));
    color: #a8c0ff;
}

/* Form actions for Image Studio */
.image-studio-page .form-actions {
    display: flex;
    justify-content: flex-start;
    margin-top: 24px;
}

.image-studio-page .button.large {
    padding: 16px 40px;
    font-size: 16px;
}

.image-studio-page .button.large span {
    display: block;
    font-size: 12px;
    opacity: 0.7;
    margin-top: 4px;
}

.image-studio-page .button.accent {
    background: linear-gradient(135deg, #c6a87c, #a07850);
    border: none;
    color: white;
    font-weight: 600;
}

.image-studio-page .button.accent:hover {
    background: linear-gradient(135deg, #d4b88e, #b08860);
    transform: translateY(-1px);
    box-shadow: 0 8px 24px rgba(198, 168, 124, 0.35);
}

.image-studio-page .button.accent:disabled {
    background: linear-gradient(135deg, rgba(198, 168, 124, 0.4), rgba(160, 120, 80, 0.3));
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.image-studio-page .generate-design-btn {
    border-radius: 50px;
    padding: 16px 48px;
    font-size: 18px;
    font-weight: 600;
    letter-spacing: 0.3px;
    background: linear-gradient(135deg, #c6a87c, #a07850);
    box-shadow: 0 4px 16px rgba(198, 168, 124, 0.3);
    transition: all 0.25s ease;
}

.image-studio-page .generate-design-btn:hover {
    background: linear-gradient(135deg, #d4b88e, #b08860);
    box-shadow: 0 6px 24px rgba(198, 168, 124, 0.45);
    transform: translateY(-2px);
}

.image-studio-page .generate-design-btn span {
    display: block;
    font-size: 12px;
    font-weight: 400;
    opacity: 0.85;
    margin-top: 2px;
}

/* Accent button for results page */
.image-studio-results-page .button.accent {
    background: linear-gradient(135deg, #c6a87c, #8a5dff);
    border: none;
    color: white;
    font-weight: 600;
}

.image-studio-results-page .button.accent:hover {
    background: linear-gradient(135deg, #6d94ff, #9a6dff);
    transform: translateY(-1px);
    box-shadow: 0 8px 24px rgba(198, 168, 124, 0.3);
}

/* Brand Guidelines Card - Extended Width */
.segment-card.segment-brand-guidelines {
    grid-column: span 2;
    max-width: calc(100% - 0px);
}

/* Brand Guidelines Upload */
.brand-guidelines-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    align-items: start;
}

.brand-guidelines-upload {
    margin-bottom: 0;
}

.brand-guidelines-upload .control-file {
    width: 100%;
    padding: 12px;
    background: rgba(198, 168, 124, 0.05);
    border: 1px dashed rgba(198, 168, 124, 0.3);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.brand-guidelines-upload .control-file:hover {
    background: rgba(198, 168, 124, 0.1);
    border-color: rgba(198, 168, 124, 0.5);
}

.brand-guidelines-upload .upload-hint {
    font-size: 12px;
    color: rgba(255, 248, 235, 0.5);
    margin-top: 6px;
    margin-bottom: 0;
}

.brand-guidelines-text {
    display: flex;
    flex-direction: column;
}

.brand-guidelines-text .control {
    flex: 1;
    min-height: 80px;
}

/* Responsive: stack on smaller screens */
@media (max-width: 900px) {
    .segment-grid-title-prompt {
        grid-template-columns: 1fr;
    }
    
    .brand-guidelines-row {
        grid-template-columns: 1fr;
    }
}

/* Image Studio Results Page */
.image-studio-results-page {
    background: radial-gradient(circle at 20% 120%, rgba(198, 168, 124, 0.15), transparent 40%),
                radial-gradient(circle at 80% -10%, rgba(166, 124, 82, 0.2), transparent 46%),
                linear-gradient(135deg, #0f0d0b, #17130e 48%, #0f0d0b 100%);
}

.image-studio-results-page .page {
    padding: 0;
}

.image-studio-results-page .top-nav {
    /* inherit global pill style */
    border-bottom: none;
}

/* Image Studio Results Layout */
.image-results-layout {
    display: grid;
    grid-template-columns: 240px 1fr;
    gap: 24px;
    padding: 24px;
    max-width: 1600px;
    margin: 0 auto;
    min-height: calc(100vh - 80px);
}

/* 3-Column Layout with Cloud Library on Right */
.image-results-layout.image-results-layout-3col {
    grid-template-columns: 200px 1fr 640px;
    max-width: 2200px;
}

/* Cloud Library Sidebar */
.image-cloud-library-sidebar {
    background: var(--bg-card);
    border: 1px solid var(--border-soft);
    border-radius: 20px;
    padding: 16px;
    height: fit-content;
    min-height: 700px;
    max-height: calc(100vh - 120px);
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 104px;
    margin-top: 24px;
    box-shadow: var(--shadow-soft);
    backdrop-filter: var(--glass-blur);
}

.cloud-library-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid rgba(255, 248, 235, 0.08);
}

.cloud-library-header h3 {
    font-size: 14px;
    font-weight: 600;
    margin: 0;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.cloud-library-header h3 svg {
    color: var(--accent-primary);
}

/* Cloud Library Tabs - Horizontal Layout */
.cloud-library-tabs {
    display: flex;
    flex-direction: row;
    gap: 4px;
    background: rgba(0, 0, 0, 0.18);
    padding: 3px;
    border-radius: 8px;
    border: 1px solid rgba(255, 248, 235, 0.08);
}

.cloud-lib-tab {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 5px 10px;
    background: transparent;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
    color: var(--text-muted);
    font-size: 11px;
    white-space: nowrap;
}

.cloud-lib-tab:focus-visible {
    outline: 2px solid rgba(var(--accent-primary-rgb), 0.95);
    outline-offset: 3px;
}

.cloud-lib-tab:hover {
    background: rgba(255, 248, 235, 0.08);
    color: var(--text-primary);
}

.cloud-lib-tab.active {
    background: linear-gradient(135deg, rgba(var(--accent-primary-rgb), 0.9), rgba(166, 124, 82, 0.9));
    color: white;
}

.cloud-lib-tab .tab-label {
    font-weight: 500;
}

.cloud-lib-tab .tab-count {
    background: rgba(255, 248, 235, 0.15);
    padding: 1px 5px;
    border-radius: 8px;
    font-size: 9px;
    font-weight: 600;
    min-width: 16px;
    text-align: center;
}

.cloud-lib-tab.active .tab-count {
    background: rgba(255, 248, 235, 0.25);
}

/* Cloud Library Content */
.cloud-library-content {
    flex: 1;
    overflow-y: auto;
    min-height: 200px;
    max-height: none;
}

.cloud-library-content::-webkit-scrollbar {
    width: 8px;
}

.cloud-library-content::-webkit-scrollbar-track {
    background: rgba(8, 11, 20, 0.22);
    border-radius: 999px;
}

.cloud-library-content::-webkit-scrollbar-thumb {
    background: rgba(255, 248, 235, 0.12);
    border-radius: 999px;
    border: 2px solid rgba(0, 0, 0, 0);
    background-clip: padding-box;
}

.cloud-library-content::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 248, 235, 0.18);
    border: 2px solid rgba(0, 0, 0, 0);
    background-clip: padding-box;
}

.cloud-library-loading,
.cloud-library-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 32px 16px;
    text-align: center;
    color: var(--text-muted);
    font-size: 12px;
}

.cloud-lib-spinner {
    width: 24px;
    height: 24px;
    border: 2px solid rgba(255, 248, 235, 0.1);
    border-top-color: var(--accent-primary);
    border-radius: 50%;
    animation: cloud-lib-spin 0.8s linear infinite;
}

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

.cloud-library-empty svg {
    color: var(--text-muted);
    opacity: 0.5;
}

/* Cloud Library Image Grid */
.cloud-library-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
}

.cloud-lib-image-item {
    position: relative;
    aspect-ratio: 1;
    border-radius: 6px;
    overflow: hidden;
    background: rgba(0, 0, 0, 0.3);
    cursor: pointer;
    transition: transform 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease;
    border: 2px solid transparent;
}

.cloud-lib-image-item:hover {
    transform: translateY(-1px) scale(1.02);
    border-color: rgba(var(--accent-primary-rgb), 0.55);
    box-shadow: 0 10px 28px -18px rgba(0, 0, 0, 0.7);
    z-index: 10;
}

.cloud-lib-image-item:focus-visible {
    outline: 2px solid rgba(var(--accent-primary-rgb), 0.95);
    outline-offset: 3px;
}

.cloud-lib-image-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.cloud-lib-image-item .cloud-lib-image-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 4px;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.85));
    opacity: 0;
    transition: opacity 0.15s ease;
}

.cloud-lib-image-item:hover .cloud-lib-image-overlay {
    opacity: 1;
}

.cloud-lib-image-time {
    font-size: 8px;
    color: rgba(255, 248, 235, 0.9);
}

/* Button group for cloud library image actions */
.cloud-lib-btn-group {
    position: absolute;
    top: 2px;
    right: 2px;
    display: flex;
    gap: 2px;
    opacity: 0;
    transition: opacity 0.15s ease;
}

.cloud-lib-image-item:hover .cloud-lib-btn-group {
    opacity: 1;
}

.cloud-lib-edit-btn,
.cloud-lib-use-btn {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(198, 168, 124, 0.9);
    border: none;
    border-radius: 4px;
    color: white;
    cursor: pointer;
    transition: all 0.15s ease;
}

.cloud-lib-edit-btn {
    background: rgba(76, 175, 80, 0.9);
}

.cloud-lib-edit-btn svg,
.cloud-lib-use-btn svg {
    width: 12px;
    height: 12px;
}

.cloud-lib-edit-btn:hover {
    background: #4CAF50;
    transform: scale(1.1);
}

.cloud-lib-use-btn:hover {
    background: var(--accent-primary);
    transform: scale(1.1);
}

/* Cloud Library Footer */
.cloud-library-footer {
    padding-top: 12px;
    margin-top: 12px;
    border-top: 1px solid rgba(255, 248, 235, 0.08);
    text-align: center;
}

.cloud-library-footer .ghost-link {
    font-size: 11px;
}

/* Cloud Library Image Modal */
.cloud-lib-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.cloud-lib-modal.active {
    opacity: 1;
    visibility: visible;
}

.cloud-lib-modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(8px);
}

.cloud-lib-modal-content {
    position: relative;
    max-width: 90vw;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    transform: scale(0.9);
    transition: transform 0.3s ease;
}

.cloud-lib-modal.active .cloud-lib-modal-content {
    transform: scale(1);
}

.cloud-lib-modal-close {
    position: absolute;
    top: -40px;
    right: -40px;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 248, 235, 0.1);
    border: 1px solid rgba(255, 248, 235, 0.2);
    border-radius: 50%;
    color: white;
    cursor: pointer;
    transition: all 0.2s ease;
}

.cloud-lib-modal-close:hover {
    background: rgba(255, 248, 235, 0.2);
    transform: scale(1.1);
}

.cloud-lib-modal-image {
    max-width: 100%;
    max-height: 70vh;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    object-fit: contain;
}

.cloud-lib-modal-info {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    color: white;
}

.cloud-lib-modal-title {
    font-size: 16px;
    font-weight: 600;
}

.cloud-lib-modal-time {
    font-size: 12px;
    color: rgba(255, 248, 235, 0.6);
}

.cloud-lib-modal-actions {
    display: flex;
    gap: 12px;
}

.cloud-lib-modal-actions .ghost-link {
    padding: 10px 20px;
    background: rgba(255, 248, 235, 0.1);
    border: 1px solid rgba(255, 248, 235, 0.2);
    border-radius: 8px;
    color: white;
    text-decoration: none;
    font-size: 14px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.cloud-lib-modal-actions .ghost-link:hover {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
}

.cloud-lib-modal-actions .cloud-lib-modal-delete {
    background: rgba(239, 68, 68, 0.15);
    border-color: rgba(239, 68, 68, 0.3);
    color: #ef4444;
}

.cloud-lib-modal-actions .cloud-lib-modal-delete:hover {
    background: #ef4444;
    border-color: #ef4444;
    color: white;
}

.cloud-lib-modal-actions .cloud-lib-modal-delete:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.cloud-lib-spinner-small {
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255, 248, 235, 0.2);
    border-top-color: currentColor;
    border-radius: 50%;
    animation: cloud-lib-spin 0.8s linear infinite;
    display: inline-block;
}

/* History Sidebar */
.image-history-sidebar {
    background: var(--bg-card);
    border: 1px solid var(--border-soft);
    border-radius: 20px;
    padding: 16px;
    height: calc(100vh - 140px);
    max-height: calc(100vh - 140px);
    overflow: hidden;
    position: sticky;
    top: 104px;
    margin-top: 24px;
    box-shadow: var(--shadow-soft);
    backdrop-filter: var(--glass-blur);
    display: flex;
    flex-direction: column;
}

.image-history-sidebar::-webkit-scrollbar {
    width: 8px;
}

.image-history-sidebar::-webkit-scrollbar-track {
    background: rgba(8, 11, 20, 0.22);
    border-radius: 999px;
}

.image-history-sidebar::-webkit-scrollbar-thumb {
    background: rgba(255, 248, 235, 0.12);
    border-radius: 999px;
    border: 2px solid rgba(0, 0, 0, 0);
    background-clip: padding-box;
}

.image-history-sidebar::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 248, 235, 0.18);
    border: 2px solid rgba(0, 0, 0, 0);
    background-clip: padding-box;
}

.image-history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid rgba(255, 248, 235, 0.08);
    flex-shrink: 0;
}

.image-history-header h3 {
    font-size: 14px;
    font-weight: 600;
    margin: 0;
    color: var(--text-primary);
}

.image-history-header .ghost-link.small {
    font-size: 11px;
    padding: 6px 10px;
}

.image-history-list {
    list-style: none;
    padding: 0;
    padding-right: 4px;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
    overflow-y: auto;
    overflow-x: hidden;
    flex: 1 1 auto;
    min-height: 0;
    max-height: 100%;
}

.image-history-list::-webkit-scrollbar {
    width: 6px;
}

.image-history-list::-webkit-scrollbar-track {
    background: rgba(8, 11, 20, 0.22);
    border-radius: 999px;
}

.image-history-list::-webkit-scrollbar-thumb {
    background: rgba(255, 248, 235, 0.15);
    border-radius: 999px;
}

.image-history-list::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 248, 235, 0.25);
}

.image-history-item {
    position: relative;
}

.image-history-item a {
    display: flex;
    gap: 10px;
    padding: 8px;
    padding-right: 32px;
    border-radius: 10px;
    text-decoration: none;
    transition: background 0.18s ease, border-color 0.18s ease;
}

.image-history-item a:hover {
    background: rgba(255, 248, 235, 0.06);
}

.image-history-item.active a {
    background: rgba(198, 168, 124, 0.15);
    border: 1px solid rgba(198, 168, 124, 0.3);
}

.image-history-item a:focus-visible {
    outline: 2px solid rgba(var(--accent-primary-rgb), 0.95);
    outline-offset: 3px;
}

.history-delete-btn {
    position: absolute;
    right: 6px;
    top: 50%;
    transform: translateY(-50%);
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    opacity: 0;
    transition: all 0.15s ease;
    color: var(--text-muted);
}

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

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

.image-history-thumb {
    width: 48px;
    height: 48px;
    border-radius: 8px;
    overflow: hidden;
    background: rgba(0, 0, 0, 0.3);
    flex-shrink: 0;
}

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

.image-history-meta {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

.image-history-title {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.image-history-time {
    font-size: 10px;
    color: var(--text-muted);
}

.image-history-empty {
    font-size: 12px;
    color: var(--text-muted);
    text-align: center;
    padding: 24px 0;
}

/* Main Image Display */
.image-main-display {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin-top: 24px;
}

.image-canvas-container {
    background: linear-gradient(135deg, rgba(10, 14, 28, 0.8), rgba(12, 10, 6, 0.8));
    border: 1px solid rgba(255, 248, 235, 0.08);
    border-radius: 20px;
    min-height: 400px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
}

.image-canvas-main {
    max-width: 100%;
    max-height: 70vh;
    object-fit: contain;
    border-radius: 12px;
}

/* Image Load Error Placeholder */
.image-load-error {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 20px;
    padding: 48px 32px;
    background: linear-gradient(135deg, rgba(196, 94, 94, 0.06) 0%, rgba(20, 22, 27, 0.95) 100%);
    border: 1px solid rgba(196, 94, 94, 0.2);
    border-radius: 16px;
    text-align: center;
    max-width: 420px;
    margin: 0 auto;
    animation: error-fade-in 0.4s ease-out;
}

.image-error-icon {
    color: rgba(255, 248, 235, 0.4);
    opacity: 0.7;
}

.image-error-icon svg {
    display: block;
}

.image-error-message {
    color: rgba(255, 248, 235, 0.85);
    font-size: 15px;
    line-height: 1.6;
    margin: 0;
    max-width: 320px;
}

.image-retry-btn {
    padding: 10px 24px;
    background: linear-gradient(135deg, rgba(198, 168, 124, 0.2), rgba(198, 168, 124, 0.1));
    border: 1px solid rgba(198, 168, 124, 0.4);
    border-radius: 8px;
    color: var(--accent);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.image-retry-btn:hover {
    background: linear-gradient(135deg, rgba(198, 168, 124, 0.3), rgba(198, 168, 124, 0.15));
    border-color: rgba(198, 168, 124, 0.6);
    transform: translateY(-1px);
}

.image-retry-btn:active {
    transform: translateY(0);
}

.image-slideshow-controls {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    pointer-events: none;
}

.image-slideshow-btn {
    pointer-events: auto;
    width: 44px;
    height: 44px;
    border-radius: 999px;
    border: 1px solid var(--border-soft);
    background: var(--bg-card-alt);
    color: var(--text-primary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    backdrop-filter: var(--glass-blur);
    box-shadow: var(--shadow-soft);
    transition: transform 0.18s ease, background 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.image-slideshow-btn svg {
    display: block;
}

.image-canvas-container:hover .image-slideshow-btn {
    border-color: rgba(255, 248, 235, 0.14);
}

.image-slideshow-btn:hover {
    border-color: var(--border-highlight);
    background: var(--bg-card);
    transform: translateY(-1px);
    box-shadow: var(--shadow-intense);
}

.image-slideshow-btn:active {
    transform: translateY(0);
    box-shadow: var(--shadow-soft);
}

.image-slideshow-btn:focus-visible {
    outline: 2px solid var(--accent-primary);
    outline-offset: 3px;
}

/* Loading State */
.image-loading-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    padding: 48px;
    text-align: center;
}

.image-loading-spinner {
    width: 48px;
    height: 48px;
    border: 3px solid rgba(198, 168, 124, 0.2);
    border-top-color: var(--accent-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

.image-loading-state p {
    margin: 0;
    color: var(--text-secondary);
    font-size: 14px;
}

.image-loading-progress {
    font-size: 24px;
    font-weight: 600;
    color: var(--accent-primary);
}

/* Error State */
.image-error-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    padding: 48px;
    text-align: center;
    color: var(--text-muted);
}

.image-error-state svg {
    color: #f87171;
}

.image-error-message {
    font-size: 13px;
    color: var(--text-muted);
    max-width: 300px;
}

/* Empty State */
.image-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    padding: 48px;
    text-align: center;
    color: var(--text-muted);
}

.image-empty-state svg {
    opacity: 0.4;
}

/* Actions Bar */
.image-actions-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 12px;
}

.image-actions-left,
.image-actions-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Convert to Video Button */
.convert-to-video-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.2), rgba(198, 168, 124, 0.2));
    border: 1px solid rgba(139, 92, 246, 0.4);
    border-radius: 8px;
    color: #a78bfa;
    font-size: 12px;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.2s ease;
}

.convert-to-video-btn:hover {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.3), rgba(198, 168, 124, 0.3));
    border-color: rgba(139, 92, 246, 0.6);
    color: #c4b5fd;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(139, 92, 246, 0.25);
}

.convert-to-video-btn svg {
    width: 14px;
    height: 14px;
    stroke: currentColor;
}

.image-model-badge,
.image-size-badge {
    font-size: 11px;
    font-weight: 500;
    padding: 6px 10px;
    background: rgba(198, 168, 124, 0.15);
    border: 1px solid rgba(198, 168, 124, 0.3);
    border-radius: 6px;
    color: var(--accent-primary);
}

.image-size-badge {
    background: rgba(255, 248, 235, 0.06);
    border-color: rgba(255, 248, 235, 0.12);
    color: var(--text-secondary);
}

/* Variations Grid */
.image-variations-grid {
    padding: 16px;
    background: rgba(0, 0, 0, 0.15);
    border-radius: 12px;
}

.image-variations-grid h4 {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin: 0 0 12px 0;
}

.variations-thumbs {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.variation-thumb {
    width: 80px;
    height: 80px;
    border-radius: 10px;
    overflow: hidden;
    border: 2px solid transparent;
    background: none;
    padding: 0;
    cursor: pointer;
    transition: border-color 0.2s ease, transform 0.2s ease;
}

.variation-thumb:hover {
    transform: scale(1.05);
    border-color: rgba(var(--accent-primary-rgb, 99, 102, 241), 0.5);
}

.variation-thumb.active {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 2px rgba(var(--accent-primary-rgb, 99, 102, 241), 0.3);
}

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

/* Refinement Panel */
.image-refinement-panel {
    background: var(--bg-card);
    border: 1px solid var(--border-soft);
    border-radius: 20px;
    padding: 24px;
    box-shadow: var(--shadow-soft);
    backdrop-filter: var(--glass-blur);
}

.image-refinement-panel header {
    margin-bottom: 20px;
}

.image-refinement-panel header h3 {
    font-size: 16px;
    font-weight: 600;
    margin: 0 0 4px 0;
}

.image-refinement-panel header span {
    font-size: 13px;
    color: var(--text-muted);
}

.refinement-prompt-area {
    margin-bottom: 16px;
}

.refinement-prompt {
    width: 100%;
    min-height: 100px;
    padding: 14px 16px;
    background: rgba(8, 11, 20, 0.55);
    border: 1px solid rgba(255, 248, 235, 0.12);
    border-radius: 12px;
    color: var(--text-primary);
    font-size: 14px;
    line-height: 1.6;
    resize: vertical;
    font-family: inherit;
}

.refinement-prompt:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(var(--accent-primary-rgb), 0.22);
}

.refinement-prompt::placeholder {
    color: var(--text-muted);
}

.refinement-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 20px;
}

.refinement-actions .button {
    padding: 14px 20px;
    font-size: 14px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.refinement-actions .button span {
    font-size: 11px;
    opacity: 0.7;
    font-weight: 400;
}

/* Quick Actions */
.refinement-quick-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    padding-top: 16px;
    border-top: 1px solid rgba(255, 248, 235, 0.06);
}

.quick-actions-label {
    font-size: 11px;
    color: var(--text-muted);
    margin-right: 4px;
}

.pill-button {
    font-size: 11px;
    padding: 6px 12px;
    background: rgba(255, 248, 235, 0.05);
    border: 1px solid rgba(255, 248, 235, 0.12);
    border-radius: 20px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: background 0.18s ease, border-color 0.18s ease, color 0.18s ease, transform 0.18s ease;
}

.pill-button:hover {
    background: rgba(255, 248, 235, 0.1);
    border-color: rgba(255, 248, 235, 0.2);
    color: var(--text-primary);
    transform: translateY(-1px);
}

.pill-button:focus-visible {
    outline: 2px solid rgba(var(--accent-primary-rgb), 0.95);
    outline-offset: 3px;
}

.refinement-status {
    margin-top: 16px;
    font-size: 13px;
    color: var(--text-secondary);
    visibility: hidden;
}

.refinement-status.error {
    color: #f87171;
}

/* Original Prompt Details */
.image-prompt-details {
    background: rgba(0, 0, 0, 0.15);
    border-radius: 12px;
    padding: 4px;
}

.image-prompt-details summary {
    padding: 12px 16px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    user-select: none;
}

.image-prompt-details summary:hover {
    color: var(--text-primary);
}

.image-prompt-text {
    margin: 0;
    padding: 16px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 8px;
    font-size: 13px;
    line-height: 1.6;
    color: var(--text-secondary);
    white-space: pre-wrap;
    word-break: break-word;
    font-family: inherit;
}

.image-negative-label {
    margin: 12px 16px 8px;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
}

.image-prompt-text.negative {
    color: var(--text-muted);
}

/* Loading spinner for buttons */
.loading-spinner {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255, 248, 235, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-right: 6px;
    vertical-align: middle;
}

/* Image Editing Toolbar & Canvas */
.image-edit-toolbar {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 6px;
    padding: 10px 14px;
    background: linear-gradient(135deg, rgba(20, 28, 50, 0.95), rgba(12, 18, 38, 0.95));
    border: 1px solid rgba(255, 248, 235, 0.12);
    border-radius: 12px;
    margin-top: 16px;
    backdrop-filter: blur(10px);
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10;
    max-width: 95%;
}

.edit-toolbar-group {
    display: flex;
    align-items: center;
    gap: 4px;
}

.edit-toolbar-divider {
    width: 1px;
    height: 28px;
    background: rgba(255, 248, 235, 0.1);
    margin: 0 4px;
}

.edit-tool-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    min-width: 36px;
    height: 36px;
    padding: 0 10px;
    background: rgba(255, 248, 235, 0.06);
    border: 1px solid rgba(255, 248, 235, 0.1);
    border-radius: 8px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 11px;
    font-weight: 500;
}

.edit-tool-btn:hover {
    background: rgba(255, 248, 235, 0.1);
    border-color: rgba(255, 248, 235, 0.2);
    color: var(--text-primary);
}

.edit-tool-btn.active {
    background: rgba(198, 168, 124, 0.2);
    border-color: var(--accent-primary);
    color: var(--accent-primary);
}

.edit-tool-btn.accent {
    background: rgba(198, 168, 124, 0.15);
    border-color: rgba(198, 168, 124, 0.4);
    color: var(--accent-primary);
}

.edit-tool-btn.accent:hover {
    background: rgba(198, 168, 124, 0.25);
    border-color: var(--accent-primary);
}

.edit-tool-btn svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

/* Image Edit Panel */
.image-edit-panel {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 360px;
    background: linear-gradient(135deg, rgba(20, 28, 50, 0.98), rgba(12, 18, 38, 0.98));
    border: 1px solid rgba(255, 248, 235, 0.12);
    border-radius: 16px;
    backdrop-filter: blur(20px);
    /* Keep this above any in-canvas overlays (canvas, crop overlay, etc.) */
    z-index: 20000;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    pointer-events: auto;
}

.edit-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid rgba(255, 248, 235, 0.08);
}

.edit-panel-header h4 {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.edit-panel-close {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 248, 235, 0.06);
    border: none;
    border-radius: 6px;
    color: var(--text-muted);
    font-size: 18px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.edit-panel-close:hover {
    background: rgba(255, 248, 235, 0.1);
    color: var(--text-primary);
}

.edit-panel-content {
    padding: 16px 20px;
    max-height: 520px;
    overflow-y: auto;
}

.edit-tool-options {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.edit-tool-options label {
    font-size: 11px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-bottom: -8px;
}

.edit-tool-hint {
    font-size: 12px;
    color: var(--text-muted);
    margin: 0;
    padding: 12px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 8px;
}

.crop-size-display {
    font-size: 14px;
    color: var(--text-secondary);
    padding: 8px 12px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 6px;
    text-align: center;
    margin: 8px 0;
    font-family: monospace;
}

.edit-slider {
    width: 100%;
    height: 4px;
    background: rgba(255, 248, 235, 0.1);
    border-radius: 2px;
    -webkit-appearance: none;
    appearance: none;
    cursor: pointer;
}

.edit-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 14px;
    height: 14px;
    background: var(--accent-primary);
    border-radius: 50%;
    cursor: pointer;
    transition: transform 0.15s ease;
}

.edit-slider::-webkit-slider-thumb:hover {
    transform: scale(1.15);
}

.slider-value {
    font-size: 12px;
    color: var(--text-secondary);
    text-align: right;
    min-width: 40px;
}

.aspect-ratio-btns,
.rotate-btns,
.flip-btns,
.draw-tools {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.filter-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    max-height: 520px;
    overflow-y: auto;
    padding: 8px;
    padding-right: 12px;
    margin: 0 -4px;
}

.filter-grid::-webkit-scrollbar {
    width: 8px;
}

.filter-grid::-webkit-scrollbar-track {
    background: rgba(255, 248, 235, 0.03);
    border-radius: 4px;
}

.filter-grid::-webkit-scrollbar-thumb {
    background: rgba(198, 168, 124, 0.5);
    border-radius: 4px;
}

.filter-grid::-webkit-scrollbar-thumb:hover {
    background: rgba(198, 168, 124, 0.7);
}

.filter-btn {
    padding: 12px 10px;
    background: rgba(255, 248, 235, 0.05);
    border: 1px solid rgba(255, 248, 235, 0.1);
    border-radius: 10px;
    color: rgba(255, 248, 235, 0.8);
    font-size: 12px;
    font-weight: 500;
    letter-spacing: 0.2px;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-align: center;
    min-height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.filter-btn:hover {
    background: rgba(255, 248, 235, 0.1);
    border-color: rgba(255, 248, 235, 0.2);
    color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.filter-btn.active {
    background: linear-gradient(135deg, rgba(198, 168, 124, 0.35), rgba(138, 93, 255, 0.25));
    border-color: var(--accent-primary);
    color: #fff;
    box-shadow: 0 0 12px rgba(198, 168, 124, 0.4), inset 0 0 20px rgba(198, 168, 124, 0.1);
    font-weight: 600;
}

.color-input {
    width: 100%;
    height: 36px;
    padding: 2px;
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid rgba(255, 248, 235, 0.1);
    border-radius: 8px;
    cursor: pointer;
}

.color-input::-webkit-color-swatch-wrapper {
    padding: 2px;
}

.color-input::-webkit-color-swatch {
    border-radius: 6px;
    border: none;
}

.edit-panel-actions {
    display: flex;
    gap: 10px;
    padding: 16px 20px;
    border-top: 1px solid rgba(255, 248, 235, 0.08);
}

.edit-panel-actions .button {
    flex: 1;
    padding: 10px 16px;
    font-size: 13px;
}

/* Text Layer System */
.text-layer-actions {
    display: flex;
    gap: 8px;
    margin-top: 8px;
}

.text-layer-actions .pill-button.accent {
    background: rgba(198, 168, 124, 0.2);
    border-color: var(--accent-primary);
    color: var(--accent-primary);
    flex: 1;
    justify-content: center;
    padding: 10px 16px;
}

.text-layer-actions .pill-button.accent:hover {
    background: rgba(198, 168, 124, 0.3);
}

/* Font Select Dropdown Styling */
#text-font-select {
    max-height: 300px;
    font-size: 14px;
    padding: 10px 12px;
    overflow-y: auto;
}

#text-font-select optgroup {
    font-weight: 700;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--accent-primary);
    padding: 12px 0 6px 0;
    background: var(--background-secondary);
    font-family: var(--font-primary) !important;
}

#text-font-select option {
    padding: 8px 12px;
    line-height: 1.6;
    font-size: 16px;
}

#text-font-select option:checked {
    background: linear-gradient(to right, var(--accent-primary), var(--accent-primary));
    color: white;
}

.text-layers-list {
    margin-top: 16px;
    border-top: 1px solid rgba(255, 248, 235, 0.08);
    padding-top: 12px;
}

.text-layers-header {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.text-layers-empty {
    font-size: 12px;
    color: var(--text-muted);
    text-align: center;
    padding: 12px;
    margin: 0;
}

.text-layer-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    background: rgba(255, 248, 235, 0.04);
    border: 1px solid rgba(255, 248, 235, 0.08);
    border-radius: 8px;
    margin-bottom: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.text-layer-item:hover {
    background: rgba(255, 248, 235, 0.08);
    border-color: rgba(255, 248, 235, 0.12);
}

.text-layer-item.selected {
    background: rgba(198, 168, 124, 0.15);
    border-color: var(--accent-primary);
}

.text-layer-preview {
    font-size: 12px;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
    margin-right: 8px;
}

.text-layer-delete {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 248, 235, 0.06);
    border: none;
    border-radius: 4px;
    color: var(--text-muted);
    font-size: 16px;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.text-layer-delete:hover {
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
}

.text-layer-element {
    transition: transform 0.1s ease;
}

.text-layer-element:hover {
    transform: translate(-50%, -50%) scale(1.02);
}

/* Toolbar Separator */
.toolbar-separator {
    width: 1px;
    height: 28px;
    background: rgba(255, 248, 235, 0.1);
    margin: 0 8px;
}

.tool-size-control {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 12px;
}

.tool-size-control label {
    font-size: 11px;
    color: var(--text-muted);
    white-space: nowrap;
}

.tool-size-slider {
    width: 80px;
    height: 4px;
    background: rgba(255, 248, 235, 0.1);
    border-radius: 2px;
    -webkit-appearance: none;
    appearance: none;
    cursor: pointer;
}

.tool-size-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 14px;
    height: 14px;
    background: var(--accent-primary);
    border-radius: 50%;
    cursor: pointer;
    transition: transform 0.15s ease;
}

.tool-size-slider::-webkit-slider-thumb:hover {
    transform: scale(1.15);
}

.tool-size-slider::-moz-range-thumb {
    width: 14px;
    height: 14px;
    background: var(--accent-primary);
    border: none;
    border-radius: 50%;
    cursor: pointer;
}

.tool-size-value {
    font-size: 11px;
    color: var(--text-secondary);
    min-width: 24px;
    text-align: center;
}

/* Edit Mode Canvas Wrapper */
.image-canvas-wrapper {
    position: relative;
    display: inline-block;
    line-height: 0;
}

.image-canvas-wrapper .image-canvas-main {
    display: block;
}

.image-edit-overlay {
    position: absolute;
    top: 0;
    left: 0;
    cursor: crosshair;
    display: none;
    border-radius: 12px;
}

.image-edit-overlay.active {
    display: block;
}

/* Edit Actions Panel */
.image-edit-actions {
    display: none;
    justify-content: center;
    gap: 12px;
    padding: 16px;
    margin-top: 12px;
    background: rgba(0, 0, 0, 0.25);
    border-radius: 12px;
}

.image-edit-actions.active {
    display: flex;
}

.image-edit-actions .button {
    min-width: 140px;
}

/* Zoom Controls */
.zoom-control-group {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 0 8px;
}

.zoom-level {
    font-size: 11px;
    color: var(--text-secondary);
    min-width: 40px;
    text-align: center;
}

/* Edit Mode Toggle Button */
.edit-mode-toggle {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px 16px;
    background: rgba(255, 248, 235, 0.06);
    border: 1px solid rgba(255, 248, 235, 0.12);
    border-radius: 8px;
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.edit-mode-toggle:hover {
    background: rgba(255, 248, 235, 0.1);
    border-color: rgba(255, 248, 235, 0.2);
    color: var(--text-primary);
}

.edit-mode-toggle.active {
    background: rgba(198, 168, 124, 0.15);
    border-color: var(--accent-primary);
    color: var(--accent-primary);
}

.edit-mode-toggle svg {
    width: 16px;
    height: 16px;
}

/* Responsive */
@media (max-width: 1400px) {
    .image-results-layout.image-results-layout-3col {
        grid-template-columns: 180px 1fr 480px;
    }
}

@media (max-width: 1200px) {
    .image-results-layout.image-results-layout-3col {
        grid-template-columns: 180px 1fr 360px;
    }
    
    .cloud-library-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 1000px) {
    .image-results-layout.image-results-layout-3col {
        grid-template-columns: 200px 1fr;
    }
    
    .image-cloud-library-sidebar {
        display: none;
    }
}

@media (max-width: 900px) {
    .image-results-layout,
    .image-results-layout.image-results-layout-3col {
        grid-template-columns: 1fr;
    }
    
    .image-cloud-library-sidebar {
        display: none;
    }
    
    .image-history-sidebar {
        position: relative;
        top: 0;
        max-height: none;
        order: 1;
    }
    
    .image-main-display {
        order: 0;
        margin-top: 0;
    }
    
    .image-history-list {
        flex-direction: row;
        overflow-x: auto;
        padding-bottom: 8px;
    }
    
    .image-history-item {
        flex-shrink: 0;
    }
    
    .refinement-actions {
        grid-template-columns: 1fr;
    }
}

/* =============================================================================
   IMAGE STUDIO CLOUD SAVE
============================================================================= */

/* Cloud Save Dropdown */
.cloud-save-dropdown {
    position: relative;
    display: inline-block;
}

.cloud-save-trigger {
    display: flex;
    align-items: center;
    gap: 6px;
}

.cloud-save-trigger svg {
    flex-shrink: 0;
}

.cloud-save-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 280px;
    background: var(--surface-secondary, #1a1a2e);
    border: 1px solid rgba(255, 248, 235, 0.1);
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s ease;
    z-index: 100;
    overflow: hidden;
}

.cloud-save-menu.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.cloud-save-menu-header {
    padding: 12px 16px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    border-bottom: 1px solid rgba(255, 248, 235, 0.08);
}

.cloud-save-option {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 14px 16px;
    background: transparent;
    border: none;
    text-align: left;
    color: var(--text-primary);
    cursor: pointer;
    transition: background 0.15s ease;
}

.cloud-save-option:hover {
    background: rgba(255, 248, 235, 0.06);
}

.cloud-save-option:active {
    background: rgba(255, 248, 235, 0.1);
}

.stage-icon {
    font-size: 20px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 248, 235, 0.06);
    border-radius: 8px;
}

.stage-icon.original {
    background: rgba(198, 168, 124, 0.15);
}

.stage-icon.edited {
    background: rgba(245, 158, 11, 0.15);
}

.stage-icon.production {
    background: rgba(16, 185, 129, 0.15);
}

.stage-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.stage-info strong {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
}

.stage-info span {
    font-size: 12px;
    color: var(--text-muted);
}

.cloud-save-menu-footer {
    padding: 12px 16px;
    border-top: 1px solid rgba(255, 248, 235, 0.08);
    background: rgba(0, 0, 0, 0.2);
}

.view-library-link {
    font-size: 13px;
    color: var(--accent-primary);
    text-decoration: none;
}

.view-library-link:hover {
    text-decoration: underline;
}

/* Cloud Saved Badge */
.cloud-saved-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    background: rgba(16, 185, 129, 0.15);
    color: #10b981;
    font-size: 11px;
    font-weight: 500;
    border-radius: 4px;
}

.cloud-saved-badge svg {
    flex-shrink: 0;
}

/* Cloud Save Notification */
.cloud-save-notification {
    position: fixed;
    bottom: 24px;
    right: 24px;
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px 20px;
    background: var(--surface-primary, #16213e);
    border: 1px solid rgba(16, 185, 129, 0.3);
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.3s ease;
    z-index: 1000;
}

.cloud-save-notification.show {
    opacity: 1;
    transform: translateY(0);
}

.cloud-save-notification .notification-content {
    display: flex;
    align-items: center;
    gap: 12px;
}

.cloud-save-notification .notification-content svg {
    color: #10b981;
    flex-shrink: 0;
}

.cloud-save-notification .notification-content strong {
    display: block;
    font-size: 14px;
    color: var(--text-primary);
}

.cloud-save-notification .notification-content p {
    margin: 0;
    font-size: 12px;
    color: var(--text-muted);
}

.cloud-save-notification .notification-content em {
    font-style: normal;
    color: #10b981;
    text-transform: capitalize;
}

.cloud-save-notification .notification-action {
    padding: 8px 16px;
    background: var(--accent-primary);
    color: white;
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
    border-radius: 6px;
    transition: opacity 0.15s ease;
}

.cloud-save-notification .notification-action:hover {
    opacity: 0.9;
}

/* ===== Image Studio Reference Images Box (matches prompt-box style) ===== */
.reference-images-box {
    margin-top: 32px;
    padding: 24px;
    border-radius: 16px;
}

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

.reference-images-box header h2 {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 16px;
    font-weight: 600;
    margin: 0;
}

.reference-images-box header h2 svg {
    color: var(--accent-primary);
}

.reference-images-box header span {
    font-size: 12px;
    color: var(--text-muted);
    background: var(--surface-secondary, rgba(255,255,255,0.05));
    padding: 4px 12px;
    border-radius: 20px;
}

/* Upload Area */
.reference-upload-area {
    flex-shrink: 0;
}

.upload-dropzone {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 28px 20px;
    border: 2px dashed var(--accent-primary);
    border-radius: 12px;
    background: rgba(var(--accent-primary-rgb, 79, 70, 229), 0.05);
    cursor: default;
    transition: all 0.2s ease;
    text-align: center;
}

.upload-dropzone:hover {
    border-color: var(--accent-primary);
    background: rgba(var(--accent-primary-rgb, 79, 70, 229), 0.05);
}

.upload-dropzone.dragover {
    border-color: var(--accent-primary);
    background: rgba(var(--accent-primary-rgb, 79, 70, 229), 0.1);
    transform: scale(1.02);
}

.upload-dropzone svg {
    color: var(--text-muted);
    opacity: 0.6;
}

.upload-dropzone:hover svg {
    color: var(--accent-primary);
    opacity: 1;
}

.upload-dropzone p {
    margin: 4px 0 0;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
}

.upload-dropzone span {
    font-size: 12px;
    color: var(--text-muted);
}

.upload-dropzone .button {
    margin-top: 10px;
    cursor: pointer;
    width: 100%;
    padding-inline: 10px;
    text-align: center;
}

.uploaded-rooms-panel {
    margin-top: 14px;
    padding: 12px;
    border: 1px solid var(--border-primary, rgba(255,255,255,0.08));
    border-radius: 12px;
    background: var(--surface-secondary, rgba(255,255,255,0.03));
}

.uploaded-rooms-modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 1401;
    background: rgba(0,0,0,0.66);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
}

.uploaded-rooms-modal-backdrop[hidden] {
    display: none;
}

.uploaded-rooms-panel.uploaded-rooms-modal {
    position: fixed;
    left: 50%;
    top: 50%;
    z-index: 1402;
    width: min(1120px, calc(100vw - 56px));
    max-height: min(92vh, 900px);
    margin: 0;
    padding: 0;
    overflow: hidden;
    transform: translate(-50%, -50%);
    display: flex;
    flex-direction: column;
    border-color: rgba(198,168,124,0.42);
    background: linear-gradient(180deg, rgba(24,20,16,0.99), rgba(10,8,6,0.99));
    box-shadow: 0 36px 100px rgba(0,0,0,0.72), 0 0 0 1px rgba(255,255,255,0.05) inset;
}

.uploaded-rooms-panel.uploaded-rooms-modal[hidden] {
    display: none;
}

.uploaded-rooms-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 10px;
}

.uploaded-rooms-modal .uploaded-rooms-panel-header {
    gap: 16px;
    margin: 0;
    padding: 20px 24px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}

.uploaded-rooms-panel-header h3 {
    margin: 0;
    font-size: 19px;
    font-weight: 700;
    color: var(--text-primary);
}

.uploaded-rooms-panel-header span {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.uploaded-rooms-panel-header .ghost-link.small {
    font-size: 11px;
    padding: 0;
}

.uploaded-rooms-modal-actions {
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.uploaded-rooms-modal-actions .ghost-link.small {
    padding: 8px 10px;
}

.uploaded-rooms-modal-close {
    width: 42px;
    height: 42px;
    border-radius: 10px;
    border: 1px solid rgba(255,255,255,0.12);
    background: rgba(255,255,255,0.035);
    color: rgba(245,238,226,0.72);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.uploaded-rooms-modal-close:hover {
    border-color: rgba(198,168,124,0.35);
    color: #c6a87c;
}

.uploaded-rooms-status {
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.4;
}

.uploaded-rooms-modal .uploaded-rooms-status {
    padding: 18px 24px;
}

.uploaded-rooms-status:empty {
    display: none;
}

.uploaded-rooms-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.uploaded-rooms-modal .uploaded-rooms-grid {
    grid-template-columns: repeat(auto-fill, minmax(148px, 1fr));
    grid-auto-rows: 148px;
    gap: 14px;
    min-height: 0;
    max-height: none;
    flex: 1 1 auto;
    overflow-y: auto;
    padding: 24px;
    align-content: start;
}

.uploaded-room-option {
    position: relative;
    min-width: 0;
    min-height: 0;
    width: 100%;
    height: 100%;
    aspect-ratio: 4 / 3;
    overflow: hidden;
    border: 1px solid var(--border-primary, rgba(255,255,255,0.08));
    border-radius: 10px;
    background: rgba(0,0,0,0.18);
    cursor: pointer;
    padding: 0;
    transition: border-color 0.15s ease, transform 0.15s ease;
}

.uploaded-room-option:hover {
    border-color: var(--accent-primary);
    transform: translateY(-1px);
}

.uploaded-room-option.is-selected {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 1px var(--accent-primary), 0 0 22px rgba(198,168,124,0.2);
}

.uploaded-room-option img {
    width: 100%;
    height: 100%;
    max-width: none;
    object-fit: cover;
    display: block;
    pointer-events: none;
}

.uploaded-room-check {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 24px;
    height: 24px;
    border-radius: 999px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transform: scale(0.9);
    color: #16110b;
    background: #c6a87c;
    box-shadow: 0 8px 18px rgba(0,0,0,0.35);
    font-size: 13px;
    font-weight: 800;
    transition: opacity 0.15s ease, transform 0.15s ease;
}

.uploaded-room-option.is-selected .uploaded-room-check {
    opacity: 1;
    transform: scale(1);
}

.uploaded-room-option .uploaded-room-name {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 16px 7px 6px;
    color: #fff;
    font-size: 10px;
    line-height: 1.2;
    text-align: left;
    background: linear-gradient(transparent, rgba(0,0,0,0.84));
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.uploaded-rooms-modal-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 14px 24px 18px;
    border-top: 1px solid rgba(255,255,255,0.08);
    background: rgba(0,0,0,0.18);
}

.uploaded-rooms-modal-footer span {
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.uploaded-rooms-modal-footer .button {
    width: auto;
    min-width: 96px;
    margin: 0;
}

/* Reference Images List */
.reference-images-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 12px;
    margin-top: 16px;
}

.reference-images-list:empty {
    display: none;
}

.reference-image-item {
    position: relative;
    aspect-ratio: 1;
    border-radius: 10px;
    overflow: hidden;
    background: var(--surface-secondary, rgba(255,255,255,0.03));
    border: 1px solid var(--border-primary, rgba(255,255,255,0.08));
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.reference-image-item:hover {
    transform: scale(1.03);
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

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

.reference-image-item .remove-reference-btn {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,0.7);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.15s ease, background 0.15s ease;
}

.reference-image-item:hover .remove-reference-btn {
    opacity: 1;
}

.reference-image-item .remove-reference-btn:hover {
    background: rgba(239, 68, 68, 0.9);
}

.reference-image-item .remove-reference-btn svg {
    color: white;
}

.reference-image-name {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 6px 8px;
    font-size: 10px;
    color: white;
    background: linear-gradient(transparent, rgba(0,0,0,0.8));
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Reference Panel Footer */
.reference-panel-footer {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--border-primary, rgba(255,255,255,0.08));
}

.reference-panel-footer .ghost-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--text-muted);
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px 0;
    transition: color 0.15s ease;
}

.reference-panel-footer .ghost-link:hover {
    color: var(--text-secondary);
}

.reference-panel-footer .ghost-link.danger:hover {
    color: #ef4444;
}

.reference-panel-footer .ghost-link svg {
    opacity: 0.7;
}

.reference-panel-footer .ghost-link:hover svg {
    opacity: 1;
}

/* Button Outline Small */
.button-outline {
    background: transparent;
    border: 1px solid var(--border-primary, rgba(255,255,255,0.2));
    color: var(--text-secondary);
}

.button-outline:hover {
    border-color: var(--accent-primary);
    color: var(--accent-primary);
    background: rgba(var(--accent-primary-rgb, 79, 70, 229), 0.1);
}

.button-small {
    padding: 8px 14px;
    font-size: 13px;
}

/* =====================================
   Image to Video Pipeline Styles
   ===================================== */

.video-pipeline-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 40px 32px;
}

.video-pipeline-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 32px;
}

.video-pipeline-header .back-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 14px;
    transition: color 0.2s ease;
}

.video-pipeline-header .back-link:hover {
    color: var(--text-primary);
}

.video-pipeline-header h1 {
    font-size: 28px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.video-pipeline-layout {
    display: grid;
    grid-template-columns: 400px 1fr;
    gap: 32px;
}

/* Source Panel */
.video-pipeline-source {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.source-image-preview {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 16px;
    overflow: hidden;
    border: 1px solid rgba(255, 248, 235, 0.08);
}

.source-image-preview img {
    width: 100%;
    display: block;
}

.source-image-info {
    padding: 16px;
    background: rgba(0, 0, 0, 0.2);
}

.source-image-title {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    margin: 0 0 8px 0;
}

.source-image-meta {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.source-image-meta span {
    font-size: 12px;
    color: var(--text-muted);
    padding: 4px 10px;
    background: rgba(255, 248, 235, 0.06);
    border-radius: 6px;
}

/* Storyboard Info Card */
.storyboard-info-card {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.1), rgba(198, 168, 124, 0.1));
    border: 1px solid rgba(139, 92, 246, 0.3);
    border-radius: 12px;
    padding: 20px;
}

.storyboard-info-card h4 {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #a78bfa;
    margin: 0 0 12px 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.storyboard-style-name {
    font-size: 16px;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.storyboard-style-description {
    font-size: 13px;
    color: var(--text-muted);
    line-height: 1.5;
}

/* Video Settings Panel */
.video-settings-panel {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 12px;
    padding: 20px;
    border: 1px solid rgba(255, 248, 235, 0.08);
}

.video-settings-panel h4 {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin: 0 0 16px 0;
}

.video-settings-grid {
    display: grid;
    gap: 16px;
}

.video-setting-row {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.video-setting-row label {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
}

.video-setting-row select,
.video-setting-row input {
    padding: 10px 12px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 248, 235, 0.1);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 14px;
}

.video-setting-row select:focus,
.video-setting-row input:focus {
    outline: none;
    border-color: var(--accent-primary);
}

/* Main Video Panel */
.video-pipeline-main {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

/* Generation Panel */
.video-generation-panel {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 16px;
    padding: 24px;
    border: 1px solid rgba(255, 248, 235, 0.08);
}

.generation-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.generation-panel-header h3 {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.video-prompt-section {
    margin-bottom: 20px;
}

.video-prompt-section label {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-muted);
    margin-bottom: 8px;
    display: block;
}

.video-prompt-section textarea {
    width: 100%;
    min-height: 100px;
    padding: 14px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 248, 235, 0.1);
    border-radius: 10px;
    color: var(--text-primary);
    font-size: 14px;
    line-height: 1.6;
    resize: vertical;
}

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

.prompt-helper-text {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 8px;
}

.generation-actions {
    display: flex;
    gap: 12px;
}

.generate-video-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 14px 28px;
    background: linear-gradient(135deg, #8b5cf6, #6366f1);
    border: none;
    border-radius: 10px;
    color: white;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.generate-video-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(139, 92, 246, 0.4);
}

.generate-video-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Results Section */
.video-results-section {
    background: rgba(0, 0, 0, 0.15);
    border-radius: 16px;
    padding: 24px;
    border: 1px solid rgba(255, 248, 235, 0.06);
    min-height: 300px;
}

.video-results-section h3 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 20px 0;
}

.video-results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

.video-result-card {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid rgba(255, 248, 235, 0.08);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.video-result-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.3);
}

.video-result-preview {
    aspect-ratio: 16/9;
    background: rgba(0, 0, 0, 0.4);
    position: relative;
    overflow: hidden;
}

.video-result-preview video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.video-result-processing {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    background: rgba(0, 0, 0, 0.7);
}

.video-processing-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(139, 92, 246, 0.2);
    border-top-color: #8b5cf6;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

.video-processing-text {
    font-size: 13px;
    color: var(--text-muted);
}

.video-result-info {
    padding: 16px;
}

.video-result-title {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    margin: 0 0 8px 0;
}

.video-result-meta {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}

.video-result-meta span {
    font-size: 11px;
    color: var(--text-muted);
    padding: 4px 8px;
    background: rgba(255, 248, 235, 0.06);
    border-radius: 4px;
}

.video-result-actions {
    display: flex;
    gap: 8px;
}

.video-result-actions button {
    flex: 1;
    padding: 8px 12px;
    background: rgba(255, 248, 235, 0.08);
    border: 1px solid rgba(255, 248, 235, 0.1);
    border-radius: 6px;
    color: var(--text-secondary);
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.video-result-actions button:hover {
    background: rgba(255, 248, 235, 0.12);
    color: var(--text-primary);
}

.empty-results {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.empty-results svg {
    width: 48px;
    height: 48px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.empty-results p {
    font-size: 14px;
    margin: 0;
}

/* Timeline Editor - Runway AI Transform Panel */
.timeline-editor-runway-controls {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin-top: 16px;
}

.timeline-editor-runway-field {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.timeline-editor-runway-field label {
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.02em;
}

.timeline-editor-runway-field small {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 4px;
}

.timeline-editor-runway-field textarea {
    resize: vertical;
    min-height: 80px;
    font-family: inherit;
}

.timeline-editor-runway-actions {
    margin-top: 8px;
}

.timeline-editor-runway-actions .button {
    width: 100%;
    padding: 12px 20px;
    border-radius: 8px;
    font-weight: 600;
}

.timeline-editor-runway-status {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    background: var(--surface-secondary);
    border-radius: 8px;
    margin-top: 16px;
    border-left: 3px solid var(--accent);
}

.runway-status-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent);
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

.timeline-editor-runway-status span {
    font-size: 13px;
    color: var(--text-primary);
}

@media (max-width: 1024px) {
    .video-pipeline-layout {
        grid-template-columns: 1fr;
    }
    
    .video-pipeline-source {
        order: -1;
    }
}

/* ======================================================================
   Pitch Composer
   ====================================================================== */

body.pitch-composer-page {
    background: radial-gradient(circle at 18% 115%, rgba(166, 124, 82, 0.07), transparent 42%),
                radial-gradient(circle at 82% -8%, rgba(198, 168, 124, 0.045), transparent 48%),
                linear-gradient(135deg, #07040f, #05030b 52%, #07040f 100%);
}

/* Grid placement — mirrors #prompt-composer rules in .home-layout */
.home-layout #pitch-composer-surface {
    width: 100%;
}

@media (min-width: 1200px) {
    /* Two-column layout matching the Composer page */
    body.pitch-composer-page .home-layout {
        grid-template-columns: minmax(340px, 460px) minmax(720px, 1fr);
        align-items: start;
    }

    .home-layout #pitch-composer-surface {
        grid-column: 2;
        max-width: none;
        margin-left: 0;
        margin-right: 0;
    }

    /* Hero stays in column 1, row 1 and sticks */
    body.pitch-composer-page .home-layout .hero {
        grid-column: 1;
        grid-row: 1;
        position: sticky;
        top: 100px;
    }

    /* Loading & results stay in column 2 — fill full width like Composer form */
    .home-layout .pitch-loading {
        grid-column: 2;
        max-width: none;
        margin-left: 0;
        margin-right: 0;
    }

    .home-layout .pitch-results {
        grid-column: 2;
        max-width: none;
        margin-left: 0;
        margin-right: 0;
    }
}

body.pitch-composer-page .content {
    padding-bottom: 80px;
}

/* Form card */
.pitch-composer-form-card {
    border-width: 4px;
    border-color: rgba(198, 168, 124, 0.95);
    box-shadow:
        0 0 24px rgba(198, 168, 124, 0.45),
        0 0 64px rgba(198, 168, 124, 0.35),
        var(--shadow-soft);
}
.pitch-composer-form-card::after {
    content: "";
    position: absolute;
    inset: -6px;
    border-radius: inherit;
    background:
        radial-gradient(circle at 20% 15%, rgba(111, 203, 255, 0.35), transparent 60%),
        radial-gradient(circle at 80% 80%, rgba(121, 106, 255, 0.32), transparent 65%);
    filter: blur(20px);
    opacity: 0.9;
    pointer-events: none;
    z-index: 0;
}
.pitch-composer-form-card > * {
    position: relative;
    z-index: 1;
}

/* Segment-grid inside pitch form — matches Composer's 3-column layout */
#pitch-composer-surface .segment-grid {
    gap: 18px;
}

@media (min-width: 1200px) {
    #pitch-composer-surface .segment-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 20px;
    }

    #pitch-composer-surface .segment-card.segment-wide {
        grid-column: span 2;
    }
}

.pitch-file-preview {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 10px;
    padding: 10px 14px;
    background: rgba(198, 168, 124, 0.08);
    border-radius: 10px;
    font-size: 13px;
    color: var(--text-secondary);
}

.pitch-file-preview span {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.pitch-form-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}

.pitch-generate-btn {
    display: inline-flex;
    align-items: center;
    font-size: 15px;
    font-weight: 600;
    padding: 14px 28px;
    border-radius: 999px;
    white-space: nowrap;
}

/* Loading state — blue-glow card matching Composer form card */
.pitch-loading {
    text-align: center;
    padding: clamp(28px, 4vw, 36px);
    width: 100%;
    border-width: 4px;
    border-color: rgba(198, 168, 124, 0.95);
    box-shadow:
        0 0 24px rgba(198, 168, 124, 0.45),
        0 0 64px rgba(198, 168, 124, 0.35),
        var(--shadow-soft);
}

.pitch-loading::after {
    content: "";
    position: absolute;
    inset: -6px;
    border-radius: inherit;
    background:
        radial-gradient(circle at 20% 15%, rgba(111, 203, 255, 0.35), transparent 60%),
        radial-gradient(circle at 80% 80%, rgba(121, 106, 255, 0.32), transparent 65%);
    filter: blur(20px);
    opacity: 0.9;
    pointer-events: none;
    z-index: 0;
}

.pitch-loading > * {
    position: relative;
    z-index: 1;
}

.pitch-loading-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}

.pitch-spinner {
    width: 48px;
    height: 48px;
    border: 3px solid rgba(198, 168, 124, 0.2);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: pitch-spin 0.8s linear infinite;
}

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

.pitch-loading h3 {
    font-size: 20px;
    margin: 0;
}

.pitch-loading p {
    color: var(--text-secondary);
    font-size: 14px;
    max-width: 420px;
    margin: 0;
}

/* Results area */
.pitch-results {
    display: flex;
    flex-direction: column;
    gap: 24px;
    width: 100%;
}

/* Deck header — blue-glow card matching Composer form card */
.pitch-deck-header {
    display: flex;
    flex-direction: column;
    gap: 20px;
    border-width: 4px;
    border-color: rgba(198, 168, 124, 0.95);
    box-shadow:
        0 0 24px rgba(198, 168, 124, 0.45),
        0 0 64px rgba(198, 168, 124, 0.35),
        var(--shadow-soft);
}

.pitch-deck-header::after {
    content: "";
    position: absolute;
    inset: -6px;
    border-radius: inherit;
    background:
        radial-gradient(circle at 20% 15%, rgba(111, 203, 255, 0.35), transparent 60%),
        radial-gradient(circle at 80% 80%, rgba(121, 106, 255, 0.32), transparent 65%);
    filter: blur(20px);
    opacity: 0.9;
    pointer-events: none;
    z-index: 0;
}

.pitch-deck-header > * {
    position: relative;
    z-index: 1;
}

.pitch-deck-header-content {
    flex: 1;
    min-width: 0;
}

.pitch-deck-header-content .eyebrow {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--accent);
    font-weight: 600;
}

.pitch-deck-header h2 {
    font-size: 26px;
    margin: 6px 0 0;
    font-family: 'Space Grotesk', 'Manrope', sans-serif;
}

.pitch-deck-meta {
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 8px;
}

.pitch-deck-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.pitch-deck-actions .button-outline {
    background: transparent;
    border: 1px solid rgba(198, 168, 124, 0.4);
    color: var(--text-secondary);
}

.pitch-deck-actions .button-outline:hover {
    border-color: var(--accent);
    color: var(--text-primary);
}

/* PPTX rendering glow + spinner */
.button.pptx-rendering {
    border-color: rgba(198, 168, 124, 0.95);
    background: rgba(198, 168, 124, 0.12);
    color: var(--text-primary);
    box-shadow:
        0 0 16px rgba(198, 168, 124, 0.5),
        0 0 40px rgba(198, 168, 124, 0.3);
    animation: pptx-glow-pulse 1.4s ease-in-out infinite;
    pointer-events: none;
}

@keyframes pptx-glow-pulse {
    0%, 100% {
        box-shadow:
            0 0 16px rgba(198, 168, 124, 0.5),
            0 0 40px rgba(198, 168, 124, 0.3);
    }
    50% {
        box-shadow:
            0 0 22px rgba(198, 168, 124, 0.7),
            0 0 56px rgba(198, 168, 124, 0.45);
    }
}

.pptx-spinner {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255, 248, 235, 0.25);
    border-top-color: #fff;
    border-radius: 50%;
    animation: pptx-spin 0.7s linear infinite;
    vertical-align: middle;
    margin-right: 6px;
}

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

/* Slide cards */
.pitch-slide-card {
    padding: clamp(24px, 3vw, 32px);
    margin-bottom: 0;
}

.pitch-slide-header {
    display: flex;
    align-items: baseline;
    gap: 14px;
    margin-bottom: 16px;
    border-bottom: 1px solid var(--border-soft);
    padding-bottom: 14px;
}

.pitch-slide-number {
    flex-shrink: 0;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--accent);
    background: rgba(198, 168, 124, 0.1);
    padding: 4px 10px;
    border-radius: 8px;
}

.pitch-slide-title {
    font-size: 18px;
    margin: 0;
    font-family: 'Space Grotesk', 'Manrope', sans-serif;
}

.pitch-slide-content {
    list-style: none;
    padding: 0;
    margin: 0 0 14px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.pitch-slide-content li {
    position: relative;
    padding-left: 18px;
    font-size: 14px;
    line-height: 1.65;
    color: var(--text-secondary);
}

.pitch-slide-content li::before {
    content: '—';
    position: absolute;
    left: 0;
    color: var(--accent);
    font-weight: 600;
}

/* Visual suggestions */
.pitch-slide-visuals {
    margin-top: 14px;
    padding: 14px 18px;
    background: rgba(198, 168, 124, 0.05);
    border-left: 3px solid rgba(198, 168, 124, 0.4);
    border-radius: 0 12px 12px 0;
}

.pitch-visual-label,
.pitch-notes-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.pitch-slide-visuals ul {
    list-style: disc;
    padding-left: 18px;
    margin: 0;
    font-size: 13px;
    color: var(--text-secondary);
}

.pitch-slide-visuals li {
    margin-bottom: 4px;
}

/* Speaker notes */
.pitch-slide-notes {
    margin-top: 14px;
    padding: 14px 18px;
    background: rgba(124, 184, 138, 0.04);
    border-left: 3px solid rgba(124, 184, 138, 0.35);
    border-radius: 0 12px 12px 0;
}

.pitch-slide-notes p {
    margin: 0;
    font-size: 13px;
    line-height: 1.6;
    color: var(--text-secondary);
    font-style: italic;
}

/* Assumptions & follow-up */
.pitch-assumptions,
.pitch-follow-up {
    padding: clamp(20px, 3vw, 28px);
}

.pitch-assumptions h3,
.pitch-follow-up h3 {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 16px;
    margin: 0 0 14px;
}

.pitch-assumptions ul,
.pitch-follow-up ul {
    list-style: disc;
    padding-left: 20px;
    margin: 0;
    font-size: 14px;
    line-height: 1.7;
    color: var(--text-secondary);
}

/* ── Multi-stage progress stepper ── */
.pitch-stepper {
    list-style: none;
    padding: 0;
    margin: 28px auto 0;
    display: flex;
    flex-direction: column;
    gap: 0;
    max-width: 480px;
    width: 100%;
    text-align: left;
}

.pitch-step {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    padding: 14px 0;
    position: relative;
    opacity: 0.45;
    transition: opacity 0.3s ease;
}

/* Vertical connector line */
.pitch-step:not(:last-child)::after {
    content: '';
    position: absolute;
    left: 15px;
    top: 42px;
    bottom: -2px;
    width: 2px;
    background: rgba(198, 168, 124, 0.15);
    transition: background 0.3s;
}

.pitch-step.done:not(:last-child)::after {
    background: rgba(124, 184, 138, 0.4);
}

.pitch-step.active,
.pitch-step.done {
    opacity: 1;
}

.pitch-step-indicator {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 2px solid rgba(198, 168, 124, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    position: relative;
    background: rgba(12, 18, 42, 0.6);
}

/* Active — pulsing ring */
.pitch-step.active .pitch-step-indicator {
    border-color: var(--accent);
    box-shadow: 0 0 0 4px rgba(198, 168, 124, 0.15);
    animation: pitch-pulse 1.2s ease-in-out infinite;
}

.pitch-step.active .pitch-step-indicator::after {
    content: '';
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--accent);
}

/* Done — green check */
.pitch-step.done .pitch-step-indicator {
    border-color: rgba(124, 184, 138, 0.6);
    background: rgba(124, 184, 138, 0.12);
}

.pitch-step.done .pitch-step-indicator::after {
    content: '';
    width: 10px;
    height: 6px;
    border-left: 2px solid #7cb88a;
    border-bottom: 2px solid #7cb88a;
    transform: rotate(-45deg) translate(1px, -1px);
}

/* Error — red X */
.pitch-step.error .pitch-step-indicator {
    border-color: rgba(242, 86, 86, 0.6);
    background: rgba(242, 86, 86, 0.12);
}

.pitch-step.error .pitch-step-indicator::after {
    content: '✕';
    color: #f25656;
    font-size: 14px;
    font-weight: bold;
}

@keyframes pitch-pulse {
    0%, 100% { box-shadow: 0 0 0 4px rgba(198, 168, 124, 0.12); }
    50%      { box-shadow: 0 0 0 8px rgba(198, 168, 124, 0.06); }
}

.pitch-step-body {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding-top: 4px;
}

.pitch-step-body strong {
    font-size: 14px;
    color: var(--text-primary);
}

.pitch-step-desc {
    font-size: 12px;
    color: var(--text-muted);
}

/* Live streaming text preview */
.pitch-step-live {
    margin: 8px 0 0;
    padding: 10px 14px;
    background: rgba(8, 11, 20, 0.7);
    border: 1px solid rgba(198, 168, 124, 0.15);
    border-radius: 10px;
    font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;
    font-size: 11px;
    line-height: 1.55;
    color: var(--text-muted);
    white-space: pre-wrap;
    word-break: break-word;
    max-height: 180px;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: thin;
    scrollbar-color: rgba(198, 168, 124, 0.3) transparent;
}

.pitch-step-live::-webkit-scrollbar {
    width: 5px;
}

.pitch-step-live::-webkit-scrollbar-track {
    background: transparent;
}

.pitch-step-live::-webkit-scrollbar-thumb {
    background: rgba(198, 168, 124, 0.3);
    border-radius: 4px;
}

.pitch-step-live[hidden] {
    display: none;
}

.pitch-loading-sub {
    color: var(--text-secondary);
    font-size: 14px;
    margin: 4px 0 0;
}

/* ── Confidence badges ── */
.pitch-conf-badge {
    display: inline-block;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 2px 8px;
    border-radius: 6px;
    margin-left: 8px;
    vertical-align: middle;
}

.conf-high {
    background: rgba(124, 184, 138, 0.12);
    color: #7cb88a;
}

.conf-med {
    background: rgba(255, 193, 7, 0.12);
    color: #ffc107;
}

.conf-low {
    background: rgba(242, 86, 86, 0.12);
    color: #f25656;
}

/* Slide subtitle */
.pitch-slide-subtitle {
    font-size: 14px;
    color: var(--accent);
    margin: 0 0 12px;
    font-weight: 500;
}

/* Visual prompt italicised */
.pitch-slide-visuals .visual-prompt {
    font-style: italic;
    color: var(--text-muted);
}

/* Responsive */
@media (max-width: 700px) {
    .pitch-form-row-pair {
        grid-template-columns: 1fr;
    }

    .pitch-deck-header {
        flex-direction: column;
    }

    .pitch-deck-actions {
        width: 100%;
    }

    .pitch-deck-actions .button {
        flex: 1;
        justify-content: center;
    }

    .pitch-form-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .pitch-generate-btn {
        justify-content: center;
    }
}

/* ── Clickable stepper steps ── */
.pitch-step.done {
    cursor: pointer;
}

.pitch-step.done:hover .pitch-step-body strong {
    color: var(--accent);
    text-decoration: underline;
}

.pitch-step.done .pitch-step-body::after {
    content: 'Click to view results';
    display: block;
    font-size: 11px;
    color: var(--text-muted);
    opacity: 0;
    transition: opacity 0.2s;
    margin-top: 2px;
}

.pitch-step.done:hover .pitch-step-body::after {
    opacity: 1;
}

/* ── Stage detail modal ── */
.pitch-modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(6px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.pitch-modal-overlay[hidden] {
    display: none;
}

.pitch-modal {
    background: var(--bg-card, #0e1225);
    border: 1px solid rgba(198, 168, 124, 0.35);
    border-radius: 20px;
    width: 100%;
    max-width: 720px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.6),
                0 0 0 1px rgba(198, 168, 124, 0.2);
    overflow: hidden;
}

.pitch-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid rgba(198, 168, 124, 0.15);
    flex-shrink: 0;
}

.pitch-modal-header h3 {
    margin: 0;
    font-size: 18px;
    font-family: 'Space Grotesk', 'Manrope', sans-serif;
}

.pitch-modal-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 28px;
    cursor: pointer;
    line-height: 1;
    padding: 0 4px;
    transition: color 0.2s;
}

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

.pitch-modal-body {
    overflow-y: auto;
    padding: 24px;
    font-size: 14px;
    line-height: 1.65;
    color: var(--text-secondary);
}

/* Modal content elements */
.pm-section {
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--accent);
    margin: 24px 0 10px;
    padding-bottom: 6px;
    border-bottom: 1px solid rgba(198, 168, 124, 0.12);
}

.pm-section:first-child {
    margin-top: 0;
}

.pm-kv {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.pm-kv tr {
    border-bottom: 1px solid rgba(255, 248, 235, 0.04);
}

.pm-kv td {
    padding: 6px 10px 6px 0;
    vertical-align: top;
}

.pm-kv-key {
    color: var(--text-muted);
    text-transform: capitalize;
    white-space: nowrap;
    width: 160px;
    font-weight: 600;
}

.pm-list {
    padding-left: 18px;
    margin: 4px 0;
}

.pm-list li {
    margin-bottom: 4px;
}

.pm-empty {
    color: var(--text-muted);
    font-style: italic;
    margin: 4px 0;
}

.pm-count {
    color: var(--text-muted);
    font-size: 13px;
    margin: 0 0 16px;
}

/* Color swatches */
.pm-swatches {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin: 8px 0;
}

.pm-swatch {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(12, 18, 42, 0.5);
    border: 1px solid rgba(255, 248, 235, 0.06);
    border-radius: 10px;
    padding: 8px 12px;
}

.pm-swatch-dot {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 1px solid rgba(255, 248, 235, 0.15);
    flex-shrink: 0;
}

.pm-swatch-label {
    font-size: 12px;
    text-transform: capitalize;
    color: var(--text-secondary);
}

.pm-swatch code {
    font-size: 11px;
    color: var(--text-muted);
}

/* Slide outline items in deck planner */
.pm-slide-outline {
    padding: 10px 14px;
    margin-bottom: 8px;
    background: rgba(12, 18, 42, 0.4);
    border-left: 3px solid rgba(198, 168, 124, 0.3);
    border-radius: 0 10px 10px 0;
}

.pm-slide-role {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
    background: rgba(198, 168, 124, 0.08);
    padding: 2px 8px;
    border-radius: 4px;
    margin-left: 6px;
}

.pm-slide-direction {
    margin: 4px 0 2px;
    font-weight: 600;
    color: var(--text-primary);
}

.pm-slide-purpose {
    margin: 0;
    font-size: 13px;
    color: var(--text-muted);
}

/* Slide cards in slide writer modal */
.pm-slide-card {
    padding: 14px 16px;
    margin-bottom: 10px;
    background: rgba(12, 18, 42, 0.35);
    border: 1px solid rgba(255, 248, 235, 0.05);
    border-radius: 12px;
}

.pm-slide-head {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 6px;
}

.pm-slide-num {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--accent);
    background: rgba(198, 168, 124, 0.1);
    padding: 2px 8px;
    border-radius: 6px;
}

.pm-key-msg {
    font-style: italic;
    color: var(--accent);
    margin: 2px 0 6px;
    font-size: 13px;
}

.pm-notes {
    margin-top: 8px;
    padding: 8px 12px;
    background: rgba(124, 184, 138, 0.04);
    border-left: 2px solid rgba(124, 184, 138, 0.3);
    border-radius: 0 8px 8px 0;
    font-size: 12px;
    font-style: italic;
    color: var(--text-muted);
}

.pm-notes-tag {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: rgba(124, 184, 138, 0.6);
    margin-right: 6px;
    font-style: normal;
}

/* ─── Creator Studio: 3-column workspace ─── */

body.creator-studio {
    background: #000000;
}

.creator-studio-workspace {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: 280px 1fr 320px;
    gap: 20px;
    align-items: stretch;
    min-height: calc(100vh - 175px);
}

@media (max-width: 1200px) {
    .creator-studio-workspace {
        grid-template-columns: 240px 1fr 280px;
        gap: 16px;
    }
}

@media (max-width: 960px) {
    .creator-studio-workspace {
        grid-template-columns: 1fr;
        min-height: auto;
    }
}

/* Shared panel chrome */
.cs-panel {
    display: flex;
    flex-direction: column;
    background: var(--bg-card);
    border: 4px solid rgba(198, 168, 124, 0.95);
    border-radius: 24px;
    box-shadow:
        0 0 24px rgba(198, 168, 124, 0.45),
        0 0 64px rgba(198, 168, 124, 0.35),
        var(--shadow-soft);
    backdrop-filter: var(--glass-blur);
    overflow: hidden;
    position: relative;
}

.cs-panel::before {
    content: "";
    position: absolute;
    inset: -6px;
    border-radius: inherit;
    background:
        radial-gradient(circle at 20% 15%, rgba(111, 203, 255, 0.35), transparent 60%),
        radial-gradient(circle at 80% 80%, rgba(121, 106, 255, 0.32), transparent 65%);
    filter: blur(20px);
    opacity: 0.9;
    pointer-events: none;
    z-index: 0;
}

/* Hide Studio Editing from desktop nav */
.nav-actions a[href="/studio-editing"] {
    display: none;
}

.cs-panel-header {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 18px 20px;
    border-bottom: 1px solid rgba(255, 248, 235, 0.06);
    flex-wrap: wrap;
}

.cs-panel-header h2 {
    font-size: 15px;
    font-weight: 600;
    letter-spacing: 0.01em;
    margin: 0;
    white-space: nowrap;
}

.cs-subtitle {
    font-size: 12px;
    color: var(--text-muted);
    flex: 1 1 100%;
}

/* LEFT: Clips panel */
.cs-clips-panel {
    border-color: rgba(168, 130, 255, 0.3);
}

.cs-clips-list {
    position: relative;
    z-index: 1;
    flex: 1 1 0;
    overflow-y: auto;
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    scrollbar-width: thin;
    scrollbar-color: rgba(198, 168, 124, 0.3) transparent;
}

.cs-clips-list .timeline-editor-row {
    min-width: 0;
    overflow: hidden;
    box-sizing: border-box;
    flex-shrink: 0;
}

.cs-clips-list .empty-state {
    text-align: center;
    padding: 32px 16px;
    color: var(--text-secondary);
}

.cs-clips-list .empty-state h3 {
    font-size: 14px;
    margin-bottom: 4px;
}

.cs-clips-list .empty-state p {
    font-size: 12px;
    color: var(--text-muted);
}

.cs-clips-footer {
    position: relative;
    z-index: 1;
    padding: 14px 16px;
    border-top: 1px solid rgba(255, 248, 235, 0.06);
}

.cs-save-btn {
    width: 100%;
    font-size: 13px;
}

/* CENTER: Player panel */
.cs-player-panel {
    border-color: rgba(168, 130, 255, 0.3);
    box-shadow:
        0 0 40px rgba(168, 130, 255, 0.08),
        0 0 80px rgba(168, 130, 255, 0.05);
}

.cs-player-panel .cs-panel-header {
    padding: 16px 24px;
}

.cs-player-panel .cs-panel-header .eyebrow {
    font-size: 10px;
    margin-bottom: 2px;
}

.cs-player-panel .cs-panel-header h2 {
    font-size: 16px;
}

.cs-panel-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.cs-panel-actions .button-ghost {
    background: transparent;
    border: 1px solid rgba(255, 248, 235, 0.15);
    color: var(--text-secondary);
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.cs-panel-actions .button-ghost:hover:not(:disabled) {
    background: rgba(255, 248, 235, 0.06);
    color: var(--text-primary);
    border-color: rgba(255, 248, 235, 0.25);
}

.cs-panel-actions .button-ghost:disabled {
    opacity: 0.35;
    cursor: default;
}

.cs-panel-actions .button-primary {
    background: var(--accent);
    border: 1px solid var(--accent);
    color: #fff;
    cursor: pointer;
    font-weight: 600;
    transition: background 0.15s ease, opacity 0.15s ease;
}

.cs-panel-actions .button-primary:hover:not(:disabled) {
    background: #4a6eff;
}

.cs-panel-actions .button-primary:disabled {
    opacity: 0.35;
    cursor: default;
}

/* Aggregation progress modal */
.aggregate-modal {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
}

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

.aggregate-modal.is-visible {
    opacity: 1;
    pointer-events: auto;
}

.aggregate-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(12, 10, 6, 0.88);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.aggregate-modal-dialog {
    position: relative;
    width: 100%;
    max-width: 480px;
    background: rgba(28, 24, 20, 0.95);
    border: 1px solid rgba(198, 168, 124, 0.2);
    border-radius: 24px;
    padding: 36px 32px;
    box-shadow: 0 32px 88px -36px rgba(5, 6, 18, 0.9);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    z-index: 1;
    display: flex;
    flex-direction: column;
    gap: 24px;
    transform: scale(0.95) translateY(16px);
    transition: transform 0.25s ease;
}

.aggregate-modal.is-visible .aggregate-modal-dialog {
    transform: scale(1) translateY(0);
}

.aggregate-modal-header {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.aggregate-modal-icon {
    color: var(--accent);
    opacity: 0.8;
    margin-bottom: 4px;
}

.aggregate-modal-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    letter-spacing: 0.02em;
}

.aggregate-modal-subtitle {
    font-size: 13px;
    color: var(--text-muted);
    margin: 0;
}

.aggregate-modal-body {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.aggregate-progress-bar {
    position: relative;
    height: 8px;
    border-radius: 999px;
    background: rgba(255, 248, 235, 0.08);
    overflow: hidden;
}

.aggregate-progress-fill {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    width: 0%;
    border-radius: 999px;
    background: linear-gradient(90deg, var(--accent), #a67c52);
    transition: width 0.4s ease;
}

.aggregate-progress-percent {
    text-align: center;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    letter-spacing: 0.04em;
}

.aggregate-stages {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.aggregate-stage {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    color: var(--text-muted);
    transition: color 0.2s ease;
}

.aggregate-stage.is-active {
    color: var(--text-primary);
}

.aggregate-stage.is-done {
    color: #4ade80;
}

.aggregate-stage.is-error {
    color: #f87171;
}

.aggregate-stage-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: rgba(255, 248, 235, 0.12);
    flex-shrink: 0;
    transition: background 0.2s ease, box-shadow 0.2s ease;
}

.aggregate-stage.is-active .aggregate-stage-dot {
    background: var(--accent);
    box-shadow: 0 0 8px rgba(198, 168, 124, 0.5);
    animation: aggregate-pulse 1.2s ease-in-out infinite;
}

.aggregate-stage.is-done .aggregate-stage-dot {
    background: #4ade80;
    box-shadow: none;
    animation: none;
}

.aggregate-stage.is-error .aggregate-stage-dot {
    background: #f87171;
    box-shadow: none;
    animation: none;
}

@keyframes aggregate-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

.cs-player-viewport {
    position: relative;
    z-index: 1;
    aspect-ratio: 16 / 9;
    background: rgba(5, 8, 20, 0.8);
    border-top: none;
}

.cs-player-viewport video {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

.cs-player-viewport video[hidden] {
    display: none;
}

.cs-player-empty {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: 10px;
    color: var(--text-secondary);
    pointer-events: none;
}

.cs-player-empty[hidden] {
    display: none;
}

.cs-player-empty svg {
    opacity: 0.25;
    margin-bottom: 4px;
}

.cs-player-empty h3 {
    font-size: 16px;
    font-weight: 500;
    margin: 0;
}

.cs-player-empty p {
    font-size: 13px;
    color: var(--text-muted);
    margin: 0;
}

/* RIGHT: Config panel */
.cs-config-panel {
    border-color: rgba(168, 130, 255, 0.3);
}

.cs-config-tabs {
    position: relative;
    z-index: 1;
    display: flex;
    flex-wrap: wrap;
    gap: 2px;
    padding: 8px 10px;
    border-bottom: 1px solid rgba(255, 248, 235, 0.06);
    background: rgba(0, 0, 0, 0.15);
}

.cs-config-tab {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 7px 10px;
    border: none;
    border-radius: 10px;
    background: transparent;
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.cs-config-tab:hover {
    color: var(--text-primary);
    background: rgba(255, 248, 235, 0.05);
}

.cs-config-tab.is-active {
    color: #fff;
    background: rgba(168, 130, 255, 0.2);
    box-shadow: 0 0 12px rgba(168, 130, 255, 0.15);
}

.cs-config-tab svg {
    flex-shrink: 0;
    opacity: 0.65;
}

.cs-config-tab.is-active svg {
    opacity: 1;
}

.cs-config-body {
    position: relative;
    z-index: 1;
    flex: 1 1 0;
    overflow-y: auto;
    padding: 16px;
    scrollbar-width: thin;
    scrollbar-color: rgba(168, 130, 255, 0.25) transparent;
}

.cs-config-body .timeline-editor-mode-panel {
    display: none;
}

.cs-config-body .timeline-editor-mode-panel.is-active {
    display: block;
}

/* Flatten inner padding for config panels */
.cs-config-body .timeline-editor-trim,
.cs-config-body .timeline-editor-crop,
.cs-config-body .timeline-editor-filters,
.cs-config-body .timeline-editor-adjust,
.cs-config-body .timeline-editor-text,
.cs-config-body .timeline-editor-runway {
    padding: 0;
    border: none;
    border-radius: 0;
}

.cs-config-body header {
    margin-bottom: 14px;
}

.cs-config-body h5 {
    font-size: 14px;
    font-weight: 600;
    margin: 0 0 4px;
}

.cs-config-body .timeline-editor-helper {
    font-size: 12px;
    line-height: 1.5;
    color: var(--text-muted);
    margin: 0;
}

.cs-config-body label span {
    font-size: 12px;
}

.cs-config-body select.control {
    padding: 8px 12px;
    height: auto;
    font-size: 13px;
    line-height: 1.4;
    border-radius: 10px;
}

.cs-config-body select.control.faux-select {
    color: var(--text-primary);
    background: rgba(8, 11, 20, 0.62);
    appearance: auto;
    -webkit-appearance: auto;
    -moz-appearance: auto;
    padding-right: 12px;
}

.cs-config-body .eyebrow {
    font-size: 10px;
}

.cs-config-body h4 {
    font-size: 13px;
    font-weight: 500;
    margin: 2px 0 10px;
    color: var(--text-secondary);
}

/* ══════════════════════════════════════════════════════════════════
   Renders Nav Button & Modal
   ══════════════════════════════════════════════════════════════════ */

/* Nav button */
.renders-nav-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    background: transparent;
    border: 1px solid transparent;
    color: var(--text-muted);
    font-size: 0;
    font-family: inherit;
    cursor: pointer;
    padding: 10px;
    border-radius: 999px;
    transition: all 0.24s ease;
    position: relative;
}
.renders-nav-btn:hover {
    background: rgba(198,168,124,0.12);
}
.renders-nav-label,
.renders-nav-count {
    display: none !important;
}

.renders-nav-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #c6a87c;
    box-shadow: 0 0 8px rgba(198,168,124,0.6), 0 0 16px rgba(198,168,124,0.25);
    animation: renders-pulse 1.6s ease-in-out infinite;
    flex-shrink: 0;
}
.renders-nav-dot.dot-idle {
    animation: none;
}
.renders-nav-dot.dot-done {
    background: #10b981;
    box-shadow: 0 0 5px rgba(16,185,129,0.5);
    animation: none;
}
.renders-nav-dot.dot-error {
    background: #f87171;
    box-shadow: 0 0 5px rgba(248,113,113,0.5);
    animation: none;
}

@keyframes renders-pulse {
    0%,100% { opacity:1; transform:scale(1); }
    50%     { opacity:.35; transform:scale(.85); }
}

.renders-nav-count {
    background: var(--accent, #c6a87c);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    min-width: 16px;
    height: 16px;
    line-height: 16px;
    text-align: center;
    border-radius: 8px;
    padding: 0 4px;
}

/* Modal overlay */
.renders-modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 9500;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,0.7);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}
.renders-modal-overlay[hidden] { display: none; }

/* Modal dialog */
.renders-modal {
    background: var(--bg-card, #111827);
    border: 1px solid rgba(93,135,255,0.2);
    border-radius: 20px;
    width: 94vw;
    max-width: 1000px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: gen-stages-slide-up 0.25s ease-out;
}

/* Header */
.renders-modal-header {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 18px 24px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}
.renders-modal-header h3 {
    margin: 0;
    font-size: 17px;
    white-space: nowrap;
}
.renders-modal-close {
    margin-left: auto;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 24px;
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
}
.renders-modal-close:hover { color: var(--text-primary); }

/* Two-panel layout */
.renders-two-panel {
    display: flex;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

/* Sidebar */
.renders-sidebar {
    width: 280px;
    min-width: 280px;
    border-right: 1px solid rgba(255,255,255,0.08);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.renders-sidebar-header {
    padding: 12px 16px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
}
.renders-sidebar-label {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-muted, rgba(255,255,255,0.4));
}
.renders-project-list {
    overflow-y: auto;
    flex: 1;
    padding: 8px;
}

/* Project items */
.renders-project-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 14px;
    border-radius: 12px;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s;
    border: 1px solid transparent;
    margin-bottom: 4px;
}
.renders-project-item:hover {
    background: rgba(255,255,255,0.04);
}
.renders-project-item.is-active {
    background: rgba(198, 168, 124, 0.1);
    border-color: rgba(198, 168, 124, 0.25);
}
.renders-project-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.renders-project-title {
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.renders-project-meta {
    font-size: 11px;
    color: var(--text-muted, rgba(255,255,255,0.4));
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.renders-project-chevron {
    flex-shrink: 0;
    opacity: 0.3;
    transition: opacity 0.2s;
}
.renders-project-item:hover .renders-project-chevron,
.renders-project-item.is-active .renders-project-chevron {
    opacity: 0.7;
}

/* Main panel */
.renders-main-panel {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.renders-main-placeholder {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--text-muted, rgba(255,255,255,0.4));
    font-size: 14px;
}
.renders-images-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.renders-images-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
}
.renders-back-btn {
    display: none;
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 8px;
    color: var(--text-secondary);
    width: 32px;
    height: 32px;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}
.renders-project-name {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.renders-image-count {
    font-size: 12px;
    color: var(--text-muted, rgba(255,255,255,0.4));
    margin-left: auto;
    white-space: nowrap;
}

/* Image grid */
.renders-image-grid {
    overflow-y: auto;
    flex: 1;
    padding: 16px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 14px;
    align-content: start;
}

/* Image card */
.renders-img-card {
    border-radius: 14px;
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.06);
    overflow: hidden;
    transition: border-color 0.2s, transform 0.2s;
}
.renders-img-card:hover {
    border-color: rgba(198, 168, 124, 0.25);
    transform: translateY(-2px);
}
.renders-img-card.is-processing {
    border-color: rgba(129, 140, 248, 0.25);
}
.renders-img-card.is-failed {
    border-color: rgba(248, 113, 113, 0.25);
}

/* Image thumbnail */
.renders-img-thumb {
    width: 100%;
    aspect-ratio: 1;
    background: rgba(12,18,42,0.4);
    overflow: hidden;
    position: relative;
}
.renders-img-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Processing state */
.renders-img-processing {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: rgba(12,18,42,0.7);
    color: #818cf8;
    font-size: 11px;
    text-align: center;
    padding: 12px;
}
.renders-img-spinner {
    width: 28px;
    height: 28px;
    border: 3px solid rgba(129, 140, 248, 0.2);
    border-top-color: #818cf8;
    border-radius: 50%;
    animation: renders-spin 0.8s linear infinite;
}
@keyframes renders-spin {
    to { transform: rotate(360deg); }
}
.renders-img-pct {
    font-weight: 700;
    font-size: 14px;
}

/* Failed state */
.renders-img-failed {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    background: rgba(42,12,12,0.5);
    color: #f87171;
    font-size: 11px;
    text-align: center;
    padding: 12px;
}

/* Image info */
.renders-img-info {
    padding: 10px 12px;
    display: flex;
    flex-direction: column;
    gap: 3px;
}
.renders-img-name {
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.renders-img-meta {
    font-size: 10px;
    color: var(--text-muted, rgba(255,255,255,0.4));
}

/* Image actions */
.renders-img-actions {
    display: flex;
    gap: 6px;
    margin-top: 4px;
}
.renders-img-action {
    background: rgba(255,255,255,0.06);
    border: none;
    color: var(--text-secondary);
    font-size: 11px;
    padding: 4px 10px;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}
.renders-img-action:hover {
    background: var(--accent, #c6a87c);
    color: #fff;
}

/* Mobile: stack layout */
@media (max-width: 680px) {
    .renders-modal {
        max-width: 100vw;
        width: 100vw;
        max-height: 100vh;
        height: 100vh;
        border-radius: 0;
    }
    .renders-two-panel {
        flex-direction: column;
    }
    .renders-sidebar {
        width: 100%;
        min-width: 0;
        border-right: none;
        border-bottom: 1px solid rgba(255,255,255,0.08);
    }
    .renders-sidebar.is-hidden-mobile {
        display: none;
    }
    .renders-main-panel {
        display: none;
    }
    .renders-main-panel.is-visible-mobile {
        display: flex;
    }
    .renders-back-btn {
        display: flex;
    }
    .renders-image-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    }
}

/* ==========================================================================
   LIGHT THEME
   ========================================================================== */

/* Theme toggle button */
.theme-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 1px solid rgba(198, 168, 124, 0.3);
    background: rgba(28, 24, 20, 0.6);
    color: var(--text-secondary);
    cursor: pointer;
    transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
    flex-shrink: 0;
    margin-right: 4px;
}
.theme-toggle:hover {
    background: rgba(198, 168, 124, 0.15);
    border-color: rgba(198, 168, 124, 0.5);
    color: var(--text-primary);
}
.theme-toggle svg { pointer-events: none; }
.theme-toggle .icon-sun { display: none; }
.theme-toggle .icon-moon { display: block; }
[data-theme="light"] .theme-toggle .icon-sun { display: block; }
[data-theme="light"] .theme-toggle .icon-moon { display: none; }

/* ── Light theme CSS custom property overrides ── */
[data-theme="light"] {
    --bg-primary: #f8f6f3;
    --bg-secondary: rgba(245, 242, 238, 0.92);
    --bg-card: rgba(255, 255, 255, 0.88);
    --bg-card-alt: rgba(250, 248, 245, 0.80);
    --border-soft: rgba(180, 160, 130, 0.18);
    --border-highlight: rgba(168, 138, 98, 0.6);
    --text-primary: #1a1714;
    --text-secondary: rgba(40, 34, 26, 0.72);
    --text-muted: rgba(90, 78, 62, 0.56);
    --accent: #a6854e;
    --accent-primary: #a6854e;
    --accent-primary-rgb: 166, 133, 78;
    --accent-strong: #8a6d3a;
    --success: #3d8c50;
    --success-rgb: 61, 140, 80;
    --danger: #c43030;
    --danger-rgb: 196, 48, 48;
    --shadow-soft: 0 8px 30px -12px rgba(120, 100, 70, 0.12);
    --shadow-intense: 0 16px 44px -16px rgba(100, 80, 50, 0.16);
    --glass-blur: saturate(110%) blur(18px);
    color-scheme: light;
}

/* ── Body & html backgrounds ── */
[data-theme="light"] html,
[data-theme="light"] body {
    background: #f8f6f3;
    color: var(--text-primary);
}
[data-theme="light"] body {
    background: radial-gradient(circle at 20% 120%, rgba(198, 168, 124, 0.08), transparent 40%),
                radial-gradient(circle at 80% -10%, rgba(166, 124, 82, 0.06), transparent 46%),
                linear-gradient(135deg, #f8f6f3, #f0ece6 48%, #f8f6f3 100%);
}
[data-theme="light"] body.composer,
[data-theme="light"] body.pipeline,
[data-theme="light"] body.studio-editing {
    background: radial-gradient(circle at 18% 115%, rgba(198, 168, 124, 0.05), transparent 42%),
                radial-gradient(circle at 82% -8%, rgba(166, 124, 82, 0.03), transparent 48%),
                linear-gradient(135deg, #f5f2ee, #ece8e2 52%, #f5f2ee 100%);
}
[data-theme="light"] body.library {
    background: radial-gradient(circle at 18% 115%, rgba(198, 168, 124, 0.04), transparent 42%),
                radial-gradient(circle at 82% -8%, rgba(166, 124, 82, 0.02), transparent 48%),
                linear-gradient(135deg, #f2efeb, #e8e4de 52%, #f2efeb 100%);
}

/* ── Selection ── */
[data-theme="light"] ::selection {
    background: rgba(var(--accent-primary-rgb), 0.22);
    color: var(--text-primary);
}

/* ── Nav bar ── */
[data-theme="light"] .top-nav {
    background: rgba(255, 250, 244, 0.78);
    border-color: rgba(180, 160, 130, 0.28);
    box-shadow: 0 18px 40px -22px rgba(60, 45, 25, 0.18);
}
[data-theme="light"] .top-nav.scrolled {
    background: rgba(255, 250, 244, 0.94);
    border-color: rgba(180, 160, 130, 0.42);
}
[data-theme="light"] .nav-actions a::after { background: var(--accent); }
[data-theme="light"] .brand.brand-home {
    background: rgba(255, 255, 255, 0.96);
    border-color: rgba(180, 160, 130, 0.2);
    box-shadow: 0 4px 12px -6px rgba(120, 100, 70, 0.12);
}
[data-theme="light"] .brand.brand-home:hover {
    background: #ffffff;
    box-shadow: 0 6px 16px -6px rgba(120, 100, 70, 0.18);
}
[data-theme="light"] .nav-actions a {
    color: var(--text-muted);
}
[data-theme="light"] .nav-actions a.primary-action {
    color: var(--text-primary);
}
[data-theme="light"] .theme-toggle {
    background: rgba(240, 236, 230, 0.8);
    border-color: rgba(180, 160, 130, 0.25);
}
[data-theme="light"] .theme-toggle:hover {
    background: rgba(198, 168, 124, 0.12);
}

/* ── Avatar ── */
[data-theme="light"] .avatar-button {
    background: linear-gradient(135deg, #e8e2d8, #d8d0c4);
    color: var(--text-primary);
    border-color: rgba(180, 160, 130, 0.3);
}
[data-theme="light"] .account-dropdown {
    background: rgba(255, 255, 255, 0.96);
    border-color: rgba(180, 160, 130, 0.2);
    box-shadow: 0 12px 36px -12px rgba(100, 80, 50, 0.18);
}
[data-theme="light"] .account-dropdown a {
    color: var(--text-primary);
}
[data-theme="light"] .account-dropdown a:hover {
    background: rgba(198, 168, 124, 0.1);
}

/* ── Surfaces ── */
[data-theme="light"] .surface {
    background: rgba(255, 255, 255, 0.82);
    border-color: rgba(180, 160, 130, 0.15);
    box-shadow: 0 4px 20px -8px rgba(120, 100, 70, 0.08);
}
[data-theme="light"] .surface::after {
    display: none;
}

/* ── Segment cards ── */
[data-theme="light"] .segment-card {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.7), rgba(248, 245, 240, 0.6));
    border-color: rgba(180, 160, 130, 0.18);
}

/* ── Select wrappers / faux-select ── */
[data-theme="light"] .select-wrapper {
    background: linear-gradient(140deg, rgba(180, 160, 130, 0.25), rgba(166, 145, 110, 0.12));
    box-shadow: 0 4px 12px -6px rgba(120, 100, 70, 0.1);
}
[data-theme="light"] .select-wrapper::before {
    background: linear-gradient(150deg, rgba(255, 255, 255, 0.96), rgba(250, 248, 245, 0.92));
}
[data-theme="light"] .select-wrapper:hover {
    box-shadow: 0 6px 18px -8px rgba(166, 133, 78, 0.18);
}
[data-theme="light"] .select-wrapper:focus-within {
    background: linear-gradient(140deg, rgba(166, 133, 78, 0.35), rgba(166, 133, 78, 0.2));
    box-shadow: 0 8px 22px -8px rgba(166, 133, 78, 0.22);
}
[data-theme="light"] .select-value {
    background: linear-gradient(140deg, rgba(255, 255, 255, 0.96), rgba(250, 248, 245, 0.93));
    border-color: rgba(180, 160, 130, 0.12);
    color: var(--text-primary);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.5);
}
[data-theme="light"] .faux-select:focus + .select-value {
    background: linear-gradient(140deg, rgba(255, 255, 255, 0.98), rgba(252, 250, 248, 0.96));
    border-color: rgba(166, 133, 78, 0.25);
}
[data-theme="light"] .faux-select option {
    color: #1a1714;
    background: #ffffff;
}

/* ── Buttons ── */
[data-theme="light"] .button {
    color: #fff;
    box-shadow: 0 8px 20px -10px rgba(var(--accent-primary-rgb), 0.45);
}
[data-theme="light"] .button:hover {
    box-shadow: 0 12px 28px -10px rgba(var(--accent-primary-rgb), 0.55);
}
[data-theme="light"] .button-outline {
    border-color: rgba(166, 133, 78, 0.4);
    color: var(--text-primary);
}
[data-theme="light"] .button-outline:hover {
    background: rgba(166, 133, 78, 0.08);
}
[data-theme="light"] .ghost-button {
    border-color: rgba(166, 133, 78, 0.25);
    background: rgba(166, 133, 78, 0.04);
    color: var(--text-primary);
}
[data-theme="light"] .ghost-button:hover {
    border-color: rgba(166, 133, 78, 0.5);
    background: rgba(166, 133, 78, 0.08);
}

/* ── Inputs & textareas ── */
[data-theme="light"] textarea.control,
[data-theme="light"] input.control,
[data-theme="light"] .control {
    background: rgba(255, 255, 255, 0.8);
    border-color: rgba(180, 160, 130, 0.2);
    color: var(--text-primary);
}
[data-theme="light"] textarea.control:focus,
[data-theme="light"] input.control:focus,
[data-theme="light"] .control:focus {
    border-color: rgba(166, 133, 78, 0.4);
    background: rgba(255, 255, 255, 0.95);
}
[data-theme="light"] textarea.control::placeholder,
[data-theme="light"] input.control::placeholder {
    color: rgba(90, 78, 62, 0.4);
}

/* ── Modals ── */
[data-theme="light"] .refine-modal-dialog {
    background: rgba(255, 255, 255, 0.96);
    border-color: rgba(180, 160, 130, 0.2);
    box-shadow: 0 24px 64px -24px rgba(80, 60, 30, 0.2);
}
[data-theme="light"] .refine-modal-close {
    background: rgba(0, 0, 0, 0.05);
    color: var(--text-primary);
}
[data-theme="light"] .refine-modal-close:hover {
    background: rgba(0, 0, 0, 0.1);
}
[data-theme="light"] .refine-modal-original,
[data-theme="light"] .refine-modal-refined {
    background: rgba(245, 242, 238, 0.6);
    border-color: rgba(180, 160, 130, 0.15);
}
[data-theme="light"] .refine-modal-refined {
    border-color: rgba(166, 133, 78, 0.35);
    background: rgba(166, 133, 78, 0.06);
}

/* ── Modal: New Project fields ── */
[data-theme="light"] .np-input {
    background: rgba(255, 255, 255, 0.9);
    border-color: rgba(180, 160, 130, 0.2);
    color: var(--text-primary);
}
[data-theme="light"] .np-input:focus {
    border-color: rgba(166, 133, 78, 0.4);
}
[data-theme="light"] .np-radio-option {
    border-color: rgba(180, 160, 130, 0.18);
    background: rgba(255, 255, 255, 0.6);
}
[data-theme="light"] .np-radio-option:hover {
    background: rgba(245, 242, 238, 0.8);
}
[data-theme="light"] .np-divider {
    border-color: rgba(180, 160, 130, 0.15);
}

/* ── Gen modal / generation tracker ── */
[data-theme="light"] .gen-modal-dialog,
[data-theme="light"] .gen-image-grid .gen-image-card {
    background: rgba(255, 255, 255, 0.94);
    border-color: rgba(180, 160, 130, 0.15);
}
[data-theme="light"] .gen-phase-progress {
    background: rgba(245, 242, 238, 0.8);
}

/* ── Segment helpers & labels ── */
[data-theme="light"] .segment-helper {
    color: rgba(90, 78, 62, 0.55);
}
[data-theme="light"] .segment-chip {
    background: rgba(166, 133, 78, 0.1);
    color: rgba(120, 96, 58, 0.8);
}
[data-theme="light"] .segment-chip.accent {
    background: rgba(166, 133, 78, 0.15);
    color: var(--accent-strong);
}

/* ── Reference panel / dropzone ── */
[data-theme="light"] .dropzone,
[data-theme="light"] .reference-images-dropzone {
    background: rgba(245, 242, 238, 0.6);
    border-color: rgba(180, 160, 130, 0.25);
}
[data-theme="light"] .dropzone:hover,
[data-theme="light"] .reference-images-dropzone:hover {
    background: rgba(245, 242, 238, 0.9);
    border-color: rgba(166, 133, 78, 0.4);
}

/* ── Prompt status ── */
[data-theme="light"] .prompt-status {
    color: var(--text-secondary);
}
[data-theme="light"] .prompt-status.error {
    color: var(--danger);
}

/* ── History / results cards ── */
[data-theme="light"] .history-card,
[data-theme="light"] .result-card {
    background: rgba(255, 255, 255, 0.75);
    border-color: rgba(180, 160, 130, 0.15);
}

/* ── Account & settings pages ── */
[data-theme="light"] .account-card,
[data-theme="light"] .settings-card,
[data-theme="light"] .subscription-card {
    background: rgba(255, 255, 255, 0.8);
    border-color: rgba(180, 160, 130, 0.15);
}

/* ── Ghost links ── */
[data-theme="light"] .ghost-link {
    color: var(--text-secondary);
}
[data-theme="light"] .ghost-link:hover {
    color: var(--text-primary);
}
[data-theme="light"] .ghost-link.danger {
    color: var(--danger);
}

/* ── Login / signup pages ── */
[data-theme="light"] .login-card,
[data-theme="light"] .login-form input[type="email"],
[data-theme="light"] .login-form input[type="password"],
[data-theme="light"] .login-form input[type="text"] {
    background: rgba(255, 255, 255, 0.9);
    border-color: rgba(180, 160, 130, 0.2);
    color: var(--text-primary);
}

/* ── Cloud library thumbnails & image cards ── */
[data-theme="light"] .image-card,
[data-theme="light"] .cloud-image-card {
    background: rgba(255, 255, 255, 0.8);
    border-color: rgba(180, 160, 130, 0.12);
    box-shadow: 0 2px 8px -4px rgba(120, 100, 70, 0.08);
}

/* ── Scrollbar ── */
[data-theme="light"] ::-webkit-scrollbar-track {
    background: rgba(245, 242, 238, 0.6);
}
[data-theme="light"] ::-webkit-scrollbar-thumb {
    background: rgba(180, 160, 130, 0.3);
    border-radius: 4px;
}
[data-theme="light"] ::-webkit-scrollbar-thumb:hover {
    background: rgba(180, 160, 130, 0.5);
}

/* ── Project selector custom overrides ── */
[data-theme="light"] .project-actions-row .select-value {
    background: linear-gradient(140deg, rgba(255, 255, 255, 0.94), rgba(250, 248, 244, 0.90));
}

/* ── Render / result cards ── */
[data-theme="light"] .render-card {
    background: rgba(255, 255, 255, 0.85);
    border-color: rgba(180, 160, 130, 0.15);
}

/* ── Renders modal (two-panel) light overrides ── */
[data-theme="light"] .renders-modal {
    background: #faf8f4;
    border-color: rgba(180, 160, 130, 0.2);
}
[data-theme="light"] .renders-modal-header {
    border-bottom-color: rgba(180, 160, 130, 0.15);
}
[data-theme="light"] .renders-sidebar {
    border-right-color: rgba(180, 160, 130, 0.15);
}
[data-theme="light"] .renders-sidebar-header {
    border-bottom-color: rgba(180, 160, 130, 0.1);
}
[data-theme="light"] .renders-project-item:hover {
    background: rgba(180, 160, 130, 0.08);
}
[data-theme="light"] .renders-project-item.is-active {
    background: rgba(138, 109, 59, 0.08);
    border-color: rgba(138, 109, 59, 0.2);
}
[data-theme="light"] .renders-images-header {
    border-bottom-color: rgba(180, 160, 130, 0.1);
}
[data-theme="light"] .renders-img-card {
    background: rgba(255, 255, 255, 0.85);
    border-color: rgba(180, 160, 130, 0.15);
}
[data-theme="light"] .renders-img-card:hover {
    border-color: rgba(138, 109, 59, 0.3);
}
[data-theme="light"] .renders-img-thumb {
    background: rgba(240, 235, 228, 0.6);
}
[data-theme="light"] .renders-img-action {
    background: rgba(0, 0, 0, 0.04);
    color: var(--text-secondary);
}
[data-theme="light"] .renders-img-action:hover {
    background: #8a6d3b;
    color: #fff;
}

/* ── Feed cards ── */
[data-theme="light"] .feed-card {
    background: rgba(255, 255, 255, 0.8);
    border-color: rgba(180, 160, 130, 0.12);
}

/* ── Misc hardcoded dark backgrounds ── */
[data-theme="light"] .brand-logo {
    border-color: var(--accent);
    box-shadow: 0 0 8px rgba(var(--accent-primary-rgb), 0.2);
}

/* ── Splash / onboarding ── */
[data-theme="light"] .splash-card {
    background: rgba(255, 255, 255, 0.92);
    border-color: rgba(180, 160, 130, 0.15);
}

/* ── Tabs ── */
[data-theme="light"] .tab-bar,
[data-theme="light"] .tabs {
    background: rgba(245, 242, 238, 0.6);
    border-color: rgba(180, 160, 130, 0.12);
}
[data-theme="light"] .tab-bar button,
[data-theme="light"] .tabs button {
    color: var(--text-muted);
}
[data-theme="light"] .tab-bar button.active,
[data-theme="light"] .tabs button.active {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.8);
}

/* ── Credit badge / usage bars ── */
[data-theme="light"] .credit-badge {
    background: rgba(245, 242, 238, 0.8);
    border-color: rgba(180, 160, 130, 0.2);
}

/* ── Tooltip & chip overrides ── */
[data-theme="light"] .tooltip,
[data-theme="light"] [role="tooltip"] {
    background: rgba(30, 26, 22, 0.92);
    color: #faf6f0;
}

/* ═══════════════════════════════════════════════════════════════════════════
   SLIDESHOW MODAL — Full-screen premium design presentation
   ═══════════════════════════════════════════════════════════════════════════ */

.slideshow-modal {
    position: fixed;
    inset: 0;
    z-index: 10000;
    background: #0a0908;
    display: flex;
    flex-direction: column;
    color: #e8e0d6;
    font-family: inherit;
    animation: ss-fade-in 0.35s ease;
}
.slideshow-modal[hidden] { display: none !important; }

@keyframes ss-fade-in {
    from { opacity: 0; }
    to   { opacity: 1; }
}

/* ── Header ── */
.ss-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 24px;
    background: rgba(15, 13, 11, 0.85);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(198, 168, 124, 0.12);
    flex-shrink: 0;
}
.ss-header-left {
    display: flex;
    align-items: center;
    gap: 14px;
}
.ss-title {
    font-size: 15px;
    font-weight: 600;
    letter-spacing: 0.02em;
    margin: 0;
    color: #c6a87c;
}
.ss-counter {
    font-size: 13px;
    color: rgba(232, 224, 214, 0.55);
}
.ss-model-badge {
    font-size: 11px;
    padding: 3px 10px;
    border-radius: 20px;
    background: rgba(198, 168, 124, 0.12);
    color: #c6a87c;
    letter-spacing: 0.04em;
}
.ss-header-right {
    display: flex;
    align-items: center;
    gap: 8px;
}
.ss-header-btn {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    color: #e8e0d6;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s;
}
.ss-header-btn:hover {
    background: rgba(198, 168, 124, 0.15);
    border-color: rgba(198, 168, 124, 0.3);
}

/* ── Stage ── */
.ss-stage {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    min-height: 0;
    padding: 16px 60px;
    overflow: hidden;
}

/* Nav arrows */
.ss-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 3;
    background: rgba(15, 13, 11, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 50%;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #e8e0d6;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s, opacity 0.2s;
    opacity: 0.6;
}
.ss-nav:hover {
    background: rgba(198, 168, 124, 0.2);
    border-color: rgba(198, 168, 124, 0.35);
    opacity: 1;
}
.ss-nav-prev { left: 16px; }
.ss-nav-next { right: 16px; }
.ss-nav:disabled {
    opacity: 0.15;
    pointer-events: none;
}

/* Image container */
.ss-image-container {
    position: relative;
    max-width: 85%;
    max-height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    overflow: hidden;
}
.ss-image-glow {
    position: absolute;
    inset: -30%;
    background: radial-gradient(circle, rgba(198, 168, 124, 0.06) 0%, transparent 70%);
    pointer-events: none;
    z-index: 0;
}
.ss-main-image {
    position: relative;
    z-index: 1;
    max-width: 100%;
    max-height: calc(100vh - 240px);
    min-height: 320px;
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 12px;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.5), 0 0 80px rgba(198, 168, 124, 0.05);
    transition: opacity 0.45s ease;
}
.ss-main-image-next {
    z-index: 2;
    pointer-events: none;
}

/* Floating image toolbar */
.ss-image-toolbar {
    position: absolute;
    bottom: 16px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 5;
    display: flex;
    gap: 6px;
    padding: 8px 12px;
    background: rgba(15, 13, 11, 0.8);
    backdrop-filter: blur(16px);
    border: 1px solid rgba(198, 168, 124, 0.15);
    border-radius: 12px;
    opacity: 0;
    transition: opacity 0.25s ease;
}
.ss-image-container:hover .ss-image-toolbar {
    opacity: 1;
}
.ss-tool-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    color: #e8e0d6;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.2s, border-color 0.2s, color 0.2s;
}
.ss-tool-btn:hover {
    background: rgba(198, 168, 124, 0.2);
    border-color: rgba(198, 168, 124, 0.35);
    color: #c6a87c;
}
.ss-tool-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(255, 255, 255, 0.06);
    color: rgba(232, 224, 214, 0.55);
}
.ss-tool-btn:disabled:hover {
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(255, 255, 255, 0.06);
    color: rgba(232, 224, 214, 0.55);
}
.ss-tool-toggle.active {
    background: rgba(198, 168, 124, 0.25);
    border-color: rgba(198, 168, 124, 0.45);
    color: #c6a87c;
}
.ss-tool-fav.is-fav {
    background: rgba(198, 168, 124, 0.2);
    border-color: rgba(198, 168, 124, 0.4);
    color: #c6a87c;
}
.ss-tool-fav.is-fav svg {
    fill: #c6a87c;
    stroke: #c6a87c;
}
.ss-tool-fav svg {
    transition: fill 0.2s, stroke 0.2s;
}
/* Slideshow favorite star overlay */
.ss-fav-star {
    position: absolute;
    top: 14px;
    right: 14px;
    z-index: 4;
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 50%;
    background: rgba(15,13,11,0.45);
    backdrop-filter: blur(6px);
    color: rgba(232,224,214,0.55);
    cursor: pointer;
    opacity: 0;
    pointer-events: none;
    transition: color 0.2s, background 0.2s, transform 0.15s, opacity 0.2s;
}
.ss-image-container:hover .ss-fav-star,
.ss-fav-star:focus-visible,
.ss-fav-star.is-fav {
    opacity: 1;
    pointer-events: auto;
}
.ss-fav-star:hover {
    background: rgba(15,13,11,0.65);
    color: rgba(232,224,214,0.85);
    transform: scale(1.1);
}
.ss-fav-star.is-fav {
    color: #c6a87c;
}
.ss-fav-star.is-fav svg {
    fill: #c6a87c;
    stroke: #c6a87c;
}
.ss-fav-star svg {
    transition: fill 0.2s, stroke 0.2s;
}
/* Zoom controls (bottom-right of stage) */
.ss-zoom-controls {
    position: absolute;
    bottom: 14px;
    right: 14px;
    z-index: 5;
    display: flex;
    flex-direction: column;
    gap: 6px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}
.ss-image-container:hover .ss-zoom-controls,
.ss-image-container.is-zoomed .ss-zoom-controls {
    opacity: 1;
    pointer-events: auto;
}
.ss-zoom-btn {
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 50%;
    background: rgba(15,13,11,0.55);
    backdrop-filter: blur(6px);
    color: rgba(232,224,214,0.8);
    cursor: pointer;
    transition: background 0.2s, color 0.2s, transform 0.15s;
}
.ss-zoom-btn:hover {
    background: rgba(198,168,124,0.28);
    color: #c6a87c;
    transform: scale(1.08);
}
.ss-zoom-indicator {
    position: absolute;
    bottom: 14px;
    left: 14px;
    z-index: 5;
    padding: 4px 10px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.4px;
    color: #c6a87c;
    background: rgba(15,13,11,0.75);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(198,168,124,0.2);
    border-radius: 6px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
}
.ss-image-container.is-zoomed .ss-main-image {
    transition: none;
    cursor: grab;
    user-select: none;
    -webkit-user-drag: none;
}
/* Slideshow delete icon (sits next to favorite star) */
.ss-del-icon {
    position: absolute;
    top: 14px;
    right: 62px; /* 14 (right) + 38 (fav width) + 10 (gap) */
    z-index: 4;
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 50%;
    background: rgba(15,13,11,0.45);
    backdrop-filter: blur(6px);
    color: rgba(232,224,214,0.55);
    cursor: pointer;
    opacity: 0;
    pointer-events: none;
    transition: color 0.2s, background 0.2s, transform 0.15s, opacity 0.2s;
}
.ss-image-container:hover .ss-del-icon,
.ss-del-icon:focus-visible {
    opacity: 1;
    pointer-events: auto;
}
.ss-del-icon:hover {
    background: rgba(180,50,50,0.65);
    color: #fff;
    transform: scale(1.1);
}
.ss-del-icon:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none;
}
/* Floating view label (top-left of stage) */
.ss-view-label {
    position: absolute;
    top: 16px;
    left: 16px;
    z-index: 6;
    padding: 5px 14px;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    color: #c6a87c;
    background: rgba(15, 13, 11, 0.75);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(198, 168, 124, 0.2);
    border-radius: 8px;
    pointer-events: none;
    transition: opacity 0.2s ease;
}
.ss-view-label.is-original {
    color: #e8e0d6;
    border-color: rgba(255, 255, 255, 0.15);
}

/* ── Carousel ── */
.ss-carousel-wrapper {
    flex-shrink: 0;
    padding: 10px 24px;
    background: rgba(15, 13, 11, 0.7);
    border-top: 1px solid rgba(198, 168, 124, 0.1);
}
.ss-carousel {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: thin;
    scrollbar-color: rgba(198, 168, 124, 0.25) transparent;
    padding: 4px 12px;
    /* "safe center" keeps the strip centered when it fits, but falls back to
       start alignment when it overflows so scrollIntoView can reach off-screen
       thumbs (without "safe", the leftmost overflow is unreachable). */
    justify-content: safe center;
    scroll-padding-inline: 48px;
}
.ss-carousel::-webkit-scrollbar {
    height: 4px;
}
.ss-carousel::-webkit-scrollbar-thumb {
    background: rgba(198, 168, 124, 0.25);
    border-radius: 4px;
}
.ss-thumb {
    flex-shrink: 0;
    width: 72px;
    height: 72px;
    border-radius: 8px;
    object-fit: cover;
    cursor: pointer;
    border: 2px solid transparent;
    opacity: 0.55;
    transition: opacity 0.2s, border-color 0.2s, transform 0.2s;
}
.ss-thumb:hover {
    opacity: 0.85;
    transform: scale(1.05);
}
.ss-thumb.active {
    border-color: #c6a87c;
    opacity: 1;
    box-shadow: 0 0 0 2px rgba(198, 168, 124, 0.45), 0 0 18px rgba(198, 168, 124, 0.55);
    transform: scale(1.08);
}

/* ── Footer ── */
.ss-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 24px;
    background: rgba(15, 13, 11, 0.85);
    backdrop-filter: blur(12px);
    border-top: 1px solid rgba(198, 168, 124, 0.1);
    flex-shrink: 0;
}
.ss-filename {
    font-size: 12px;
    color: rgba(232, 224, 214, 0.45);
    max-width: 50%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.ss-footer-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* ── Light-theme overrides ── */
[data-theme="light"] .slideshow-modal {
    background: #f5f0ea;
    color: #2c2418;
}
[data-theme="light"] .ss-header {
    background: rgba(245, 240, 234, 0.9);
    border-bottom-color: rgba(44, 36, 24, 0.1);
}
[data-theme="light"] .ss-title { color: #8a6d3b; }
[data-theme="light"] .ss-counter { color: rgba(44, 36, 24, 0.5); }
[data-theme="light"] .ss-model-badge {
    background: rgba(138, 109, 59, 0.1);
    color: #8a6d3b;
}
[data-theme="light"] .ss-header-btn {
    background: rgba(0, 0, 0, 0.04);
    border-color: rgba(0, 0, 0, 0.1);
    color: #2c2418;
}
[data-theme="light"] .ss-header-btn:hover {
    background: rgba(138, 109, 59, 0.12);
    border-color: rgba(138, 109, 59, 0.25);
}
[data-theme="light"] .ss-nav {
    background: rgba(245, 240, 234, 0.8);
    border-color: rgba(0, 0, 0, 0.1);
    color: #2c2418;
}
[data-theme="light"] .ss-nav:hover {
    background: rgba(138, 109, 59, 0.15);
    border-color: rgba(138, 109, 59, 0.3);
}
[data-theme="light"] .ss-image-glow {
    background: radial-gradient(circle, rgba(138, 109, 59, 0.04) 0%, transparent 70%);
}
[data-theme="light"] .ss-main-image {
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.12);
}
[data-theme="light"] .ss-image-toolbar {
    background: rgba(245, 240, 234, 0.92);
    border-color: rgba(0, 0, 0, 0.08);
}
[data-theme="light"] .ss-tool-btn {
    background: rgba(0, 0, 0, 0.04);
    border-color: rgba(0, 0, 0, 0.08);
    color: #2c2418;
}
[data-theme="light"] .ss-tool-btn:hover {
    background: rgba(138, 109, 59, 0.12);
    border-color: rgba(138, 109, 59, 0.25);
    color: #8a6d3b;
}
[data-theme="light"] .ss-tool-btn:disabled,
[data-theme="light"] .ss-tool-btn:disabled:hover {
    background: rgba(0, 0, 0, 0.03);
    border-color: rgba(0, 0, 0, 0.05);
    color: rgba(44, 36, 24, 0.42);
}
[data-theme="light"] .ss-carousel-wrapper {
    background: rgba(245, 240, 234, 0.85);
    border-top-color: rgba(0, 0, 0, 0.06);
}
[data-theme="light"] .ss-thumb.active {
    border-color: #8a6d3b;
    box-shadow: 0 0 12px rgba(138, 109, 59, 0.15);
}
[data-theme="light"] .ss-footer {
    background: rgba(245, 240, 234, 0.9);
    border-top-color: rgba(0, 0, 0, 0.06);
}
[data-theme="light"] .ss-filename { color: rgba(44, 36, 24, 0.45); }
}

/* ═══════════════════════════════════════════════════════════════════════════
   REFINE DESIGN SLIDE-OUT PANEL
   ═══════════════════════════════════════════════════════════════════════════ */
.refine-design-modal {
    position: fixed;
    inset: 0;
    z-index: 10100;
    display: none;
}
.refine-design-modal.is-open {
    display: block;
}
.refine-design-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    z-index: 10100;
}
.refine-design-dialog {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: min(560px, 92vw);
    z-index: 10101;
    display: flex;
    flex-direction: column;
    background: #141210;
    border-left: 1px solid rgba(198, 168, 124, 0.15);
    box-shadow: -8px 0 40px rgba(0, 0, 0, 0.5);
}
.refine-design-close {
    position: absolute;
    top: 14px;
    right: 14px;
    z-index: 2;
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    color: #a09888;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
}
.refine-design-close:hover {
    background: rgba(198, 168, 124, 0.2);
    color: #c6a87c;
}

/* Header */
.refine-design-header {
    padding: 18px 20px 10px;
    border-bottom: 1px solid rgba(198, 168, 124, 0.1);
    flex-shrink: 0;
}
.refine-design-header h3 {
    font-family: 'Playfair Display', serif;
    font-size: 1.15rem;
    font-weight: 600;
    color: #e8e0d6;
    margin: 0;
}
.refine-design-subtitle {
    display: block;
    margin-top: 3px;
    font-size: 0.75rem;
    color: rgba(232, 224, 214, 0.45);
}

/* Body: single column in slide-out */
.refine-design-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 16px 20px;
    overflow-y: auto;
}
.refine-design-preview {
    position: relative;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    border-radius: 10px;
    overflow: hidden;
    background: rgba(0, 0, 0, 0.3);
    max-height: 220px;
    flex-shrink: 0;
}
.refine-design-preview img {
    width: 100%;
    height: 100%;
    max-height: 220px;
    object-fit: cover;
    border-radius: 10px;
}
.refine-design-img-label {
    position: absolute;
    bottom: 8px;
    left: 8px;
    padding: 3px 10px;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #c6a87c;
    background: rgba(15, 13, 11, 0.75);
    backdrop-filter: blur(8px);
    border-radius: 6px;
}
.refine-design-form {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 14px;
}
.refine-design-field {
    display: flex;
    flex-direction: column;
    gap: 5px;
}
.refine-design-field label {
    font-size: 0.78rem;
    font-weight: 600;
    color: rgba(232, 224, 214, 0.6);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.refine-design-field textarea,
.refine-design-field select {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(198, 168, 124, 0.15);
    border-radius: 8px;
    color: #e8e0d6;
    padding: 9px 12px;
    font-size: 0.85rem;
    transition: border-color 0.2s;
}
.refine-design-field textarea:focus,
.refine-design-field select:focus {
    outline: none;
    border-color: rgba(198, 168, 124, 0.45);
}
.refine-design-row {
    display: flex;
    gap: 12px;
}
.refine-design-half {
    flex: 1;
}
.refine-design-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 2px;
}
.refine-design-pills .pill-button {
    font-size: 0.75rem;
    padding: 5px 12px;
}

/* Progress */
.refine-design-progress {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 8px;
}
.refine-design-progress-bar {
    flex: 1;
    height: 6px;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 3px;
    overflow: hidden;
}
.refine-design-progress-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #c6a87c, #a67c52);
    border-radius: 3px;
    transition: width 0.4s ease;
}
.refine-design-progress-label {
    flex-shrink: 0;
    font-size: 0.78rem;
    color: rgba(232, 224, 214, 0.6);
    min-width: 120px;
}

/* Footer */
.refine-design-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 14px 20px;
    border-top: 1px solid rgba(198, 168, 124, 0.1);
    flex-shrink: 0;
}
.refine-design-footer .button {
    flex: 1;
}

/* Responsive */
@media (max-width: 500px) {
    .refine-design-dialog {
        width: 100vw;
    }
}

/* ═══════════════════════════════════════════════════════
   MOOD BOARD PAGE — Canvas-first editor layout
   ═══════════════════════════════════════════════════════ */

body.mood-board-page {
    background: radial-gradient(circle at 18% 115%, rgba(198, 168, 124, 0.05), transparent 42%),
                radial-gradient(circle at 82% -8%, rgba(166, 124, 82, 0.03), transparent 48%),
                linear-gradient(135deg, #0a0806, #080604 52%, #0a0806 100%);
}

/* ── Page-level background matching ISR ── */
.mood-board-page {
    background: linear-gradient(180deg, #0d0b09 0%, #141210 50%, #0d0b09 100%);
    min-height: 100vh;
}

.mood-board-page .page {
    background: transparent;
}

.mood-board-page .top-nav {
    /* inherit global pill style */
    border-bottom: none;
}

.mood-board-page .top-nav .nav-actions a {
    font-size: 0.92rem;
    font-weight: 500;
    letter-spacing: 0.01em;
    padding: 6px 2px;
    border-radius: 0;
    transition: color 0.22s ease;
}

.mood-board-page .top-nav .nav-actions a:hover {
    background: transparent;
    color: var(--text-primary);
}

.mood-board-page .top-nav .nav-actions a.primary-action {
    background: linear-gradient(135deg, var(--accent), var(--accent-strong)) !important;
    color: #1a120a !important;
}

.mood-board-layout {
    padding: 20px 0;
    max-width: none;
    height: calc(100vh - 48px);
    overflow: hidden;
}

/* ── App shell: canvas + sidebar ── */
.mb-app {
    display: grid;
    grid-template-columns: 480px 1fr 340px;
    gap: 0;
    height: 100%;
    overflow: hidden;
    transition: grid-template-columns 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.mb-app[data-sidebar-open="false"] {
    grid-template-columns: 480px 1fr 0px;
}

.mb-app[data-sidebar-open="false"] .mb-sidebar-right {
    opacity: 0;
    pointer-events: none;
    transform: translateX(20px);
}

/* ── Main / canvas column ── */
.mb-main {
    display: flex;
    flex-direction: column;
    min-width: 0;
    overflow: hidden;
    background: #0a0806;
    padding: 0;
}

/* ── Toolbar ── */
.mb-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 20px;
    background: transparent;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    flex-shrink: 0;
    z-index: 2;
}

.mb-toolbar-left {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.mb-title {
    font-family: 'Inter', -apple-system, sans-serif;
    font-size: 13px;
    font-weight: 600;
    margin: 0;
    white-space: nowrap;
    color: #fff;
}

.mb-badge {
    font-size: 11px;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 20px;
    background: rgba(198, 168, 124, 0.12);
    color: var(--accent);
    border: 1px solid rgba(198, 168, 124, 0.2);
    white-space: nowrap;
}

.mb-toolbar-center {
    display: flex;
    align-items: center;
    gap: 6px;
}

.mb-toolbar-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 6px 12px;
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.04);
    color: rgba(255, 255, 255, 0.8);
    font-size: 11px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
    white-space: nowrap;
}

.mb-toolbar-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.12);
    color: #fff;
}

.mb-upload-inline {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 6px 14px;
    border-radius: 6px;
    border: 1px solid rgba(198, 168, 124, 0.25);
    background: rgba(198, 168, 124, 0.12);
    color: var(--accent);
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
    white-space: nowrap;
}

.mb-upload-inline:hover {
    background: rgba(198, 168, 124, 0.2);
    border-color: rgba(198, 168, 124, 0.4);
}

.mb-section-title {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.mb-section-actions {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.mb-material-header-actions {
    margin-left: 0;
}

.mb-material-header-actions + .mb-chevron {
    margin-left: 4px;
}

.mb-material-section-toggle {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto auto;
    column-gap: 8px;
}

.mb-material-section-toggle .mb-section-title {
    justify-self: start;
}

.mb-material-section-toggle .mb-material-header-actions {
    justify-self: end;
}

.mb-material-section-toggle .mb-chevron {
    margin-left: 0;
}

.mb-material-actions {
    display: flex;
    width: 100%;
    justify-content: flex-end;
    margin: -4px 0 10px;
}

.mb-section-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    min-height: 28px;
    padding: 6px 10px;
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.09);
    background: rgba(255, 255, 255, 0.045);
    color: rgba(255, 248, 235, 0.68);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: none;
    cursor: pointer;
    transition: all 0.15s ease;
    white-space: nowrap;
}

.mb-section-action:hover {
    border-color: rgba(198, 168, 124, 0.32);
    color: var(--accent);
    background: rgba(198, 168, 124, 0.1);
}

.mb-section-actions .mb-upload-inline {
    min-height: 28px;
    padding: 6px 10px;
    font-size: 10px;
    text-transform: none;
    letter-spacing: 0.04em;
}

.mb-toggle-sidebar svg {
    transition: transform 0.2s ease;
}

.mb-app[data-sidebar-open="false"] .mb-toggle-sidebar svg {
    transform: scaleX(-1);
}

/* ── Center Display Area ── */
.mb-display {
    flex: 1;
    min-height: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    padding: 20px;
    background: linear-gradient(135deg, #0f0d0a 0%, #0a0806 100%);
}

.mb-display-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 40px 24px;
}

.mb-display-empty h2 {
    font-family: 'Inter', -apple-system, sans-serif;
    font-size: 16px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.8);
    margin: 0 0 6px;
}

.mb-display-empty p {
    font-size: 12px;
    line-height: 1.6;
    color: rgba(255, 255, 255, 0.35);
    max-width: 340px;
    margin: 0;
}

.mb-display-empty .mb-empty-icon {
    width: 80px;
    height: 80px;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 20px;
    color: rgba(255, 255, 255, 0.3);
}

/* ── Room image + add button ── */
.mb-room-add-btn {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    border: 2px dashed #e9c982;
    background: rgba(233, 201, 130, 0.14);
    color: #f4d996;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 18px;
    box-shadow: 0 0 26px rgba(233, 201, 130, 0.2), inset 0 0 18px rgba(233, 201, 130, 0.08);
    animation: mbRoomAddGoldPulse 1.8s ease-in-out infinite;
    transition: transform 0.2s ease, background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.mb-room-add-btn:hover {
    border-color: #f4d996;
    background: rgba(244, 217, 150, 0.24);
    transform: scale(1.06);
    box-shadow: 0 0 42px rgba(244, 217, 150, 0.4), inset 0 0 24px rgba(244, 217, 150, 0.16);
}

@keyframes mbRoomAddGoldPulse {
    0%, 100% {
        background: rgba(233, 201, 130, 0.12);
        box-shadow: 0 0 20px rgba(233, 201, 130, 0.18), inset 0 0 16px rgba(233, 201, 130, 0.08);
    }
    50% {
        background: rgba(244, 217, 150, 0.22);
        box-shadow: 0 0 38px rgba(244, 217, 150, 0.36), inset 0 0 22px rgba(244, 217, 150, 0.14);
    }
}

.mb-display {
    position: relative;
}

.mb-display.is-generating {
    flex-direction: column;
}

.mb-display.is-generating .mb-display-empty {
    width: 100%;
    max-width: 1120px;
    box-sizing: border-box;
    gap: 10px;
    padding: 0 24px 2px;
}

.mb-generation-video-frame {
    width: min(84%, clamp(520px, calc((100dvh - 430px) * 16 / 9), 1020px));
    aspect-ratio: 16 / 9;
    z-index: 1;
    margin-bottom: 6px;
}

.mb-generation-video-frame[hidden] {
    display: none !important;
}

.mb-generation-video {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
    border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(255, 255, 255, 0.04);
    box-shadow: 0 18px 36px -24px rgba(0, 0, 0, 0.85);
    overflow: hidden;
}

@media (max-width: 860px) {
    .mb-generation-video-frame {
        width: min(720px, 88%);
    }
}

.mb-room-change-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    font-weight: 500;
    color: rgba(255, 248, 235, 0.6);
}
.mb-room-change-btn[hidden] { display: none !important; }

.mb-room-change-btn:hover {
    color: var(--accent);
}

.mb-display-image {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 20px 60px -20px rgba(0, 0, 0, 0.8);
    position: relative;
    z-index: 1;
}

/* ── Favorite (heart) button overlay on main image ── */
.mb-display-fav-btn {
    position: absolute;
    top: 16px;
    right: 16px;
    z-index: 3;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.18);
    background: rgba(15, 13, 10, 0.55);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    color: rgba(255, 255, 255, 0.85);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.18s ease;
    box-shadow: 0 4px 14px -4px rgba(0, 0, 0, 0.55);
}
.mb-display-fav-btn[hidden] { display: none !important; }
.mb-display-fav-btn:hover {
    color: var(--accent, #c6a87c);
    border-color: rgba(198, 168, 124, 0.6);
    transform: scale(1.06);
}
.mb-display-fav-btn:disabled {
    opacity: 0.6;
    cursor: progress;
    transform: none;
}
.mb-display-fav-btn.is-favorited {
    color: var(--accent, #c6a87c);
    border-color: rgba(198, 168, 124, 0.7);
    background: rgba(198, 168, 124, 0.18);
}
.mb-display-fav-btn.is-favorited:hover {
    color: var(--accent, #c6a87c);
}

/* ── Room Image Picker Modal ── */
.mb-room-modal {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: clamp(16px, 4vw, 48px);
    z-index: 1200;
}
.mb-room-modal[hidden] { display: none !important; }

.mb-room-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(12, 10, 6, 0.85);
    backdrop-filter: blur(18px);
}

.mb-room-modal-dialog {
    position: relative;
    width: min(720px, 100%);
    max-height: 80vh;
    background: rgba(28, 24, 20, 0.95);
    border: 1px solid rgba(255, 248, 235, 0.14);
    border-radius: 24px;
    padding: clamp(20px, 3vw, 28px);
    box-shadow: 0 32px 88px -36px rgba(5, 6, 18, 0.9);
    backdrop-filter: blur(24px);
    z-index: 1;
    display: flex;
    flex-direction: column;
    gap: 16px;
    overflow: hidden;
}

.mb-room-modal-close {
    position: absolute;
    top: 12px;
    right: 12px;
    border: none;
    background: rgba(255, 248, 235, 0.08);
    color: var(--text-primary);
    border-radius: 50%;
    width: 36px;
    height: 36px;
    font-size: 22px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease;
    z-index: 2;
}
.mb-room-modal-close:hover { background: rgba(255, 248, 235, 0.18); }

.mb-room-modal-header h3 {
    margin: 0;
    font-size: 17px;
    font-weight: 600;
    letter-spacing: 0.04em;
    color: rgba(255, 248, 235, 0.92);
}
.mb-room-modal-subtitle {
    margin: 4px 0 0;
    font-size: 12px;
    color: rgba(255, 248, 235, 0.45);
}

.mb-room-modal-tabs {
    display: flex;
    gap: 2px;
    background: rgba(255, 255, 255, 0.04);
    border-radius: 8px;
    padding: 3px;
}
.mb-room-modal-tab {
    flex: 1;
    padding: 7px 12px;
    border: none;
    background: transparent;
    color: rgba(255, 248, 235, 0.5);
    font-size: 12px;
    font-weight: 500;
    letter-spacing: 0.04em;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s ease;
}
.mb-room-modal-tab.active {
    background: rgba(198, 168, 124, 0.14);
    color: var(--accent);
}
.mb-room-modal-tab:hover:not(.active) {
    color: rgba(255, 248, 235, 0.7);
}

.mb-room-modal-project {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    background: transparent;
    border: none;
    border-bottom: 1px solid rgba(255, 248, 235, 0.06);
    border-radius: 0;
    margin: -4px 0 0;
}
.mb-room-modal-project[hidden] { display: none !important; }
.mb-room-modal-project-label {
    font-size: 10px;
    font-weight: 500;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: rgba(255, 248, 235, 0.35);
    white-space: nowrap;
    flex-shrink: 0;
}
.mb-room-modal-project .select-wrapper { flex: 1; max-width: 280px; }
.mb-room-modal-project .control.faux-select {
    font-size: 12px;
    padding: 5px 10px;
    min-height: 0;
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(255, 248, 235, 0.08);
    color: transparent;
    -webkit-text-fill-color: transparent;
    text-shadow: none;
}

.mb-room-project-select-wrapper .select-value {
    inset: 0;
    margin: 0;
    padding: 5px 28px 5px 10px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 248, 235, 0.08);
    border-radius: 6px;
    box-shadow: none;
    color: rgba(255, 248, 235, 0.85);
    font-size: 12px;
    line-height: 1.4;
}

.mb-room-project-select-wrapper .faux-select:focus + .select-value {
    border-color: rgba(198, 168, 124, 0.42);
    background: rgba(255, 255, 255, 0.06);
}

.mb-room-modal-body {
    flex: 1;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(198, 168, 124, 0.15) transparent;
}

.mb-room-pane[hidden] { display: none !important; }

/* Upload dropzone */
.mb-room-dropzone {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 48px 24px;
    border: 2px dashed rgba(198, 168, 124, 0.25);
    border-radius: 16px;
    background: rgba(198, 168, 124, 0.03);
    color: rgba(255, 248, 235, 0.5);
    font-size: 13px;
    transition: all 0.2s ease;
    cursor: pointer;
}
.mb-room-dropzone.dragover {
    border-color: var(--accent);
    background: rgba(198, 168, 124, 0.08);
}
.mb-room-dropzone svg { color: rgba(198, 168, 124, 0.45); }
.mb-room-dropzone-or {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: rgba(255, 248, 235, 0.3);
}
.mb-room-browse-btn {
    padding: 8px 20px;
    border: 1px solid rgba(198, 168, 124, 0.35);
    border-radius: 8px;
    background: rgba(198, 168, 124, 0.1);
    color: var(--accent);
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
}
.mb-room-browse-btn:hover {
    background: rgba(198, 168, 124, 0.18);
    border-color: var(--accent);
}

/* Image grid for uploads / generated */
.mb-room-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 10px;
    padding: 4px 0;
}
.mb-room-grid-item {
    position: relative;
    aspect-ratio: 1;
    border-radius: 10px;
    overflow: hidden;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all 0.15s ease;
}
.mb-room-grid-item:hover {
    border-color: rgba(198, 168, 124, 0.4);
    transform: scale(1.03);
}
.mb-room-grid-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.mb-room-grid-item .mb-room-grid-name {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 16px 6px 5px;
    font-size: 10px;
    color: #fff;
    background: linear-gradient(transparent, rgba(0,0,0,0.7));
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.mb-room-grid-empty {
    grid-column: 1 / -1;
    text-align: center;
    padding: 32px 16px;
    font-size: 13px;
    color: rgba(255, 248, 235, 0.35);
}
.mb-room-load-more {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px;
    border: none;
    background: rgba(198, 168, 124, 0.08);
    color: var(--accent);
    font-size: 11px;
    font-weight: 500;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.15s ease;
}
.mb-room-load-more:hover { background: rgba(198, 168, 124, 0.15); }

/* ── Board grid (left panel) ── */
/* Let the outer .mb-sidebar-scroll handle scrolling so images aren't
   abruptly clipped by a nested max-height. */
.mb-board-section-body {
    overflow: visible;
}

.mb-board-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
    min-height: 60px;
    transition: background-color 0.2s;
}

.mb-board-grid.board-dragover {
    background: rgba(198, 168, 124, 0.06);
    border-radius: 8px;
}

.mb-board-empty {
    grid-column: 1 / -1;
    text-align: center;
    padding: 16px 8px;
    color: var(--text-muted);
    font-size: 12px;
}

.mb-board-empty p { margin: 0; }

.mb-board-thumb {
    position: relative;
    border-radius: 6px;
    overflow: hidden;
}

.mb-board-thumb img {
    width: 100%;
    display: block;
    object-fit: cover;
    border-radius: 6px;
}

.mb-board-thumb-delete {
    position: absolute;
    top: 3px;
    right: 3px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.7);
    border: none;
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.15s;
    z-index: 2;
}

.mb-board-thumb:hover .mb-board-thumb-delete {
    opacity: 1;
}

.mb-clear-board-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 100%;
    margin-top: 8px;
    padding: 6px 0;
    border: none;
    background: none;
    color: var(--text-muted);
    font-size: 11px;
    cursor: pointer;
    transition: color 0.15s;
}

.mb-clear-board-btn:hover {
    color: var(--accent);
}

.mb-badge-small {
    font-size: 10px;
    padding: 1px 6px;
    border-radius: 10px;
    background: rgba(198, 168, 124, 0.15);
    color: var(--accent);
    margin-left: 4px;
}
/* ═══ Sidebar ═══ */
.mb-sidebar {
    background: #1a1814;
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: opacity 0.25s ease, transform 0.25s ease;
    height: 100%;
    max-height: 100%;
    box-sizing: border-box;
}

.mb-sidebar-left {
    margin: 0 0 0 20px;
    order: -1;
}

.mb-sidebar-right {
    margin: 0 20px 0 0;
}

.mb-sidebar-scroll {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 6px 0;
    scrollbar-width: thin;
    scrollbar-color: rgba(198, 168, 124, 0.15) transparent;
}

.mb-sidebar-scroll::-webkit-scrollbar { width: 4px; }
.mb-sidebar-scroll::-webkit-scrollbar-thumb {
    background: rgba(198, 168, 124, 0.2);
    border-radius: 4px;
}

/* ── Collapsible sections ── */
.mb-section {
    border-bottom: 1px solid var(--border-soft);
}

.mb-section summary {
    list-style: none;
}
.mb-section summary::-webkit-details-marker { display: none; }

.mb-section-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 14px 16px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: rgba(255, 255, 255, 0.5);
    cursor: pointer;
    user-select: none;
    transition: color 0.15s ease;
}

.mb-section-toggle:hover {
    color: rgba(255, 255, 255, 0.8);
}

.mb-section-toggle svg:first-child {
    color: var(--accent);
    flex-shrink: 0;
}

.mb-section-toggle--accent {
    color: var(--accent);
}

.mb-chevron {
    margin-left: auto;
    transition: transform 0.2s ease;
    opacity: 0.5;
}

.mb-section[open] .mb-chevron {
    transform: rotate(180deg);
}

.mb-section-body {
    padding: 0 16px 16px;
}

/* ── Fields ── */
.mb-field {
    margin-bottom: 14px;
}

.mb-label {
    display: flex;
    flex-direction: row;
    align-items: baseline;
    flex-wrap: nowrap;
    gap: 8px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-secondary);
    margin-bottom: 6px;
    white-space: nowrap;
}

.mb-chip {
    display: inline-block;
    flex-shrink: 0;
    font-size: 9px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 2px 7px;
    border-radius: 20px;
    background: rgba(198, 168, 124, 0.1);
    color: var(--accent);
    border: 1px solid rgba(198, 168, 124, 0.18);
    white-space: nowrap;
}

.mb-field-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 10px;
}

/* ── Shared control styling inside sidebar ── */
.mb-sidebar .control {
    width: 100%;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 6px;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 12px;
    padding: 8px 12px;
    transition: border-color 0.15s ease;
    backdrop-filter: none;
    box-shadow: none;
    transform: none;
}

.mb-sidebar .control:focus {
    outline: none;
    border-color: rgba(198, 168, 124, 0.45);
    box-shadow: none;
    transform: none;
}

.mb-sidebar textarea.control {
    resize: vertical;
    line-height: 1.6;
}

.mb-sidebar input.control {
    line-height: 1.4;
}

/* Select wrappers */
.mb-sidebar .select-wrapper {
    position: relative;
    padding: 0;
    border-radius: 6px;
    background: none;
    box-shadow: none;
    transform: none;
}
.mb-sidebar .select-wrapper::before {
    display: none;
}
.mb-sidebar .select-wrapper:hover {
    transform: none;
    box-shadow: none;
}
.mb-sidebar .select-wrapper:focus-within {
    background: none;
    box-shadow: none;
}

.mb-sidebar .select-icon {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
    color: var(--text-muted);
}

.mb-sidebar .faux-select {
    width: 100%;
    appearance: none;
    -webkit-appearance: none;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 6px;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 12px;
    padding: 8px 28px 8px 12px;
    cursor: pointer;
    transition: border-color 0.15s ease;
    backdrop-filter: none;
    box-shadow: none;
    transform: none;
}

.mb-sidebar .faux-select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: none;
    transform: none;
}

.mb-sidebar .mb-project-select-wrapper .faux-select {
    color: transparent;
    -webkit-text-fill-color: transparent;
}

.mb-sidebar .mb-project-select-wrapper .select-value {
    inset: 0;
    margin: 0;
    padding: 8px 28px 8px 12px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 6px;
    box-shadow: none;
    font-size: 12px;
    line-height: 1.4;
}

.mb-sidebar .mb-project-select-wrapper .faux-select:focus + .select-value {
    border-color: var(--accent);
    background: rgba(0, 0, 0, 0.3);
}

.mb-sidebar .mb-rich-select > .faux-select,
.mb-sidebar .mb-rich-select > .select-icon {
    display: none;
}

.mb-rich-trigger {
    width: 100%;
    min-height: 42px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(0, 0, 0, 0.3);
    color: var(--text-primary);
    cursor: pointer;
    text-align: left;
}

.mb-rich-trigger:hover,
.mb-rich-trigger:focus-visible {
    outline: none;
    border-color: rgba(198, 168, 124, 0.45);
}

.mb-rich-current {
    min-width: 0;
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 12px;
    font-weight: 600;
}

.mb-rich-preview {
    width: 34px;
    height: 34px;
    flex: 0 0 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.06);
}

.mb-rich-caret {
    width: 16px;
    height: 16px;
    flex: 0 0 16px;
    color: var(--text-muted);
}

.mb-rich-caret svg {
    width: 100%;
    height: 100%;
}

.mb-rich-brand-logo,
.mb-rich-style-thumb {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.mb-rich-brand-logo {
    padding: 5px;
    object-fit: contain;
    background: rgba(255, 248, 235, 0.88);
}

.mb-rich-color-dots {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: 1fr;
    width: 100%;
    height: 100%;
}

.mb-rich-color-dot {
    min-width: 0;
}

.mb-sidebar .mb-rich-select-color,
.mb-sidebar .mb-rich-select-brand,
.mb-sidebar .mb-rich-select-style,
.mb-sidebar .mb-rich-select-floor {
    border-radius: 14px;
}

.mb-sidebar .mb-rich-select-color .mb-rich-trigger,
.mb-sidebar .mb-rich-select-brand .mb-rich-trigger,
.mb-sidebar .mb-rich-select-style .mb-rich-trigger,
.mb-sidebar .mb-rich-select-floor .mb-rich-trigger {
    position: relative;
    min-height: 156px;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    gap: 0;
    padding: 0;
    overflow: hidden;
    border-radius: 14px;
    border-color: rgba(198, 168, 124, 0.28);
    background: linear-gradient(180deg, rgba(37, 30, 23, 0.94), rgba(9, 7, 5, 0.96));
    box-shadow: 0 14px 32px rgba(0, 0, 0, 0.24), 0 0 0 1px rgba(255, 255, 255, 0.03) inset;
}

.mb-sidebar .mb-rich-select-color .mb-rich-trigger:hover,
.mb-sidebar .mb-rich-select-brand .mb-rich-trigger:hover,
.mb-sidebar .mb-rich-select-style .mb-rich-trigger:hover,
.mb-sidebar .mb-rich-select-floor .mb-rich-trigger:hover,
.mb-sidebar .mb-rich-select-color .mb-rich-trigger:focus-visible,
.mb-sidebar .mb-rich-select-brand .mb-rich-trigger:focus-visible,
.mb-sidebar .mb-rich-select-style .mb-rich-trigger:focus-visible,
.mb-sidebar .mb-rich-select-floor .mb-rich-trigger:focus-visible {
    border-color: rgba(198, 168, 124, 0.58);
    box-shadow: 0 18px 42px rgba(0, 0, 0, 0.34), 0 0 0 1px rgba(198, 168, 124, 0.12) inset;
}

.mb-sidebar .mb-rich-select-color .mb-rich-preview,
.mb-sidebar .mb-rich-select-brand .mb-rich-preview,
.mb-sidebar .mb-rich-select-style .mb-rich-preview,
.mb-sidebar .mb-rich-select-floor .mb-rich-preview {
    order: 1;
    width: 100%;
    height: 108px;
    flex: 0 0 108px;
    border-radius: 0;
    background: rgba(255, 255, 255, 0.05);
}

.mb-sidebar .mb-rich-select-color .mb-rich-current,
.mb-sidebar .mb-rich-select-brand .mb-rich-current,
.mb-sidebar .mb-rich-select-style .mb-rich-current,
.mb-sidebar .mb-rich-select-floor .mb-rich-current {
    order: 2;
    width: 100%;
    min-height: 48px;
    display: flex;
    align-items: center;
    padding: 12px 36px 12px 14px;
    background: linear-gradient(180deg, rgba(11, 8, 5, 0.76), rgba(3, 2, 1, 0.94));
    color: var(--text-primary);
    font-size: 13px;
    font-weight: 700;
    line-height: 1.25;
    white-space: normal;
}

.mb-sidebar .mb-rich-select-color .mb-rich-caret,
.mb-sidebar .mb-rich-select-brand .mb-rich-caret,
.mb-sidebar .mb-rich-select-style .mb-rich-caret,
.mb-sidebar .mb-rich-select-floor .mb-rich-caret {
    position: absolute;
    right: 12px;
    bottom: 16px;
    z-index: 2;
    color: rgba(245, 238, 226, 0.58);
}

.mb-sidebar .mb-rich-select-color .mb-rich-color-dots {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: 1fr;
    gap: 0;
    width: 100%;
    height: 100%;
}

.mb-sidebar .mb-rich-select-color .mb-rich-color-dot {
    width: 100%;
    height: 100%;
}

.mb-sidebar .mb-rich-select-brand .mb-rich-preview {
    background: linear-gradient(135deg, #f2eee6, #d9d0c2);
}

.mb-sidebar .mb-rich-select-brand .mb-rich-preview .mb-rich-brand-logo {
    width: 78px;
    height: 78px;
    border-radius: 14px;
    padding: 9px;
    background: rgba(10, 10, 10, 0.88);
    object-fit: contain;
}

.mb-sidebar .mb-rich-select-style .mb-rich-style-thumb {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.mb-sidebar .mb-rich-select-floor .mb-rich-floor-thumb {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.mb-sidebar .mb-rich-select-color + .mb-color-swatches {
    display: none;
}

.mb-rich-modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 1401;
    background: rgba(0, 0, 0, 0.66);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
}

.mb-rich-modal-backdrop[hidden] {
    display: none;
}

.mb-rich-modal-menu {
    position: fixed;
    left: 50%;
    top: 50%;
    z-index: 1402;
    width: min(860px, calc(100vw - 40px));
    max-height: min(88vh, 840px);
    transform: translate(-50%, -50%);
    overflow: hidden;
    border: 1px solid rgba(198, 168, 124, 0.42);
    border-radius: 18px;
    background: linear-gradient(180deg, rgba(24, 20, 16, 0.99), rgba(10, 8, 6, 0.99));
    box-shadow: 0 36px 100px rgba(0, 0, 0, 0.72), 0 0 0 1px rgba(255, 255, 255, 0.05) inset;
}

.mb-rich-modal-menu[hidden] {
    display: none;
}

.mb-rich-style-menu {
    width: min(1120px, calc(100vw - 40px));
}

.mb-rich-modal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 20px 24px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.mb-rich-modal-title {
    margin: 0;
    font-size: 19px;
    font-weight: 700;
    color: var(--text-primary);
}

.mb-rich-modal-close {
    width: 42px;
    height: 42px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(255, 255, 255, 0.035);
    color: rgba(245, 238, 226, 0.72);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.mb-rich-modal-close:hover {
    border-color: rgba(198, 168, 124, 0.35);
    color: #c6a87c;
}

.mb-rich-modal-list,
.mb-rich-style-grid {
    display: grid;
    gap: 14px;
    max-height: calc(min(88vh, 840px) - 83px);
    overflow-y: auto;
    padding: 18px;
}

.mb-rich-modal-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.mb-rich-style-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.mb-rich-group-label {
    grid-column: 1 / -1;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: rgba(245, 238, 226, 0.52);
}

.mb-rich-option {
    position: relative;
    min-height: 68px;
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 14px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.035);
    color: var(--text-primary);
    cursor: pointer;
    text-align: left;
}

.mb-rich-option:hover,
.mb-rich-option[aria-selected="true"] {
    border-color: rgba(198, 168, 124, 0.55);
    background: rgba(198, 168, 124, 0.1);
}

.mb-rich-check {
    width: 24px;
    flex: 0 0 24px;
    color: #c6a87c;
    font-size: 18px;
    opacity: 0;
}

.mb-rich-option[aria-selected="true"] .mb-rich-check {
    opacity: 1;
}

.mb-rich-label {
    min-width: 0;
    font-size: 15px;
    font-weight: 700;
}

.mb-rich-modal-menu .mb-rich-brand-logo,
.mb-rich-modal-menu .mb-rich-color-dots {
    width: 50px;
    height: 50px;
    flex: 0 0 50px;
    border-radius: 12px;
    overflow: hidden;
}

.mb-rich-style-grid .mb-rich-option {
    min-height: 194px;
    align-items: flex-start;
    flex-direction: column;
    gap: 0;
    padding: 0;
    overflow: hidden;
}

.mb-rich-style-grid .mb-rich-check {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 2;
    width: 26px;
    height: 26px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.62);
}

.mb-rich-style-grid .mb-rich-style-thumb,
.mb-rich-style-grid .mb-rich-floor-thumb {
    width: 100%;
    height: 142px;
    flex: 0 0 142px;
    object-fit: cover;
}

.mb-rich-style-grid .mb-rich-label {
    padding: 12px;
}

@media (max-width: 1180px) {
    .mb-rich-style-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 760px) {
    .mb-rich-modal-list,
    .mb-rich-style-grid { grid-template-columns: 1fr; }
}

.mb-sidebar .custom-textarea {
    margin-top: 8px;
}

/* ── Picker tabs ── */
.mb-picker-tabs {
    display: flex;
    gap: 2px;
    border-radius: 6px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.06);
    padding: 3px;
    margin-bottom: 10px;
}

.mb-tab {
    flex: 1;
    font-size: 10px;
    font-weight: 600;
    padding: 6px 8px;
    border-radius: 4px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.15s ease;
    text-align: center;
}

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

.mb-tab.active {
    background: rgba(198, 168, 124, 0.16);
    color: var(--accent);
}

/* ── Picker grid ── */
.mb-picker-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
    max-height: 280px;
    overflow-y: auto;
    padding: 2px;
    scrollbar-width: thin;
    scrollbar-color: rgba(198, 168, 124, 0.15) transparent;
}

.mb-picker-grid[hidden] {
    display: none !important;
}

.mb-picker-grid::-webkit-scrollbar { width: 3px; }
.mb-picker-grid::-webkit-scrollbar-thumb {
    background: rgba(198, 168, 124, 0.2);
    border-radius: 3px;
}

.mb-load-more {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 8px 14px;
    margin-top: 4px;
    border-radius: 7px;
    border: 1px solid rgba(198, 168, 124, 0.2);
    background: rgba(198, 168, 124, 0.06);
    color: var(--accent);
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
}

.mb-load-more:hover {
    background: rgba(198, 168, 124, 0.12);
    border-color: rgba(198, 168, 124, 0.35);
}

.mb-picker-thumb {
    position: relative;
    border: none;
    padding: 0;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 7px;
    overflow: hidden;
    width: 100%;
    cursor: pointer;
    border: 1px solid rgba(255, 255, 255, 0.05);
    transition: all 0.15s ease;
}

/* Force square via a padding-bottom trick for absolute children */
.mb-picker-thumb::before {
    content: '';
    display: block;
    padding-bottom: 100%;
}

.mb-picker-thumb:hover {
    border-color: var(--accent);
    transform: scale(1.06);
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
}

.mb-picker-thumb img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.mb-thumb-add {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.55);
    font-size: 20px;
    font-weight: 300;
    color: white;
    opacity: 0;
    transition: opacity 0.15s ease;
}

.mb-picker-thumb:hover .mb-thumb-add {
    opacity: 1;
}

.mb-picker-empty {
    grid-column: 1 / -1;
    font-size: 12px;
    color: var(--text-muted);
    text-align: center;
    padding: 14px 0;
}

/* ── Material Library Modal ── */
.mb-material-library-modal {
    position: fixed;
    inset: 0;
    z-index: 9200;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: clamp(16px, 4vw, 44px);
}
.mb-material-library-modal[hidden] { display: none !important; }

.mb-material-library-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(8, 6, 4, 0.82);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
}

.mb-material-library-dialog {
    position: relative;
    z-index: 1;
    width: min(960px, 100%);
    max-height: min(86vh, 820px);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border-radius: 18px;
    border: 1px solid rgba(198, 168, 124, 0.28);
    background: linear-gradient(180deg, rgba(24, 20, 16, 0.98), rgba(9, 7, 5, 0.99));
    box-shadow: 0 34px 100px rgba(0, 0, 0, 0.72), inset 0 1px 0 rgba(255, 248, 235, 0.05);
}

.mb-material-library-close {
    position: absolute;
    top: 14px;
    right: 14px;
    z-index: 2;
    width: 34px;
    height: 34px;
    border: none;
    border-radius: 50%;
    background: rgba(255, 248, 235, 0.08);
    color: rgba(255, 248, 235, 0.72);
    font-size: 20px;
    cursor: pointer;
}
.mb-material-library-close:hover { background: rgba(198, 168, 124, 0.2); }

.mb-material-library-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
    padding: 22px 58px 18px 22px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}

.mb-material-library-header h3 {
    margin: 0;
    font-size: 18px;
    color: rgba(255, 248, 235, 0.94);
}

.mb-material-library-header p {
    margin: 5px 0 0;
    font-size: 12px;
    color: rgba(255, 248, 235, 0.48);
}

.mb-material-library-upload {
    flex-shrink: 0;
    margin-top: 2px;
}

.mb-material-library-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(132px, 1fr));
    gap: 12px;
    min-height: 220px;
    overflow-y: auto;
    padding: 18px 22px;
    scrollbar-width: thin;
    scrollbar-color: rgba(198, 168, 124, 0.24) transparent;
}
.mb-material-library-grid.is-loading { opacity: 0.72; }

.mb-material-library-item {
    position: relative;
    min-width: 0;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.07);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.035);
    color: rgba(255, 248, 235, 0.86);
    cursor: pointer;
    text-align: left;
    transition: transform 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease;
}
.mb-material-library-item:hover,
.mb-material-library-item.is-selected {
    border-color: rgba(198, 168, 124, 0.62);
    box-shadow: 0 14px 30px rgba(0, 0, 0, 0.32), 0 0 0 1px rgba(198, 168, 124, 0.12) inset;
    transform: translateY(-1px);
}

.mb-material-library-item img {
    width: 100%;
    aspect-ratio: 1;
    display: block;
    object-fit: cover;
}

.mb-material-library-check {
    position: absolute;
    top: 9px;
    right: 9px;
    width: 24px;
    height: 24px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    background: rgba(198, 168, 124, 0.95);
    color: #120c06;
    font-size: 13px;
    font-weight: 800;
    opacity: 0;
    transform: scale(0.8);
    transition: all 0.16s ease;
}
.mb-material-library-item.is-selected .mb-material-library-check {
    opacity: 1;
    transform: scale(1);
}

.mb-material-library-name {
    display: block;
    padding: 9px 10px 10px;
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.mb-material-library-empty {
    grid-column: 1 / -1;
    align-self: center;
    text-align: center;
    color: rgba(255, 248, 235, 0.44);
    font-size: 13px;
    padding: 36px 12px;
}

.mb-material-library-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 22px 18px;
    border-top: 1px solid rgba(255, 255, 255, 0.07);
}

.mb-material-library-count {
    color: rgba(255, 248, 235, 0.5);
    font-size: 12px;
    font-weight: 600;
}

.mb-material-library-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.mb-material-library-btn {
    border: 1px solid rgba(198, 168, 124, 0.2);
    border-radius: 7px;
    background: rgba(255, 255, 255, 0.05);
    color: rgba(255, 248, 235, 0.76);
    padding: 8px 14px;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
}
.mb-material-library-btn:hover { background: rgba(255, 255, 255, 0.1); }
.mb-material-library-btn:disabled {
    cursor: not-allowed;
    opacity: 0.45;
}

.mb-material-library-btn.primary {
    background: linear-gradient(135deg, #d8bd8c, #a97845);
    border-color: rgba(255, 221, 170, 0.45);
    color: #17100a;
}

/* ── Color swatches ── */
.mb-color-swatches {
    display: flex;
    gap: 5px;
    margin-top: 8px;
    flex-wrap: wrap;
}

.mb-swatch {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
    transition: transform 0.15s ease;
}

.mb-swatch:hover {
    transform: scale(1.25);
}

/* ── Generate button ── */
/* ── Bottom prompt bar ── */
/* ═══ Bottom Dock Panel ═══ */
.mb-dock {
    background: #0a0806;
    border-top: 1px solid rgba(255, 255, 255, 0.04);
    padding: 8px 20px 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex-shrink: 0;
    position: relative;
}

/* ── Versions strip ── */
.mb-dock-versions {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 0;
}

.mb-dock-versions-toggle {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: rgba(255, 255, 255, 0.4);
    background: none;
    border: none;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 4px;
    flex-shrink: 0;
    transition: color 0.15s;
}

.mb-dock-versions-toggle:hover { color: rgba(255, 255, 255, 0.7); }

.mb-dock-versions-toggle svg {
    transition: transform 0.2s;
}

.mb-dock-versions.collapsed .mb-dock-versions-toggle svg {
    transform: rotate(180deg);
}

.mb-dock-versions.collapsed .mb-versions-thumbs {
    display: none;
}

.mb-dock-badge {
    font-size: 9px;
    font-weight: 700;
    padding: 1px 6px;
    border-radius: 10px;
    background: rgba(198, 168, 124, 0.12);
    color: var(--accent);
}

.mb-versions-thumbs {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    flex: 1;
    min-width: 0;
    scrollbar-width: thin;
    scrollbar-color: rgba(198, 168, 124, 0.15) transparent;
}

.mb-versions-thumbs::-webkit-scrollbar { height: 4px; }
.mb-versions-thumbs::-webkit-scrollbar-thumb {
    background: rgba(198, 168, 124, 0.2);
    border-radius: 4px;
}

.mb-versions-empty {
    font-size: 10px;
    color: rgba(255, 255, 255, 0.25);
    margin: 0;
    white-space: nowrap;
}

.mb-version-thumb {
    flex-shrink: 0;
    width: 72px;
    height: 72px;
    border-radius: 6px;
    overflow: hidden;
    border: 2px solid transparent;
    cursor: pointer;
    transition: all 0.15s ease;
    background: rgba(0, 0, 0, 0.3);
    padding: 0;
    position: relative;
}

.mb-version-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.mb-version-label {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    text-align: center;
    font-size: 10px;
    font-weight: 600;
    color: #fff;
    background: rgba(0, 0, 0, 0.55);
    padding: 2px 0;
    pointer-events: none;
}

.mb-version-thumb:hover {
    border-color: rgba(198, 168, 124, 0.4);
    transform: scale(1.05);
}

.mb-version-thumb.active {
    border-color: var(--accent);
    box-shadow: 0 0 0 1px rgba(198, 168, 124, 0.2);
}

/* ── Quick edit pills ── */
.mb-dock-quick-edits {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    align-items: center;
}

.mb-pill {
    font-size: 11px;
    font-weight: 500;
    padding: 6px 12px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 999px;
    color: rgba(255, 255, 255, 0.7);
    cursor: pointer;
    transition: all 0.15s;
}

.mb-pill:hover {
    background: rgba(198, 168, 124, 0.1);
    border-color: rgba(198, 168, 124, 0.25);
    color: var(--accent);
}

/* ── Prompt bar (single row) ── */
.mb-prompt-bar {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(198, 168, 124, 0.5);
    border-radius: 8px;
    padding: 6px 6px 6px 14px;
    transition: border-color 0.2s, box-shadow 0.2s;
    box-shadow: 0 0 14px rgba(198, 168, 124, 0.3), 0 0 0 3px rgba(198, 168, 124, 0.1);
}

.mb-prompt-bar:focus-within {
    border-color: rgba(198, 168, 124, 0.7);
    box-shadow: 0 0 20px rgba(198, 168, 124, 0.4), 0 0 0 3px rgba(198, 168, 124, 0.15);
}

.mb-prompt-input {
    flex: 1;
    min-width: 0;
    border: none;
    background: none;
    color: rgba(255, 255, 255, 0.9);
    font-family: 'Inter', -apple-system, sans-serif;
    font-size: 13px;
    line-height: 1.5;
    padding: 4px 0;
    resize: none;
    outline: none;
    min-height: 200px;
    max-height: 200px;
    overflow-y: auto;
}

.mb-prompt-input::placeholder {
    color: rgba(255, 255, 255, 0.22);
}

.mb-prompt-input.is-locked {
    cursor: wait;
    color: rgba(255, 255, 255, 0.58);
}

.mb-prompt-actions {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}

.mb-prompt-icon-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.06);
    color: rgba(255, 255, 255, 0.65);
    cursor: pointer;
    transition: all 0.15s;
    flex-shrink: 0;
}

.mb-prompt-icon-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.18);
    color: rgba(255, 255, 255, 0.9);
}

.mb-prompt-icon-accent {
    color: var(--accent);
    background: rgba(198, 168, 124, 0.1);
    border-color: rgba(198, 168, 124, 0.25);
}

.mb-prompt-icon-accent:hover {
    background: rgba(198, 168, 124, 0.2);
    border-color: rgba(198, 168, 124, 0.4);
    color: var(--accent);
}

.mb-prompt-icon-accent.is-refining,
.mb-prompt-icon-accent.is-refining:disabled {
    opacity: 1;
    cursor: wait;
    color: #1a1005;
    background: linear-gradient(135deg, #f6d891, #c8963f 58%, #8f5f20);
    border-color: rgba(255, 224, 158, 0.85);
    box-shadow: 0 0 0 2px rgba(246, 216, 145, 0.18), 0 0 18px rgba(229, 178, 82, 0.62), inset 0 1px 0 rgba(255, 255, 255, 0.38);
    animation: mbRefineGlow 1.1s ease-in-out infinite alternate;
}

.mb-prompt-icon-accent.is-refining svg {
    filter: drop-shadow(0 0 5px rgba(255, 245, 210, 0.75));
}

@keyframes mbRefineGlow {
    from { box-shadow: 0 0 0 2px rgba(246, 216, 145, 0.14), 0 0 12px rgba(229, 178, 82, 0.46), inset 0 1px 0 rgba(255, 255, 255, 0.32); }
    to { box-shadow: 0 0 0 3px rgba(246, 216, 145, 0.24), 0 0 24px rgba(246, 200, 102, 0.78), inset 0 1px 0 rgba(255, 255, 255, 0.48); }
}

.mb-prompt-icon-btn:disabled,
.mb-pill:disabled {
    cursor: not-allowed;
    opacity: 0.45;
}

/* ── Settings popover ── */
.mb-settings-popover {
    position: absolute;
    bottom: calc(100% + 8px);
    right: 20px;
    background: #1a1814;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    padding: 14px 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-width: 260px;
    box-shadow: 0 12px 40px -8px rgba(0, 0, 0, 0.6);
    z-index: 100;
}

.mb-settings-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.mb-settings-label {
    font-size: 11px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.45);
    min-width: 48px;
    flex-shrink: 0;
}

.mb-settings-row .mb-dock-select {
    flex: 1;
}

/* Keep dock-select styles */
.mb-dock-select {
    position: relative;
}

.mb-dock-select .control.faux-select {
    padding: 6px 24px 6px 10px;
    font-size: 11px;
    border-radius: 6px;
    min-width: 100px;
    width: 100%;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: transparent;
    -webkit-text-fill-color: transparent;
    appearance: none;
    -webkit-appearance: none;
}

.mb-dock-select .select-value {
    inset: 0;
    margin: 0;
    padding: 6px 24px 6px 10px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 6px;
    box-shadow: none;
    font-size: 11px;
    line-height: 1.4;
}

.mb-dock-select .faux-select:focus + .select-value {
    border-color: var(--accent);
    background: rgba(0, 0, 0, 0.3);
}

.mb-dock-select .select-icon {
    position: absolute;
    right: 6px;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
    color: var(--text-muted);
}

.mb-generate-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    font-weight: 700;
    font-size: 12px;
    padding: 7px 16px;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-strong) 100%);
    color: #0f0d0b;
    box-shadow: 0 4px 16px -4px rgba(198, 168, 124, 0.45);
    transition: all 0.2s ease;
    letter-spacing: 0.02em;
    white-space: nowrap;
    flex-shrink: 0;
    height: 30px;
}

.mb-generate-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 10px 28px -6px rgba(198, 168, 124, 0.6);
}

.mb-generate-btn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
    transform: none;
}

.mb-spinner {
    width: 15px;
    height: 15px;
    border: 2px solid rgba(15, 13, 11, 0.3);
    border-top-color: #0f0d0b;
    border-radius: 50%;
    animation: mbSpin 0.6s linear infinite;
    display: inline-block;
}

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

/* ── Responsive ── */
@media (max-width: 900px) {
    .mb-app {
        grid-template-columns: 1fr;
        height: auto;
    }
    .mb-main { min-height: 60vh; }
    .mb-sidebar {
        border-radius: 0;
        margin: 0;
        border-top: 1px solid rgba(255, 255, 255, 0.06);
    }
    .mb-app[data-sidebar-open="false"] .mb-sidebar {
        display: none;
    }
}

/* ═══════════ Image Lightbox Modal ═══════════ */
.mb-lightbox {
    position: fixed;
    inset: 0;
    z-index: 9000;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: mbLightboxIn 0.2s ease;
}
.mb-lightbox[hidden] { display: none !important; }

@keyframes mbLightboxIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

.mb-lightbox-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.mb-lightbox-dialog {
    position: relative;
    display: flex;
    flex-direction: column;
    max-width: 92vw;
    max-height: 92vh;
    border-radius: 12px;
    overflow: hidden;
    background: #141210;
    border: 1px solid rgba(198, 168, 124, 0.18);
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(255, 255, 255, 0.04);
}

.mb-lightbox-close {
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 2;
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.5);
    color: #fff;
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s;
    backdrop-filter: blur(4px);
}
.mb-lightbox-close:hover { background: rgba(198, 168, 124, 0.3); }

.mb-lightbox-body {
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: auto;
    padding: 16px;
}

.mb-lightbox-img {
    max-width: 88vw;
    max-height: 78vh;
    width: auto;
    height: auto;
    border-radius: 8px;
    object-fit: contain;
    user-select: none;
    -webkit-user-drag: none;
}

.mb-lightbox-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 16px 14px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.mb-lightbox-caption {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.5);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
}

.mb-lightbox-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.mb-lightbox-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    border: 1px solid rgba(198, 168, 124, 0.25);
    border-radius: 6px;
    background: rgba(198, 168, 124, 0.08);
    color: #c6a87c;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
    white-space: nowrap;
}
.mb-lightbox-btn:hover {
    background: rgba(198, 168, 124, 0.18);
    border-color: rgba(198, 168, 124, 0.4);
}
.mb-lightbox-btn svg { flex-shrink: 0; }

/* ═══════════ Refined Prompt Review Modal ═══════════ */
.mb-refine-modal {
    position: fixed;
    inset: 0;
    z-index: 9100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}
.mb-refine-modal[hidden] { display: none !important; }

.mb-refine-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.76);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.mb-refine-modal-dialog {
    position: relative;
    width: min(680px, 94vw);
    max-height: min(720px, 90vh);
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding: 22px;
    border-radius: 12px;
    background: #141210;
    border: 1px solid rgba(198, 168, 124, 0.22);
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.62), inset 0 1px 0 rgba(255, 248, 235, 0.05);
}

.mb-refine-modal-close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 50%;
    background: rgba(255, 248, 235, 0.08);
    color: rgba(255, 248, 235, 0.72);
    font-size: 20px;
    cursor: pointer;
}
.mb-refine-modal-close:hover { background: rgba(198, 168, 124, 0.22); }

.mb-refine-modal-header h3 {
    margin: 0;
    font-size: 17px;
    color: rgba(255, 248, 235, 0.92);
}

.mb-refine-modal-subtitle {
    margin: 5px 40px 0 0;
    font-size: 12px;
    color: rgba(255, 248, 235, 0.48);
}

.mb-refine-modal-text {
    min-height: 220px;
    max-height: 46vh;
    resize: vertical;
    padding: 14px;
    border-radius: 8px;
    border: 1px solid rgba(198, 168, 124, 0.2);
    background: rgba(0, 0, 0, 0.34);
    color: rgba(255, 248, 235, 0.86);
    font-family: 'Inter', -apple-system, sans-serif;
    font-size: 13px;
    line-height: 1.55;
    outline: none;
}

.mb-refine-modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

.mb-refine-modal-btn {
    border: 1px solid rgba(198, 168, 124, 0.2);
    border-radius: 7px;
    background: rgba(255, 255, 255, 0.05);
    color: rgba(255, 248, 235, 0.76);
    padding: 8px 14px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
}
.mb-refine-modal-btn:hover { background: rgba(255, 255, 255, 0.1); }

.mb-refine-modal-btn.primary {
    background: linear-gradient(135deg, #d8bd8c, #a97845);
    border-color: rgba(255, 221, 170, 0.45);
    color: #17100a;
}
.mb-refine-modal-btn.primary:hover { filter: brightness(1.05); }
