/* =============================================================================
   High Protein Plate Studio — base styles
   Editorial cookbook aesthetic, intentionally restrained.
   ============================================================================= */

:root {
    --bg: #faf8f4;
    --surface: #ffffff;
    --border: #e6e1d8;
    --text: #2a2620;
    --text-muted: #6b6457;
    --accent: #b8541c;
    --accent-hover: #9c4515;
    --success: #2d6b3a;
    --error: #a52929;
    --warm: #d6a55c;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
}

header {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 0.75rem 2rem;
}

nav { display: flex; gap: 2rem; align-items: center; }

.brand {
    font-weight: 600;
    font-size: 1.1rem;
    color: var(--text);
    text-decoration: none;
}

nav a { color: var(--text-muted); text-decoration: none; }
nav a:hover { color: var(--accent); }

main { max-width: 1400px; margin: 0 auto; padding: 2rem; }

h1 { font-size: 1.75rem; margin: 0 0 0.5rem 0; font-weight: 600; }
h2 { font-size: 1.25rem; margin: 1.5rem 0 0.75rem 0; font-weight: 600; }
h3 { font-size: 1rem; margin: 1rem 0 0.5rem 0; font-weight: 600; }

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 2rem;
    gap: 1rem;
}

.meta {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    color: var(--text-muted);
    font-size: 0.875rem;
    margin-top: 0.25rem;
}

.btn {
    display: inline-block;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    border: 1px solid transparent;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    transition: background-color 0.15s, border-color 0.15s;
}

.btn-primary {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
}
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }

.btn-secondary {
    background: var(--surface);
    color: var(--text);
    border-color: var(--border);
}
.btn-secondary:hover { background: var(--bg); border-color: var(--text-muted); }

.btn-success {
    background: var(--success);
    color: white;
    border-color: var(--success);
}

.btn-sm { padding: 0.25rem 0.5rem; font-size: 0.8rem; }

.form-control {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: var(--surface);
    font-size: 0.9rem;
    font-family: inherit;
    color: var(--text);
}
.form-control:focus { outline: none; border-color: var(--accent); }

textarea.form-control { font-family: inherit; resize: vertical; }

.form-group { margin-bottom: 1rem; }
.form-group label { display: block; margin-bottom: 0.25rem; font-weight: 500; font-size: 0.875rem; }

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
    margin-bottom: 1rem;
}

.form { max-width: 800px; }

.inline-form {
    display: flex;
    gap: 0.5rem;
    align-items: flex-start;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}
.inline-form .form-control { width: auto; flex: 1; min-width: 200px; }
.inline-form textarea.form-control { width: 100%; }

.alert {
    padding: 0.75rem 1rem;
    border-radius: 4px;
    margin-bottom: 1rem;
}
.alert-success { background: #e6f4ea; color: var(--success); border: 1px solid #c8e3cf; }
.alert-error { background: #fce8e8; color: var(--error); border: 1px solid #f1c4c4; }

.empty-state {
    color: var(--text-muted);
    padding: 2rem;
    text-align: center;
    background: var(--surface);
    border: 1px dashed var(--border);
    border-radius: 4px;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 4px;
    overflow: hidden;
}
.data-table th, .data-table td { padding: 0.75rem 1rem; text-align: left; border-bottom: 1px solid var(--border); }
.data-table th { background: var(--bg); font-weight: 600; font-size: 0.875rem; }
.data-table tr:last-child td { border-bottom: none; }
.data-table a { color: var(--accent); text-decoration: none; }

.status {
    display: inline-block;
    padding: 0.125rem 0.5rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 500;
    background: var(--border);
    color: var(--text);
}
.status-draft { background: #efe9d9; color: #8b6f1c; }
.status-scripting, .status-generating { background: #d9e7f0; color: #2c5d80; }
.status-assetsready, .status-exported { background: #d9e9d9; color: var(--success); }
.status-published { background: var(--success); color: white; }
.status-queued { background: #fce5b4; color: #8b6418; }
.status-generated { background: #d9e9d9; color: var(--success); }
.status-failed { background: #f1c4c4; color: var(--error); }

.channel-selector { margin-bottom: 1.5rem; display: flex; gap: 0.5rem; align-items: center; }
.channel-pill {
    padding: 0.25rem 0.75rem;
    border-radius: 16px;
    background: var(--surface);
    border: 1px solid var(--border);
    text-decoration: none;
    color: var(--text);
    font-size: 0.875rem;
}
.channel-pill.active { background: var(--accent); color: white; border-color: var(--accent); }

.topic-block {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 1rem 1.25rem;
    margin-bottom: 2rem;
}
.topic-block h3 { margin-top: 0; color: var(--text-muted); text-transform: uppercase; font-size: 0.75rem; letter-spacing: 0.05em; }
.topic-block p { margin: 0; }

.section-header { display: flex; justify-content: space-between; align-items: center; margin: 2rem 0 1rem; }
.section-header h2 { margin: 0; }

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

.scene-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 4px;
    overflow: hidden;
    text-decoration: none;
    color: var(--text);
    transition: border-color 0.15s, transform 0.15s;
}
.scene-card:hover { border-color: var(--accent); transform: translateY(-2px); }

.scene-thumb { aspect-ratio: 16 / 9; background: var(--bg); display: flex; align-items: center; justify-content: center; }
.scene-thumb img { width: 100%; height: 100%; object-fit: cover; }
.scene-placeholder { color: var(--text-muted); font-weight: 500; }

.scene-info { padding: 0.75rem; }
.scene-number { font-size: 0.75rem; text-transform: uppercase; color: var(--text-muted); letter-spacing: 0.05em; }
.scene-label { font-weight: 500; margin: 0.125rem 0 0.5rem 0; }
.scene-meta { display: flex; gap: 0.5rem; flex-wrap: wrap; font-size: 0.75rem; color: var(--text-muted); }

.register-pill {
    padding: 0.125rem 0.5rem;
    border-radius: 8px;
    font-size: 0.7rem;
}
.register-dark { background: #2a2620; color: #f0e8d8; }
.register-bright { background: #f5f0e0; color: #6b6457; border: 1px solid var(--border); }

.shot-type {
    padding: 0.125rem 0.5rem;
    border-radius: 8px;
    background: var(--bg);
    border: 1px solid var(--border);
    font-size: 0.7rem;
}

.hidden { display: none; }

.prompts-section { margin-top: 2rem; }
.prompt-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 1rem;
    margin-bottom: 0.75rem;
}
.prompt-header { display: flex; gap: 0.5rem; align-items: center; margin-bottom: 0.5rem; flex-wrap: wrap; }
.prompt-text { color: var(--text-muted); font-size: 0.875rem; line-height: 1.5; white-space: pre-wrap; }

.provider-badge {
    padding: 0.125rem 0.5rem;
    border-radius: 8px;
    background: var(--warm);
    color: white;
    font-size: 0.75rem;
    font-weight: 500;
}
.provider-fluxdev, .provider-fluxpro { background: #6741b8; }
.provider-fluxschnell { background: #8861d8; }
.provider-midjourney { background: var(--accent); }

.inline { display: inline; }

.assets-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.asset-card {
    background: var(--surface);
    border: 2px solid var(--border);
    border-radius: 4px;
    overflow: hidden;
    transition: border-color 0.15s;
}
.asset-card.selected { border-color: var(--success); }
.asset-card img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; display: block; }
.asset-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem;
    font-size: 0.75rem;
    color: var(--text-muted);
}
.asset-card form { padding: 0 0.5rem 0.5rem; }
.asset-card form button { width: 100%; }

.scene-edit { background: var(--surface); border: 1px solid var(--border); border-radius: 4px; padding: 1.5rem; margin-bottom: 2rem; }

.back-link { color: var(--text-muted); text-decoration: none; font-size: 0.875rem; }
.back-link:hover { color: var(--accent); }

/* =============================================================================
   Cost dashboard
   ============================================================================= */

td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }

.cost-section { margin-bottom: 2rem; }
.cost-section h2 { font-size: 1rem; margin-bottom: 0.5rem; }

.cost-total {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 0.5rem 0.75rem;
    font-size: 0.95rem;
}

/* =============================================================================
   Script page — readable scene-by-scene document view
   ============================================================================= */

.script-page-header .actions { display: flex; gap: 0.75rem; align-items: center; flex-wrap: wrap; }
.script-meta { color: var(--text-muted); font-size: 0.875rem; }

.script-document {
    max-width: 720px;
    margin: 1.5rem auto;
    padding: 0 1rem;
}

.script-scene {
    padding-bottom: 2rem;
    margin-bottom: 2rem;
    border-bottom: 1px solid var(--border);
}
.script-scene:last-child {
    border-bottom: none;
}

.script-scene-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 1rem;
    margin-bottom: 0.25rem;
}
.script-scene-number {
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    color: var(--text-muted);
}
.script-scene-meta {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-align: right;
}

.script-scene-label { margin: 0 0 1rem 0; font-size: 1.15rem; font-weight: 600; }
.script-scene-label a { color: var(--text); text-decoration: none; }
.script-scene-label a:hover { color: var(--accent); }

.script-scene-narration {
    line-height: 1.65;
    font-size: 1rem;
}
.script-scene-narration p { margin: 0 0 0.85rem 0; }
.script-scene-narration p:last-child { margin-bottom: 0; }
.script-narration-empty { color: var(--text-muted); font-style: italic; }

/* Print: drop chrome, reset spacing for paper. */
@media print {
    nav, .page-header .actions, .back-link { display: none !important; }
    body, main { background: #fff !important; color: #000 !important; }
    .script-document { max-width: none; margin: 0; padding: 0; }
    .script-scene { page-break-inside: avoid; border-bottom-color: #ccc; }
    .script-scene-label a { color: #000 !important; }
}

/* =============================================================================
   Script page — inline narration editing
   ============================================================================= */

/* Read mode — hover affordance. Subtle so it doesn't fight the document feel. */
.script-scene-narration {
    cursor: pointer;
    border-radius: 4px;
    padding: 0.25rem 0.5rem;
    margin-left: -0.5rem;
    margin-right: -0.5rem;
    transition: background-color 0.1s ease, box-shadow 0.1s ease;
}
.script-scene-narration:hover {
    background-color: var(--bg);
    box-shadow: 0 0 0 1px var(--border);
}
.script-scene-narration--editing {
    cursor: default;
    background-color: var(--surface);
    box-shadow: 0 0 0 1px var(--accent);
}
.script-scene-narration--saved {
    animation: narration-saved-flash 0.9s ease-out;
}
@keyframes narration-saved-flash {
    0%   { background-color: rgba(45, 107, 58, 0.18); }
    100% { background-color: transparent; }
}

.script-narration-edit {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

/* Match read-mode typography so the page doesn't visually jump on edit. */
.script-narration-editor {
    font-family: inherit;
    font-size: 1rem;
    line-height: 1.65;
    color: var(--text);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 0.5rem 0.75rem;
    width: 100%;
    box-sizing: border-box;
    resize: vertical;
    min-height: 6rem;
}
.script-narration-editor:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(184, 84, 28, 0.15);
}

.script-narration-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    flex-wrap: wrap;
}
.script-narration-hint {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-left: auto;
}

.script-narration-error {
    font-size: 0.85rem;
    color: var(--error);
    background: rgba(165, 41, 41, 0.06);
    border: 1px solid rgba(165, 41, 41, 0.3);
    border-radius: 4px;
    padding: 0.4rem 0.6rem;
}

/* Print: never show the edit affordance or any in-flight editor. */
@media print {
    .script-scene-narration { cursor: auto; padding: 0; margin: 0; box-shadow: none; }
    .script-narration-edit, .script-narration-hint, .script-narration-actions { display: none !important; }
}

/* =============================================================================
   Project detail — Script overview banner above the scenes grid
   ============================================================================= */

.script-overview {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 1rem 1.25rem;
    margin-bottom: 1.5rem;
}
.script-overview .section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin: 0;
}
.script-overview h2 { margin: 0; font-size: 1.05rem; }
.script-overview-meta {
    margin: 0.5rem 0 0 0;
    color: var(--text-muted);
    font-size: 0.875rem;
}

/* Push Delete to the right edge of the prompt-card header so it sits away
   from the Generate primary action. */
.prompt-delete-form { margin-left: auto; }

/* =============================================================================
   Scene editor — Generate-from-brief panel
   ============================================================================= */

.generate-prompt-panel {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 0.5rem 0.75rem;
}
.generate-prompt-panel summary {
    cursor: pointer;
    font-size: 0.875rem;
    color: var(--accent);
    user-select: none;
}
.generate-prompt-panel[open] summary { margin-bottom: 0.5rem; }

.generate-prompt-body {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
.generate-prompt-actions {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    flex-wrap: wrap;
}
.generate-prompt-hint {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.generate-prompt-error {
    font-size: 0.85rem;
    color: var(--error);
    background: rgba(165, 41, 41, 0.06);
    border: 1px solid rgba(165, 41, 41, 0.3);
    border-radius: 4px;
    padding: 0.4rem 0.6rem;
}

/* =============================================================================
   Scene editor — prompt card inline edit
   ============================================================================= */

.prompt-card--editing {
    background: var(--surface);
    box-shadow: 0 0 0 1px var(--accent);
}
.prompt-card--saved {
    animation: prompt-saved-flash 0.9s ease-out;
}
@keyframes prompt-saved-flash {
    0%   { background-color: rgba(45, 107, 58, 0.18); }
    100% { background-color: transparent; }
}

.prompt-edit-form {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
.prompt-edit-header { display: flex; gap: 0.5rem; align-items: center; }
.prompt-edit-provider { max-width: 220px; }

.prompt-edit-text {
    font-family: inherit;
    font-size: 0.95rem;
    line-height: 1.5;
    color: var(--text);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 0.5rem 0.75rem;
    width: 100%;
    box-sizing: border-box;
    resize: vertical;
    min-height: 6rem;
}
.prompt-edit-text:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(184, 84, 28, 0.15);
}

.prompt-edit-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    flex-wrap: wrap;
}
.prompt-edit-hint {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-left: auto;
}
.prompt-edit-error {
    font-size: 0.85rem;
    color: var(--error);
    background: rgba(165, 41, 41, 0.06);
    border: 1px solid rgba(165, 41, 41, 0.3);
    border-radius: 4px;
    padding: 0.4rem 0.6rem;
}

/* =============================================================================
   Asset preview lightbox (Scene Detail)
   ============================================================================= */

.asset-preview-btn {
    border: 0;
    padding: 0;
    background: transparent;
    cursor: zoom-in;
    display: block;
    width: 100%;
}
.asset-preview-btn img { display: block; }
.asset-preview-btn:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: -2px;
}

dialog.asset-lightbox {
    border: 0;
    padding: 0;
    background: transparent;
    max-width: 95vw;
    max-height: 95vh;
    overflow: visible;
}
dialog.asset-lightbox::backdrop {
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(4px);
}
dialog.asset-lightbox img {
    display: block;
    max-width: 95vw;
    max-height: 95vh;
    border-radius: 4px;
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.5);
}
.asset-lightbox-close {
    position: fixed;
    top: 1rem;
    right: 1rem;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 0;
    background: rgba(0, 0, 0, 0.6);
    color: #fff;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}
.asset-lightbox-close:hover { background: rgba(0, 0, 0, 0.9); }

/* Print: don't carry the lightbox into paper output. */
@media print { dialog.asset-lightbox { display: none !important; } }

/* =============================================================================
   Scene editor — Shot List (ordered cut) + Asset Library
   ============================================================================= */

.shots-section, .library-section { margin-top: 2rem; }
.section-help {
    color: var(--text-muted);
    font-size: 0.875rem;
    margin: 0 0 1rem 0;
}

.shots-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    transition: background-color 0.4s ease;
    border-radius: 6px;
}
.shots-list--saved { background: rgba(45, 107, 58, 0.10); }

.shot-row {
    display: grid;
    grid-template-columns: 32px 200px 1fr auto;
    gap: 1rem;
    align-items: start;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 0.75rem;
}
.shot-row--dragging { opacity: 0.4; }
.shot-row--drop-above { border-top: 3px solid var(--accent); }
.shot-row--drop-below { border-bottom: 3px solid var(--accent); }

.shot-handle {
    cursor: grab;
    color: var(--text-muted);
    font-size: 1.4rem;
    line-height: 1;
    padding-top: 0.5rem;
    user-select: none;
    text-align: center;
}
.shot-handle:active { cursor: grabbing; }

.shot-thumb img {
    width: 100%;
    aspect-ratio: 16 / 9;
    object-fit: cover;
    display: block;
    border-radius: 4px;
}
.shot-thumb audio { width: 100%; }

.shot-info { display: flex; flex-direction: column; gap: 0.5rem; min-width: 0; }
.shot-number { font-weight: 600; font-size: 0.95rem; }
.shot-meta {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    flex-wrap: wrap;
    font-size: 0.85rem;
    color: var(--text-muted);
}
.shot-duration-form {
    display: inline-flex;
    gap: 0.4rem;
    align-items: center;
    margin: 0;
}
.shot-duration-label {
    display: inline-flex;
    gap: 0.3rem;
    align-items: center;
    font-size: 0.85rem;
    color: var(--text-muted);
}
.shot-duration-input {
    width: 70px;
    padding: 0.2rem 0.4rem;
    height: auto;
}
.shot-duration-unit { font-size: 0.85rem; }

.shot-notes-block summary {
    cursor: pointer;
    font-size: 0.8rem;
    color: var(--accent);
}
.shot-notes-input { font-size: 0.85rem; }

.shot-actions {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    align-items: stretch;
}
.shot-actions .btn { white-space: nowrap; }

@media (max-width: 720px) {
    .shot-row {
        grid-template-columns: 32px 1fr;
        grid-template-rows: auto auto auto;
    }
    .shot-thumb { grid-column: 2 / 3; }
    .shot-info  { grid-column: 2 / 3; }
    .shot-actions {
        grid-column: 1 / 3;
        flex-direction: row;
        flex-wrap: wrap;
    }
    .shot-handle { grid-row: 1 / 4; }
}

/* Library grid: same look as the old assets grid. */
.library-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}
.library-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 6px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}
.library-card .asset-preview-btn img {
    width: 100%;
    aspect-ratio: 16 / 9;
    object-fit: cover;
    display: block;
}
.library-card audio { width: 100%; padding: 0.5rem; box-sizing: border-box; }
.library-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem;
    font-size: 0.75rem;
    color: var(--text-muted);
}
.library-card form { padding: 0 0.5rem 0.5rem; }
.library-card form button { width: 100%; }

/* =============================================================================
   Scene Detail — Move-to-scene affordance (prompts + library cards)
   ============================================================================= */

.move-block {
    display: inline-block;
}
.move-block summary {
    list-style: none;
    cursor: pointer;
}
.move-block summary::-webkit-details-marker { display: none; }
.move-form {
    display: flex;
    gap: 0.4rem;
    align-items: center;
    margin-top: 0.4rem;
    flex-wrap: wrap;
}
.move-form select {
    min-width: 220px;
}

/* Library card move block: full-width, sits below the Add to cut button. */
.library-card .move-block { padding: 0 0.5rem 0.5rem; }
.library-card .move-block-summary-card { width: 100%; text-align: center; }
.library-card .move-form { padding-top: 0.25rem; }

/* =============================================================================
   Scene Detail — Scoped chat panel
   ============================================================================= */

.scene-chat-section {
    margin-top: 2rem;
}
.scene-chat-panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 0.75rem 1rem;
}
.scene-chat-summary {
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    list-style: none;
    user-select: none;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.scene-chat-summary::-webkit-details-marker { display: none; }
.scene-chat-count {
    font-weight: 400;
    font-size: 0.8rem;
    color: var(--text-muted);
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 0.05rem 0.5rem;
}
.scene-chat-panel[open] .scene-chat-summary {
    margin-bottom: 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border);
}
.scene-chat-body {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}
.scene-chat-messages .messages-list {
    max-height: 60vh;
    overflow-y: auto;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 0.75rem;
}
.scene-chat-messages .empty-state {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin: 0;
}

/* =============================================================================
   Scene Detail — prev/next/jump nav
   ============================================================================= */

.scene-nav {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    flex-wrap: wrap;
}
.scene-nav-disabled {
    opacity: 0.4;
    cursor: not-allowed;
    pointer-events: none;
}
.scene-jump-select {
    padding: 0.25rem 0.4rem;
    font-size: 0.85rem;
    height: auto;
    width: auto;
    min-width: 200px;
    max-width: 320px;
}

/* =============================================================================
   Voiceover section — Generate / Regenerate, takes list, stale indicator
   ============================================================================= */

.voiceover-controls {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    margin-bottom: 1rem;
}
.voiceover-form { gap: 0.5rem; align-items: flex-end; }
.voiceover-voice-label { display: flex; flex-direction: column; gap: 0.2rem; font-size: 0.8rem; color: var(--text-muted); }
.voiceover-voice-label select { min-width: 220px; }
.voiceover-cost-hint { color: var(--text-muted); font-size: 0.8rem; margin: 0; }
.voiceover-warning {
    color: var(--error);
    background: rgba(165, 41, 41, 0.06);
    border: 1px solid rgba(165, 41, 41, 0.3);
    border-radius: 4px;
    padding: 0.4rem 0.6rem;
    font-size: 0.85rem;
    margin: 0.25rem 0 0 0;
}
.voiceover-warning code {
    background: rgba(0, 0, 0, 0.05);
    padding: 0 0.25rem;
    border-radius: 3px;
    font-size: 0.85em;
}

.voiceover-takes {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
.voiceover-take {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 0.5rem 0.75rem;
}
.voiceover-take audio { width: 100%; margin-top: 0.4rem; }
.voiceover-take-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
}
.voiceover-take-label { font-size: 0.85rem; font-weight: 600; }
.voiceover-take-time { color: var(--text-muted); font-weight: 400; margin-left: 0.5rem; }

.voiceover-stale-badge {
    background: #fff3d6;
    color: #6b4e0a;
    border: 1px solid #d6a55c;
    border-radius: 12px;
    padding: 0.05rem 0.5rem;
    font-size: 0.75rem;
    font-weight: 500;
}
.voiceover-take--stale {
    border-left: 3px solid #d6a55c;
    background: rgba(255, 248, 232, 0.5);
}

/* =============================================================================
   Copy projects/scenes — collapsible form + provenance line
   ============================================================================= */

.copy-block { display: inline-block; }
.copy-block summary { list-style: none; cursor: pointer; }
.copy-block summary::-webkit-details-marker { display: none; }
.copy-form {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-top: 0.5rem;
    padding: 0.75rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 4px;
    min-width: 280px;
}
.copy-form label {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    font-size: 0.85rem;
    color: var(--text-muted);
}
.copy-form input,
.copy-form select { width: 100%; box-sizing: border-box; }

.provenance-note {
    color: var(--text-muted);
    font-size: 0.85rem;
    margin: 0.25rem 0 1rem 0;
}
.provenance-note a { color: var(--accent); }
.provenance-deleted { font-style: italic; }
