/**
 * 🎬 STORYBOARD STYLES
 * Digital Studio için Storyboard mode stilleri
 * Ana stil dosyasıyla tam uyumlu
 * 
 * @version 1.0.0
 * @author Digital Studio
 */

/* ============================================================================
   STORYBOARD WIZARD - Sol Panel
   ============================================================================ */

.storyboard-wizard {
    display: none;
    margin-top: var(--spacing-md);
}

.storyboard-wizard.active {
    display: block;
}

/* Wizard Content - Matches main 'Generation Container' body background */
.storyboard-wizard-content {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
    padding: 16px;
    /* Main panel light mode gradient: Tertiary -> Secondary */
    background: linear-gradient(135deg, var(--bg-tertiary) 0%, var(--bg-secondary) 100%);
    border-radius: 0 0 16px 16px;
    /* Alt köşeler oval */
    /* Üst tarafta border-top ekleyebiliriz card-header ile ayrım için */
    border-top: 1px solid var(--border-light);
}

/* Dark mode override matching main panel dark gradient exactly */
.dark-mode .storyboard-wizard-content {
    /* Generation Container Dark Mode: #2C2C2E -> #1C1C1E */
    background: linear-gradient(135deg, var(--ds-surface-2) 0%, var(--ds-surface) 100%);
    border-top-color: rgba(255, 255, 255, 0.05);
}

/* Wizard Sections */
.wizard-section {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
}

.wizard-label {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.wizard-label i {
    font-size: 0.75rem;
    color: var(--primary-color);
    opacity: 0.7;
}

/* Wizard Input - Same style as main generation-prompt-input */
/* Wizard Input - Exact match with generation-prompt-input */
.wizard-input {
    width: 100%;
    background: var(--bg-primary);
    /* styles.css:3836 */
    border: 1px solid var(--border-medium);
    /* styles.css:3837 */
    border-radius: 24px;
    /* styles.css:3838 */
    padding: 10px 16px;
    color: var(--text-primary);
    font-size: 0.85rem;
    height: 38px;
    /* Slightly smaller height for wizard context */
    transition: all 0.2s ease;
}

.wizard-input::placeholder {
    color: var(--text-muted);
}

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

/* Expandable Input Wrapper */
.expandable-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.expandable-input-wrapper .expandable-input {
    padding-right: 36px;
}

.expand-btn {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    border-radius: 50%;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s ease;
}

.expand-btn:hover {
    background: var(--bg-secondary);
    color: var(--primary-color);
}

.expand-btn i {
    font-size: 0.65rem;
}

/* Expanded textarea */
.expanded-textarea {
    margin-top: 0;
}

.hidden {
    display: none !important;
}

/* Wizard Textarea - For content brief */
.wizard-textarea {
    width: 100%;
    background: var(--bg-primary);
    border: 1px solid var(--border-medium);
    border-radius: 16px;
    padding: 12px 16px;
    color: var(--text-primary);
    font-size: 0.85rem;
    font-family: inherit;
    line-height: 1.5;
    resize: vertical;
    min-height: 80px;
    transition: all 0.2s ease;
}

/* Wizard Textarea Compact - Single line default, expandable */
.wizard-textarea-compact {
    width: 100%;
    background: var(--bg-primary);
    border: 1px solid var(--border-medium);
    border-radius: 9999px;
    padding: 10px 16px;
    color: var(--text-primary);
    font-size: 0.85rem;
    font-family: inherit;
    line-height: 1.4;
    resize: vertical;
    min-height: 38px;
    max-height: 200px;
    overflow-y: auto;
    transition: all 0.2s ease;
}

.wizard-textarea::placeholder,
.wizard-textarea-compact::placeholder {
    color: var(--text-muted);
    font-size: 0.8rem;
}

.wizard-textarea:focus,
.wizard-textarea-compact:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(var(--primary-rgb), 0.1);
}

/* Input hint */
.input-hint {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 6px;
    font-size: 0.7rem;
    color: var(--text-muted);
}

.input-hint i {
    font-size: 0.65rem;
    opacity: 0.7;
}

/* Dark mode wizard input - matches generation-prompt-input exactly */
.dark-mode .wizard-input {
    background: var(--ds-surface-2);
    border-color: var(--ds-line);
}

.dark-mode .wizard-input:focus {
    background: var(--ds-surface-2);
}

.dark-mode .wizard-textarea,
.dark-mode .wizard-textarea-compact {
    background: var(--ds-surface-2);
    border-color: var(--ds-line);
}

.dark-mode .wizard-textarea:focus,
.dark-mode .wizard-textarea-compact:focus {
    background: var(--ds-surface-2);
}

/* Frame Count Selector - Fits single row, same style as compact-select-toggle */
.frame-count-selector {
    display: flex;
    align-items: center;
    gap: 6px;
}

.frame-count-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    flex: 1;
    height: 38px;
    padding: 0 12px;
    border-radius: 9999px;
    border: 1px solid var(--border-light);
    background: transparent;
    color: var(--text-secondary);
    font-size: 0.78rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

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

.frame-count-btn.active {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: var(--ds-accent-ink);
}

.frame-count-btn .count-number {
    font-weight: 600;
}

.frame-count-btn .count-label {
    font-size: 0.65rem;
    text-transform: uppercase;
    opacity: 0.8;
}

.frame-count-btn.active .count-number,
.frame-count-btn.active .count-label {
    color: var(--ds-accent-ink);
    opacity: 1;
}

/* Wizard Info - Minimal */
.wizard-info {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    padding: 8px 12px;
    background: rgba(var(--primary-color-rgb), 0.06);
    border-radius: 9999px;
    font-size: 0.72rem;
    color: var(--text-muted);
}

.wizard-info i {
    color: var(--primary-color);
    font-size: 0.7rem;
}

/* Storyboard Start Button - Same size as other buttons, single color */
.storyboard-start-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    height: 38px;
    padding: 0 16px;
    border: none;
    border-radius: 9999px;
    background: var(--primary-color);
    color: var(--ds-accent-ink);
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-top: var(--spacing-sm);
}

.storyboard-start-btn:hover {
    background: var(--primary-dark);
}

.storyboard-start-btn:active {
    transform: translateY(0);
}

.storyboard-start-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

.storyboard-start-btn.success {
    background: var(--success-color);
}

.storyboard-start-btn i {
    font-size: 0.9rem;
}

/* ============================================================================
   STORYBOARD VIEWER - Ana İçerik
   ============================================================================ */

.storyboard-viewer {
    display: none;
    flex: 1;
    min-height: 0;
    flex-direction: column;
    gap: var(--spacing-lg);
    padding: var(--spacing-lg);
    background: var(--bg-elevated);
    border: 1px solid var(--border-light);
    border-radius: 14px;
    /* Fill the full height of the (height:100%, flex-column) .results-panel via
       flex:1 — no fixed dvh cap, which left the panel rendering "half" with room
       below it. Inner grid / live stage scroll; overflow-y here is the safe net. */
    overflow-y: auto;
    box-shadow: 0 16px 42px rgba(var(--ds-accent-rgb), 0.08), 0 1px 3px rgba(var(--ds-accent-rgb), 0.04);
}

.storyboard-viewer.active {
    display: flex;
}

.results-panel.sb-viewer-active > :not(#storyboardViewer) {
    display: none !important;
}

.results-panel.sb-viewer-active > #storyboardViewer {
    display: flex !important;
}

/* Viewer Header */
.storyboard-viewer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-bottom: var(--spacing-md);
    border-bottom: 1px solid var(--border-light);
}

.storyboard-viewer-header h3 {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.storyboard-viewer-header h3 i {
    color: var(--primary-color);
}

.storyboard-quality-summary {
    flex: 0 0 auto;
}

.sb-board-scorecard {
    display: grid;
    grid-template-columns: minmax(130px, 0.8fr) minmax(240px, 1.6fr) minmax(160px, 0.9fr);
    gap: var(--spacing-md);
    align-items: stretch;
    padding: 14px;
    border: 1px solid var(--border-light);
    border-radius: 10px;
    background: var(--bg-secondary);
}

.sb-board-scorecard.is-pending {
    display: flex;
    align-items: center;
}

.sb-board-score-main,
.sb-board-score-axes,
.sb-board-weak {
    min-width: 0;
}

.sb-board-score-label,
.sb-board-weak-label {
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--text-primary);
}

.sb-board-score-value {
    margin-top: 6px;
    font-size: 2rem;
    line-height: 1;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
}

.sb-board-score-value.good { color: var(--ds-ok); }
.sb-board-score-value.warn { color: var(--ds-warn); }
.sb-board-score-value.bad { color: var(--ds-danger); }

.sb-board-score-caption {
    margin-top: 6px;
    font-size: 0.76rem;
    color: var(--text-secondary);
}

.sb-board-weak-label {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 10px;
}

.sb-board-weak-label i {
    color: var(--ds-accent);
}

.sb-board-weak-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.sb-weak-frame-chip {
    min-height: 28px;
    padding: 4px 10px;
    border-radius: 999px;
    border: 1px solid rgba(var(--ds-accent-rgb), 0.35);
    background: rgba(var(--ds-accent-rgb), 0.12);
    color: var(--ds-accent);
    font-size: 0.78rem;
    font-weight: 700;
    cursor: pointer;
}

.sb-weak-frame-chip:hover {
    border-color: rgba(var(--ds-accent-rgb), 0.65);
    background: rgba(var(--ds-accent-rgb), 0.18);
}

.sb-weak-none {
    color: var(--text-secondary);
    font-size: 0.78rem;
}

/* "Bakılmalı" — a frame QC refused to pass, or whose measured product/character
   axis collapsed behind a healthy mean. Read as a warning, not as a task: the
   bulk-repair button deliberately does not act on these. */
.sb-board-flagged {
    margin-top: 10px;
}

/* The mark has to be on the picture. A frame delivered with the wrong product
   looked exactly like a good one on the board, and only a person opening the
   JSON found out. */
.frame-flagged .frame-image-wrapper {
    outline: 3px solid rgba(var(--ds-danger-rgb), 0.85);
    outline-offset: -3px;
    border-radius: inherit;
}

.frame-flagged .frame-image-wrapper img {
    filter: saturate(0.92);
}

.frame-flag-overlay {
    position: absolute;
    left: 8px;
    bottom: 8px;
    z-index: 4;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    max-width: calc(100% - 16px);
    padding: 5px 9px;
    border-radius: 8px;
    background: rgba(var(--ds-danger-rgb), 0.92);
    color: var(--ds-bg);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.01em;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
    pointer-events: auto;
    cursor: help;
}

.frame-flag-overlay i {
    font-size: 0.8rem;
}

.sb-flagged-frame-chip {
    border-color: rgba(var(--ds-danger-rgb), 0.4);
    background: rgba(var(--ds-danger-rgb), 0.1);
    color: var(--ds-danger);
    font-weight: 600;
    text-align: left;
    max-width: 100%;
}

.sb-flagged-frame-chip:hover {
    border-color: rgba(var(--ds-danger-rgb), 0.7);
    background: rgba(var(--ds-danger-rgb), 0.16);
}

/* Storyboard Actions */
.storyboard-actions {
    display: flex;
    gap: var(--spacing-sm);
}

.storyboard-action-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: var(--spacing-sm) var(--spacing-md);
    border: 1px solid var(--border-medium);
    border-radius: 9999px;
    background: var(--bg-elevated);
    color: var(--text-secondary);
    font-size: 0.75rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
}

/* What a paid button costs, on the button (2 Oct, §0.29 2.7). */
.storyboard-action-price {
    font-size: 0.6875rem;
    font-weight: 500;
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.storyboard-action-btn:disabled {
    cursor: not-allowed;
    opacity: 0.6;
    border-color: var(--border-light);
    color: var(--text-muted);
    background: var(--bg-elevated);
}

.storyboard-action-btn:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
    background: rgba(var(--primary-color-rgb), 0.05);
}

.storyboard-action-btn:focus-visible,
.storyboard-close-btn:focus-visible,
.frame-action-btn:focus-visible,
.frame-insert-slot:focus-visible,
.sb-btn:focus-visible,
.sb-modal-close:focus-visible {
    outline: 2px solid rgba(var(--primary-color-rgb), 0.55);
    outline-offset: 2px;
}

.storyboard-action-btn.primary {
    background: var(--primary-color);
    color: var(--ds-accent-ink);
    border-color: var(--primary-color);
}

.storyboard-action-btn.primary:hover {
    background: var(--primary-dark);
}

/* Storyboard Close Button */
.storyboard-close-btn {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border-medium);
    border-radius: 50%;
    background: var(--bg-elevated);
    color: var(--text-secondary);
    font-size: 0.85rem;
    cursor: pointer;
    transition: all var(--transition-fast);
    margin-left: var(--spacing-sm);
}

.storyboard-close-btn:hover {
    border-color: var(--error-color);
    color: var(--error-color);
    background: rgba(var(--ds-danger-rgb), 0.1);
}

/* Header Storyboard Toggle Button */
.storyboard-toggle-btn {
    position: relative;
}

.storyboard-toggle-btn.active {
    background: var(--primary-color);
    color: var(--ds-accent-ink);
    border-color: var(--primary-color);
}

.storyboard-toggle-btn.active:hover {
    background: var(--primary-dark);
}

/* ============================================================================
   CONTACT SHEET GRID
   ============================================================================ */
.storyboard-anchor-panel {
    display: flex;
    gap: var(--spacing-md);
    align-items: center;
    padding: var(--spacing-md);
    margin-bottom: var(--spacing-md);
    border-radius: var(--border-radius);
    background: var(--bg-elevated);
    border: 1px solid var(--border-color);
}

.storyboard-anchor-panel .anchor-preview {
    position: relative;
    width: 160px;
    flex: 0 0 160px;
    aspect-ratio: 3/4;
    overflow: hidden;
    border-radius: var(--border-radius);
    background: var(--bg-tertiary);
}

.storyboard-anchor-panel .anchor-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.storyboard-anchor-panel .anchor-badge {
    position: absolute;
    top: 8px;
    left: 8px;
    padding: 4px 8px;
    border-radius: 999px;
    font-size: 0.65rem;
    font-weight: 600;
    color: var(--ds-on-media);
    background: rgba(var(--ds-accent-rgb), 0.9);
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.storyboard-anchor-panel .anchor-info {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1;
}

.storyboard-anchor-panel .anchor-title {
    font-weight: 600;
    font-size: 0.95rem;
}

.storyboard-anchor-panel .anchor-subtitle {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.storyboard-action-btn.anchor-approve {
    background: var(--primary-color);
    color: var(--ds-accent-ink);
    border-color: transparent;
}

.storyboard-action-btn.anchor-approve:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(var(--primary-rgb, 255, 107, 53), 0.35);
}

.contact-sheet-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--spacing-md);
    flex: 1;
    min-height: 0;
    align-content: start;
    /* Rows hug their content and items never stretch — without this, the
       height-constrained grid distributes rows to fit, which silently defeats
       the cards' aspect-ratio and renders them as short landscape strips. */
    grid-auto-rows: max-content;
    align-items: start;
    overflow-y: auto;
    padding-right: 4px;
}

.contact-sheet-grid.social-layout-grid {
    display: flex;
    flex-wrap: wrap;
    gap: var(--spacing-md);
    align-items: flex-start;
    align-content: flex-start;
    justify-content: flex-start !important;
    grid-template-columns: none !important;
    grid-auto-rows: initial;
}

/* Empty / loading state: center the placeholder in the full panel area */
.contact-sheet-grid.is-empty {
    align-content: center;
}

/* ── Living generation stage: narration (left) + streaming frames (right) ──── */
.sb-live-stage {
    display: flex;
    gap: var(--spacing-lg);
    flex: 1;
    min-height: 0;
}

.sb-live-narration {
    flex: 0 0 clamp(200px, 26%, 300px);
    display: flex;
    flex-direction: column;
    min-height: 0;
    background: var(--bg-secondary);
    border: 1px solid var(--border-light);
    border-radius: 10px;
    padding: var(--spacing-md);
}

.sb-live-narration-head {
    display: flex;
    align-items: center;
    gap: 8px;
    padding-bottom: var(--spacing-sm);
    margin-bottom: var(--spacing-sm);
    border-bottom: 1px solid rgba(var(--primary-color-rgb), 0.2);
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
}

.sb-live-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--primary-color);
    box-shadow: 0 0 0 0 rgba(var(--primary-color-rgb), 0.5);
    animation: sb-live-pulse 1.6s ease-out infinite;
}

@keyframes sb-live-pulse {
    0%   { box-shadow: 0 0 0 0 rgba(var(--primary-color-rgb), 0.45); }
    70%  { box-shadow: 0 0 0 7px rgba(var(--primary-color-rgb), 0); }
    100% { box-shadow: 0 0 0 0 rgba(var(--primary-color-rgb), 0); }
}

.sb-live-pct {
    margin-left: auto;
    font-variant-numeric: tabular-nums;
    font-weight: 600;
    color: var(--primary-color);
}

.sb-live-log {
    list-style: none;
    margin: 0;
    padding: 0 0 var(--spacing-md);
    overflow-y: auto;
    min-height: 0;
    flex: 1;
    scroll-behavior: smooth;
}

.sb-live-line {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 8px 2px;
    font-size: 13px;
    line-height: 1.6;
    color: var(--text-muted);
    opacity: 0.7;
    animation: sb-live-line-in 0.28s ease;
}

@keyframes sb-live-line-in {
    from { opacity: 0; transform: translateY(4px); }
    to   { opacity: 0.7; transform: translateY(0); }
}

/* The opening "getting ready" seed line reads as UI hint, not a real note. */
.sb-live-line.is-setup {
    font-style: italic;
    opacity: 0.55;
}

.sb-live-line.is-active {
    color: var(--text-primary);
    opacity: 1;
    font-weight: 600;
    font-style: normal;
    background: rgba(var(--primary-color-rgb), 0.08);
    border-radius: 8px;
    padding: 8px;
    margin: 0 -6px;
}

.sb-live-bullet {
    flex: 0 0 auto;
    width: 6px;
    height: 6px;
    margin-top: 7px;
    border-radius: 50%;
    background: var(--border-medium);
}

.sb-live-line.is-active .sb-live-bullet {
    background: var(--primary-color);
}

.sb-live-body {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.sb-live-text { flex: 1; }

.sb-live-meta {
    font-size: 10px;
    line-height: 1.3;
    font-weight: 600;
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
}

.sb-live-frames {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    flex: 1;
    min-height: 0;
    align-content: center;
    grid-auto-rows: max-content;
    align-items: start;
    overflow-y: auto;
    padding-right: 4px;
}

.sb-live-slot {
    position: relative;
    width: 100%;
    aspect-ratio: var(--sb-frame-aspect, 3 / 4);
    border-radius: 10px;
    overflow: hidden;
    background: var(--bg-elevated);
    border: 1.5px solid var(--border-light);
    transition: box-shadow var(--transition-fast), border-color var(--transition-fast);
}

.sb-live-slot img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    animation: sb-live-img-in 0.4s ease;
}

@keyframes sb-live-img-in {
    from { opacity: 0; transform: scale(1.02); }
    to   { opacity: 1; transform: scale(1); }
}

.sb-live-slot.is-filled {
    border-color: var(--primary-color);
    box-shadow: var(--shadow-sm);
}

.sb-live-slot-no {
    position: absolute;
    top: 6px;
    left: 6px;
    z-index: 2;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 600;
    color: var(--ds-on-media);
    background: rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(4px);
}

.sb-live-shimmer {
    position: absolute;
    inset: 0;
    background: linear-gradient(
        100deg,
        var(--bg-elevated) 30%,
        var(--bg-tertiary) 50%,
        var(--bg-elevated) 70%
    );
    background-size: 200% 100%;
    animation: sb-live-shimmer 1.4s ease-in-out infinite;
}

@keyframes sb-live-shimmer {
    from { background-position: 200% 0; }
    to   { background-position: -200% 0; }
}

@media (max-width: 720px) {
    .sb-live-stage { flex-direction: column; }
    .sb-live-narration { flex: 0 0 auto; max-height: 160px; }
    .sb-live-frames { align-content: start; }
}

/* Director notes — re-openable log of the run's first-person narration */
.storyboard-action-btn.notes-btn.is-hidden { display: none; }

.sb-notes-list {
    list-style: none;
    margin: 0;
    padding: 0;
    max-height: 50vh;
    overflow-y: auto;
}

.sb-notes-list li {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 11px 2px;
    font-size: 13px;
    line-height: 1.55;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border-light);
}

.sb-notes-list li:last-child { border-bottom: none; }

.sb-notes-list li .sb-notes-no {
    flex: 0 0 auto;
    min-width: 22px;
    height: 22px;
    padding: 0 6px;
    border-radius: 11px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 600;
    color: var(--primary-color);
    background: rgba(var(--primary-color-rgb), 0.1);
}

.sb-notes-body {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.sb-notes-text {
    color: var(--text-primary);
}

.sb-notes-meta {
    font-size: 11px;
    line-height: 1.3;
    font-weight: 600;
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
}

.sb-notes-empty {
    color: var(--text-muted);
    font-size: 13px;
    text-align: center;
    padding: var(--spacing-lg) 0;
}

/* Soft fade as the final contact sheet replaces the live stage */
.contact-sheet-grid.sb-just-revealed {
    animation: sb-grid-fade 0.35s ease;
}

@keyframes sb-grid-fade {
    from { opacity: 0; transform: translateY(4px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* Single Frame */
.contact-sheet-frame {
    position: relative;
    background: var(--bg-elevated);
    border-radius: 10px;
    border: 1px solid var(--border-light);
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
    --frame-info-height: 58px;
}

.contact-sheet-grid.social-layout-grid .contact-sheet-frame.social-content-frame {
    flex: 0 0 auto;
    width: calc(var(--social-contact-card-height, 320px) * var(--social-card-aspect, 4 / 5));
    max-width: min(100%, 360px);
}

.contact-sheet-grid.social-layout-grid .contact-sheet-frame.social-format-vertical {
    max-width: min(100%, 240px);
}

.contact-sheet-grid.social-layout-grid .contact-sheet-frame.social-format-feed {
    max-width: min(100%, 360px);
}

.contact-sheet-grid.social-layout-grid .contact-sheet-frame.social-content-frame .frame-image-wrapper {
    height: var(--social-contact-card-height, 320px);
    aspect-ratio: var(--social-card-aspect, 4 / 5) !important;
}

.contact-sheet-grid.social-layout-grid .contact-sheet-frame.social-content-frame .frame-image-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.contact-sheet-frame:hover {
    transform: translateY(-2px);
    box-shadow: 0 14px 30px rgba(var(--ds-accent-rgb), 0.12);
    border-color: var(--primary-color);
}

.contact-sheet-frame.selected {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(var(--primary-color-rgb), 0.2);
}

/* Frame Status States */
.contact-sheet-frame.approved {
    border-color: rgba(var(--ds-ok-rgb), 0.58);
}

.contact-sheet-frame.locked {
    border-color: rgba(var(--ds-accent-rgb), 0.62);
}

.contact-sheet-frame.rejected {
    border-color: var(--error-color);
    opacity: 0.7;
}

/* Director's Cut States */
.contact-sheet-frame.director-fail {
    border-color: var(--ds-danger) !important;
    box-shadow: 0 0 0 3px rgba(var(--ds-danger-rgb), 0.3), 0 4px 20px rgba(var(--ds-danger-rgb), 0.25) !important;
    animation: director-pulse-fail 2s ease-in-out infinite;
}

.contact-sheet-frame.director-warning {
    border-color: var(--ds-warn) !important;
    box-shadow: 0 0 0 3px rgba(var(--ds-warn-rgb), 0.3) !important;
}

@keyframes director-pulse-fail {

    0%,
    100% {
        box-shadow: 0 0 0 3px rgba(var(--ds-danger-rgb), 0.3), 0 4px 20px rgba(var(--ds-danger-rgb), 0.25);
    }

    50% {
        box-shadow: 0 0 0 6px rgba(var(--ds-danger-rgb), 0.15), 0 4px 30px rgba(var(--ds-danger-rgb), 0.35);
    }
}

/* Director Badge */
.director-badge {
    position: absolute;
    top: 8px;
    left: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    cursor: pointer;
    z-index: 10;
    transition: all 0.2s ease;
}

.director-badge.fail {
    background: linear-gradient(135deg, var(--ds-danger), var(--ds-danger));
    color: var(--ds-on-media);
    box-shadow: 0 2px 8px rgba(var(--ds-danger-rgb), 0.4);
}

.director-badge.warning {
    background: linear-gradient(135deg, var(--ds-warn), var(--ds-warn));
    color: var(--ds-on-media);
    box-shadow: 0 2px 8px rgba(var(--ds-warn-rgb), 0.4);
}

.director-badge:hover {
    transform: scale(1.2);
}

.director-badge.fail:hover {
    background: linear-gradient(135deg, var(--ds-danger), var(--ds-danger));
}

.director-badge i {
    font-size: 0.75rem;
}

/* Badge Tooltip — a sibling of the badge inside the (position:relative) frame
   cell, spanning the cell width so it is never clipped by the image wrapper's
   overflow:hidden and never overflows the right edge of the cell (audit 3.4). */
.badge-tooltip {
    position: absolute;
    top: 42px;
    left: 8px;
    right: 8px;
    padding: 10px 12px;
    background: rgba(0, 0, 0, 0.9);
    color: var(--ds-on-media);
    font-size: 0.7rem;
    line-height: 1.4;
    border-radius: 8px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-4px);
    transition: all 0.2s ease;
    z-index: 100;
    pointer-events: none;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.director-badge:hover ~ .badge-tooltip {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.badge-tooltip strong {
    color: var(--ds-ok);
}

/* Director's Cut Button Special Style */
.storyboard-action-btn.special-director {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border-color: var(--border-light);
    font-weight: 600;
}

.storyboard-action-btn.special-director:hover {
    background: rgba(var(--primary-color-rgb), 0.08);
    color: var(--primary-color);
    transform: translateY(-1px);
    box-shadow: 0 8px 18px rgba(var(--ds-accent-rgb), 0.08);
}

.storyboard-action-btn.weak-repair:not(:disabled) {
    border-color: rgba(var(--ds-accent-rgb), 0.45);
    color: var(--ds-accent);
    background: rgba(var(--ds-accent-rgb), 0.1);
    font-weight: 700;
}

.storyboard-action-btn.weak-repair:not(:disabled):hover {
    border-color: rgba(var(--ds-accent-rgb), 0.75);
    background: rgba(var(--ds-accent-rgb), 0.16);
    color: var(--ds-accent);
}

/* Pipeline transparency: QC verdict badge + reference provenance chip */
.qc-badge {
    position: absolute;
    bottom: 8px;
    left: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    z-index: 10;
    font-size: 11px;
    color: var(--ds-on-media);
    cursor: default;
}
.qc-badge.pass { background: rgba(var(--ds-ok-rgb), 0.82); }
.qc-badge.flag { background: rgba(var(--ds-danger-rgb), 0.92); }
.qc-badge.repaired { background: rgba(var(--ds-accent-rgb), 0.92); }

/* Variation strip — every generated version (incl. QC-rejected) is selectable here;
   the active thumbnail is the frame's current image. QC dot: green pass / red low. */
.frame-variations {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 18;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    max-width: calc(100% - 20px);
    padding: 4px;
    overflow-x: auto;
    scrollbar-width: none;
    background: rgba(var(--ds-surface-rgb), 0.94);
    border: 1px solid rgba(var(--ds-ink-rgb), 0.16);
    border-radius: 12px;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: 0 8px 22px rgba(0, 0, 0, 0.28);
}

.frame-variations::-webkit-scrollbar {
    display: none;
}

.frame-variations.is-compact {
    gap: 3px;
    padding: 3px;
    border-radius: 10px;
}

.frame-variations.is-dense {
    gap: 2px;
    padding: 3px;
    max-width: min(156px, calc(100% - 20px));
    border-radius: 10px;
}

.frame-variation-thumb {
    position: relative;
    flex: 0 0 auto;
    width: 34px;
    height: 34px;
    padding: 0;
    border: 1px solid rgba(255, 255, 255, 0.28);
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.08);
    opacity: 0.82;
    transition: opacity 0.15s ease, border-color 0.15s ease, transform 0.1s ease;
}

.frame-variations.is-compact .frame-variation-thumb {
    width: 28px;
    height: 28px;
    border-radius: 7px;
}

.frame-variations.is-dense .frame-variation-thumb {
    width: 23px;
    height: 23px;
    border-radius: 6px;
}

.frame-variation-thumb:hover {
    opacity: 1;
    transform: translateY(-1px);
    border-color: rgba(255, 255, 255, 0.72);
}

.frame-variation-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.frame-variation-thumb.active {
    opacity: 1;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(var(--primary-color-rgb), 0.35);
}

.frame-variation-index {
    position: absolute;
    top: 2px;
    left: 3px;
    min-width: 11px;
    height: 11px;
    padding: 0 3px;
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.66);
    color: var(--ds-on-media);
    font-size: 7px;
    line-height: 11px;
    font-weight: 800;
    text-align: center;
}

.frame-variations.is-compact .frame-variation-index,
.frame-variations.is-dense .frame-variation-index {
    top: 1px;
    left: 2px;
    min-width: 9px;
    height: 9px;
    padding: 0 2px;
    font-size: 6px;
    line-height: 9px;
}

.frame-variation-badge {
    position: absolute;
    bottom: 2px;
    right: 2px;
    width: 13px;
    height: 13px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 6px;
    color: var(--ds-on-media);
}

.frame-variations.is-compact .frame-variation-badge {
    width: 11px;
    height: 11px;
    font-size: 5px;
}

.frame-variations.is-dense .frame-variation-badge {
    width: 9px;
    height: 9px;
    font-size: 4px;
    bottom: 1px;
    right: 1px;
}

.frame-variation-thumb.qc-pass .frame-variation-badge { background: rgba(var(--ds-ok-rgb), 0.92); }
.frame-variation-thumb.qc-fail .frame-variation-badge { background: rgba(var(--ds-danger-rgb), 0.92); }

.fullscreen-edit-history.storyboard-variation-history {
    position: absolute;
    top: 18px;
    right: 18px;
    left: auto;
    transform: none;
    z-index: 22;
    display: flex;
    align-items: center;
    max-width: min(360px, calc(100% - 36px));
    padding: 6px;
    overflow-x: auto;
    scrollbar-width: none;
}

.fullscreen-edit-history.storyboard-variation-history::-webkit-scrollbar {
    display: none;
}

.frame-variations.modal-variations {
    position: static;
    max-width: none;
    padding: 0;
    background: transparent;
    border: none;
    border-radius: 0;
    box-shadow: none;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
}

.frame-variations.modal-variations .frame-variation-thumb {
    width: 48px;
    height: 48px;
}

.frame-variations.modal-variations.is-compact .frame-variation-thumb {
    width: 40px;
    height: 40px;
}

.frame-variations.modal-variations.is-dense {
    max-width: min(260px, calc(100vw - 72px));
}

.frame-variations.modal-variations.is-dense .frame-variation-thumb {
    width: 34px;
    height: 34px;
}

@media (max-width: 720px) {
    .frame-variations {
        top: 8px;
        right: 8px;
        max-width: calc(100% - 16px);
    }

    .frame-variation-thumb {
        width: 30px;
        height: 30px;
    }

    .frame-variations.is-compact .frame-variation-thumb {
        width: 25px;
        height: 25px;
    }

    .frame-variations.is-dense .frame-variation-thumb {
        width: 21px;
        height: 21px;
    }

    .fullscreen-edit-history.storyboard-variation-history {
        top: 10px;
        right: 10px;
        max-width: calc(100% - 20px);
    }

    .frame-variations.modal-variations .frame-variation-thumb {
        width: 42px;
        height: 42px;
    }

    .frame-variations.modal-variations.is-compact .frame-variation-thumb {
        width: 36px;
        height: 36px;
    }

    .frame-variations.modal-variations.is-dense .frame-variation-thumb {
        width: 30px;
        height: 30px;
    }
}

/* Social-media working-mode — segmented pill (manual / semi / auto), SM scenario only */
.sm-mode-chips {
    display: flex;
    gap: 0;
    padding: 3px;
    border: 1px solid var(--border-color, rgba(255, 255, 255, 0.12));
    border-radius: 999px;
    background: var(--surface-2, rgba(255, 255, 255, 0.04));
}
.sm-mode-btn {
    flex: 1 1 0;
    padding: 7px 6px;
    border: none;
    border-radius: 999px;
    background: transparent;
    color: var(--text-secondary, #b8b8c0);
    font-size: 11.5px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
}
.sm-mode-btn:hover { color: var(--text-primary, #fff); }
.sm-mode-btn.active { background: var(--primary-color); color: var(--ds-accent-ink); }
.sm-scene-estimate {
    margin-top: 8px;
    padding: 7px 9px;
    border: 1px solid var(--border-color, rgba(255, 255, 255, 0.12));
    border-radius: 8px;
    background: var(--surface-2, rgba(255, 255, 255, 0.04));
    color: var(--text-secondary, #b8b8c0);
    font-size: 11px;
    font-weight: 650;
    line-height: 1.35;
}

/* Social-media content mix selector (per-type count steppers) — SM scenario only.
   2×2 layout: Gönderi | Carousel / Hikaye | Reels (matches Manuel detail). */
.sm-mix-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 10px; }
.sm-mix-row { display: flex; align-items: center; gap: 6px; min-width: 0; }
.sm-mix-name {
    flex: 0 0 58px;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary, #b8b8c0);
}
.sm-mix-stepper {
    display: inline-flex;
    align-items: center;
    border: 1px solid var(--border-color, rgba(255, 255, 255, 0.12));
    border-radius: 8px;
    overflow: hidden;
}
.sm-mix-btn {
    width: 26px;
    height: 26px;
    border: none;
    background: var(--surface-2, rgba(255, 255, 255, 0.04));
    color: var(--text-primary, #fff);
    font-size: 14px;
    line-height: 1;
    cursor: pointer;
    transition: background 0.15s ease;
}
.sm-mix-btn:hover { background: var(--primary-color); }
.sm-mix-count {
    min-width: 26px;
    text-align: center;
    font-size: 12px;
    font-weight: 700;
    color: var(--text-primary, #fff);
}
.sm-mix-scenes {
    font-size: 11px;
    color: var(--text-secondary, #b8b8c0);
    display: inline-flex;
    align-items: center;
    gap: 4px;
}
.sm-mix-scenes { font-size: 10px; gap: 3px; }
.sm-mix-scene-input {
    width: 38px;
    padding: 3px 5px;
    border: 1px solid var(--border-color, rgba(255, 255, 255, 0.12));
    border-radius: 6px;
    background: var(--surface-2, rgba(255, 255, 255, 0.04));
    color: var(--text-primary, #fff);
    font-size: 10px;
}

/* SM2-5: Social content badges + embedded scene strips */
.social-format-badge,
.fullscreen-social-format-badge {
    position: absolute;
    top: 8px;
    left: 8px;
    z-index: 17;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 8px;
    border-radius: 999px;
    background: rgba(var(--ds-media-glass-rgb), 0.72);
    border: 1px solid rgba(255, 255, 255, 0.16);
    color: var(--ds-on-media);
    font-size: 9px;
    line-height: 1;
    font-weight: 800;
    letter-spacing: 0;
    text-transform: uppercase;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.24);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.social-format-badge span,
.fullscreen-social-format-badge span {
    color: rgba(255, 255, 255, 0.72);
    font-weight: 750;
}

.fullscreen-social-format-badge {
    top: 12px;
    left: 12px;
    z-index: 24;
    font-size: 10px;
}

.contact-sheet-frame.piece-card {
    --frame-info-height: 86px;
}

.piece-scenes {
    position: static;
    width: 100%;
    display: flex;
    justify-content: flex-start;
    gap: 5px;
    padding: 3px;
    overflow-x: auto;
    scrollbar-width: none;
    background: rgba(14, 14, 16, 0.42);
    border: 1px solid rgba(var(--ds-ink-rgb), 0.14);
    border-radius: 9px;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: none;
}

.piece-scenes::-webkit-scrollbar { display: none; }

.piece-scenes.is-compact {
    gap: 3px;
    padding: 2px;
    border-radius: 8px;
}

.piece-scenes.is-dense {
    gap: 2px;
    padding: 2px;
    max-width: 100%;
    border-radius: 8px;
}

.piece-scene-thumb {
    position: relative;
    flex: 0 0 auto;
    width: 34px;
    height: 34px;
    padding: 0;
    border: 1px solid rgba(255, 255, 255, 0.24);
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.08);
    opacity: 0.82;
    transition: opacity 0.15s ease, border-color 0.15s ease, transform 0.1s ease;
}

.piece-scenes.is-compact .piece-scene-thumb {
    width: 28px;
    height: 28px;
    border-radius: 7px;
}

.piece-scenes.is-dense .piece-scene-thumb {
    width: 23px;
    height: 23px;
    border-radius: 6px;
}

.piece-scene-thumb:hover { opacity: 1; transform: translateY(-1px); }
.piece-scene-thumb.active {
    opacity: 1;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(var(--primary-color-rgb), 0.34);
}
.piece-scene-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.piece-scene-ph {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary, #888);
    font-size: 12px;
}
.piece-scene-num {
    position: absolute;
    bottom: 2px;
    right: 2px;
    min-width: 11px;
    height: 11px;
    padding: 0 3px;
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.68);
    font-size: 7px;
    line-height: 11px;
    font-weight: 700;
    color: var(--ds-on-media);
    text-align: center;
}

.piece-scenes.is-compact .piece-scene-num,
.piece-scenes.is-dense .piece-scene-num {
    bottom: 1px;
    right: 1px;
    min-width: 9px;
    height: 9px;
    padding: 0 2px;
    font-size: 6px;
    line-height: 9px;
}

.fullscreen-edit-history.social-piece-history {
    position: absolute;
    top: 12px;
    right: 12px;
    bottom: auto;
    left: auto;
    transform: none;
    z-index: 25;
    display: flex;
    justify-content: flex-end;
    width: auto;
    max-width: min(260px, calc(100% - 24px));
    padding: 0;
    background: transparent;
    border: 0;
    box-shadow: none;
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
    pointer-events: auto;
}

.fullscreen-edit-history.social-piece-history .piece-scenes.modal-piece-scenes {
    position: static;
    max-width: 100%;
    justify-content: flex-end;
    gap: 3px;
    padding: 3px;
    background: rgba(var(--ds-surface-rgb), 0.94);
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.28);
}

.piece-scenes.modal-piece-scenes .piece-scene-thumb {
    width: 31px;
    height: 31px;
    border-radius: 7px;
}

.piece-scenes.modal-piece-scenes.is-compact .piece-scene-thumb {
    width: 28px;
    height: 28px;
}

.piece-scenes.modal-piece-scenes.is-dense .piece-scene-thumb {
    width: 24px;
    height: 24px;
}

/* SM2-4b: per-image content plan (one mini-mix row per uploaded image) */
.sm-perimg-actions { margin-left: auto; display: inline-flex; align-items: center; gap: 4px; }
.sm-perimg-refresh {
    width: 22px;
    height: 22px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border-color, rgba(255, 255, 255, 0.12));
    border-radius: 6px;
    background: var(--surface-2, rgba(255, 255, 255, 0.04));
    color: var(--text-secondary, #b8b8c0);
    font-size: 11px;
    cursor: pointer;
}
.sm-perimg-refresh:hover { color: var(--primary-color); border-color: var(--primary-color); }
.sm-perimg-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: none;
    overflow: visible;
}
.sm-perimg-empty, .sm-perimg-hint {
    font-size: 11px;
    color: var(--text-secondary, #888);
    padding: 2px 0;
}
/* Manuel master-detail: a scrolling thumbnail grid + ONE detail panel below it.
   Clicking a thumbnail opens that image's plan at the end of the area (accordion),
   so the grid never reflows/shifts. */
.sm-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));  /* 3 per row */
    gap: 10px;                               /* clear separation, not touching */
    max-height: 232px;                       /* ~2 rows visible; the rest scrolls */
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-gutter: stable;                /* reserve scrollbar space → no narrowing */
    flex-shrink: 0;                          /* the detail below never squeezes the grid */
    overscroll-behavior: contain;
    contain: layout paint;
}
.sm-thumb {
    position: relative;
    aspect-ratio: 1 / 1;
    padding: 0;
    border: 2px solid rgba(255, 255, 255, 0.08);  /* visible edge so thumbs don't merge */
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    background: var(--surface-2, rgba(255, 255, 255, 0.04));
    color: var(--text-secondary, #888);
    display: flex;
    align-items: center;
    justify-content: center;
}
.sm-thumb-add {
    border-style: dashed;
    font-size: 16px;
    color: var(--text-secondary, #b8b8c0);
}
.sm-thumb-add:hover { border-color: var(--primary-color); color: var(--primary-color); }
/* Per-thumbnail "+" (bottom-right): add extra images for THIS content from disk. */
.sm-thumb-plus {
    position: absolute;
    right: 4px;
    bottom: 4px;
    z-index: 5;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 6px;
    background: rgba(0, 0, 0, 0.62);
    color: var(--ds-on-media);
    font-size: 11px;
    line-height: 1;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.12s ease, background 0.12s ease;
}
.sm-thumb:hover .sm-thumb-plus { opacity: 1; }
.sm-thumb-plus:hover { background: var(--primary-color); }
.sm-grp-add {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-style: dashed !important;
    opacity: 1;
    color: var(--text-secondary, #b8b8c0);
}
.sm-grp-add:hover { border-color: var(--primary-color); color: var(--primary-color); }
.sm-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.sm-thumb.active { border-color: var(--primary-color); box-shadow: 0 0 0 1px var(--primary-color); }
.sm-thumb.absorbed { opacity: 0.5; }
.sm-thumb-role {
    position: absolute;
    left: 3px;
    top: 3px;
    max-width: calc(100% - 6px);
    padding: 1px 5px;
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.58);
    color: rgba(255, 255, 255, 0.9);
    font-size: 8px;
    font-weight: 800;
    line-height: 1.2;
    text-transform: uppercase;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.sm-thumb-sum {
    position: absolute;
    left: 3px;
    bottom: 3px;
    padding: 0 5px;
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.62);
    color: var(--ds-on-media);
    font-size: 9px;
    font-weight: 700;
}
.sm-thumb-grp {
    position: absolute;
    top: 3px;
    right: 3px;
    padding: 0 5px;
    border-radius: 999px;
    background: var(--primary-color);
    color: var(--ds-accent-ink);
    font-size: 9px;
    font-weight: 700;
}
.sm-thumb-note {
    position: absolute;
    top: 3px;
    right: 3px;
    width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    background: var(--ds-accent);
    color: var(--ds-ink);
    font-size: 8px;
}
/* When a group-count badge is also present, the note badge moves left of it. */
.sm-thumb-grp ~ .sm-thumb-note { right: 26px; }
.sm-detail-slot {
    flex: 0 0 auto;
}
.sm-detail-slot.is-open {
    min-height: 0;
}
.sm-detail {
    position: relative;
    border: 1px solid var(--primary-color);
    border-radius: 10px;
    padding: 8px;
    background: var(--surface-2, rgba(255, 255, 255, 0.03));
    animation: sm-detail-in 0.14s ease-out;
    transform-origin: top center;
}
@keyframes sm-detail-in {
    from { opacity: 0; transform: translateY(-4px); }
    to { opacity: 1; transform: translateY(0); }
}
.sm-detail-head { font-size: 11px; font-weight: 700; color: var(--text-secondary, #b8b8c0); margin-bottom: 6px; }
/* Fixed "+" in the detail (bottom-right): add disk images into THIS content. */
.sm-detail-add {
    position: absolute;
    right: 8px;
    bottom: 8px;
    width: 26px;
    height: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--primary-color);
    border-radius: 7px;
    background: var(--primary-color);
    color: var(--ds-accent-ink);
    font-size: 13px;
    line-height: 1;
    cursor: pointer;
    z-index: 6;
}
.sm-detail-add:hover { filter: brightness(1.1); }
/* The content's own (primary) image in the group strip — active marker, not toggleable. */
.sm-grp-thumb.primary { opacity: 1; border-color: var(--primary-color); cursor: default; }
.sm-grp-main {
    position: absolute;
    left: 1px;
    bottom: 1px;
    padding: 0 3px;
    border-radius: 4px;
    background: var(--primary-color);
    color: var(--ds-accent-ink);
    font-size: 7px;
    font-weight: 700;
}
/* 2×2 type layout: Gönderi | Carousel  /  Hikaye | Reels */
.sm-detail-types { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 10px; }
.sm-card-row { display: flex; align-items: center; gap: 4px; padding: 2px 0; min-width: 0; }
.sm-role-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 6px;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--border-color, rgba(255, 255, 255, 0.10));
    color: var(--text-secondary, #b8b8c0);
    font-size: 11px;
    font-weight: 650;
}
.sm-role-row small {
    margin-left: 4px;
    color: var(--primary-color);
    font-size: 9px;
    font-weight: 800;
    text-transform: uppercase;
}
.sm-role-select {
    width: 96px;
    padding: 4px 7px;
    border: 1px solid var(--border-color, rgba(255, 255, 255, 0.12));
    border-radius: 7px;
    background: var(--surface-2, rgba(255, 255, 255, 0.04));
    color: var(--text-primary, #fff);
    font-size: 11px;
    font-weight: 650;
}
/* Fixed label width so the −/count/+ steppers line up across the 2×2 cells. */
.sm-card-tlabel { flex: 0 0 58px; font-size: 11px; color: var(--text-secondary, #b8b8c0); }
.sm-card-btn {
    width: 20px;
    height: 20px;
    border: 1px solid var(--border-color, rgba(255, 255, 255, 0.12));
    border-radius: 5px;
    background: var(--surface-2, rgba(255, 255, 255, 0.04));
    color: var(--text-primary, #fff);
    font-size: 12px;
    line-height: 1;
    cursor: pointer;
}
.sm-card-btn:hover { background: var(--primary-color); }
.sm-card-count { min-width: 14px; text-align: center; font-size: 11px; font-weight: 700; color: var(--text-primary, #fff); }
.sm-card-sc {
    width: 42px;
    padding: 2px 4px;
    margin-left: 4px;
    border: 1px solid var(--border-color, rgba(255, 255, 255, 0.12));
    border-radius: 5px;
    background: var(--surface-2, rgba(255, 255, 255, 0.04));
    color: var(--text-primary, #fff);
    font-size: 10px;
}
/* Multi-input grouping (G2): attach extra images into one content */
.sm-card.absorbed { opacity: 0.55; }
.sm-card-grpcount {
    position: absolute;
    top: 4px;
    right: 4px;
    padding: 0 5px;
    border-radius: 999px;
    background: var(--primary-color);
    color: var(--ds-accent-ink);
    font-size: 9px;
    font-weight: 700;
}
.sm-card-group {
    grid-column: 1 / -1;
    margin-top: 6px;
    border-top: 1px solid var(--border-color, rgba(255, 255, 255, 0.08));
    padding-top: 6px;
}
.sm-note-row {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid var(--border-color, rgba(255, 255, 255, 0.08));
}
.sm-note-label {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 10px;
    font-weight: 650;
    color: var(--text-secondary, #b8b8c0);
    margin-bottom: 4px;
}
.sm-note-label i { color: var(--ds-accent); font-size: 10px; }
.sm-note-label small { font-weight: 500; opacity: 0.7; text-transform: none; }
.sm-note-input {
    width: 100%;
    resize: vertical;
    min-height: 40px;
    max-height: 90px;
    padding: 6px 8px;
    border: 1px solid var(--border-color, rgba(255, 255, 255, 0.12));
    border-radius: 7px;
    background: var(--surface-2, rgba(255, 255, 255, 0.04));
    color: var(--text-primary, #fff);
    font-size: 11px;
    font-family: inherit;
    line-height: 1.35;
}
.sm-note-input:focus {
    outline: none;
    border-color: var(--ds-accent);
}
.sm-note-input::placeholder { color: var(--text-secondary, #888); opacity: 0.7; }
.sm-card-grplbl { display: block; font-size: 10px; color: var(--text-secondary, #b8b8c0); margin-bottom: 4px; }
.sm-card-grpthumbs { display: flex; gap: 4px; flex-wrap: wrap; }
.sm-grp-thumb {
    position: relative;            /* anchor the hover preview */
    width: 30px;
    height: 30px;
    padding: 0;
    border: 2px solid transparent;
    border-radius: 6px;
    cursor: pointer;
    background: var(--surface-2, rgba(255, 255, 255, 0.04));
    opacity: 0.6;
    font-size: 10px;
    color: var(--text-secondary, #888);
}
.sm-grp-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; border-radius: 4px; }
.sm-grp-thumb:hover { opacity: 0.9; }
/* Hover preview: a larger image popup so tiny group thumbs are identifiable. */
.sm-hover-prev {
    position: absolute;
    bottom: calc(100% + 6px);
    left: 50%;
    transform: translateX(-50%);
    width: 132px;
    height: 132px;
    display: none;
    z-index: 60;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid var(--primary-color);
    background: var(--ds-bg);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.55);
    pointer-events: none;
}
.sm-hover-prev img { width: 100%; height: 100%; object-fit: cover; display: block; border-radius: 0; }
.sm-grp-thumb:hover .sm-hover-prev { display: block; }
.sm-grp-thumb.on { opacity: 1; border-color: var(--primary-color); }
.sm-card-grpempty { font-size: 10px; color: var(--text-secondary, #888); }

.contact-sheet-frame.weak-frame {
    border-color: rgba(var(--ds-accent-rgb), 0.72);
    box-shadow: 0 0 0 2px rgba(var(--ds-accent-rgb), 0.14);
}

.contact-sheet-frame.weak-frame.missing-frame {
    border-color: rgba(var(--ds-danger-rgb), 0.72);
    box-shadow: 0 0 0 2px rgba(var(--ds-danger-rgb), 0.14);
}

.weak-frame-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    min-height: 24px;
    max-width: calc(100% - 16px);
    padding: 3px 7px;
    border-radius: 999px;
    background: rgba(var(--ds-accent-rgb), 0.92);
    color: var(--ds-on-media);
    font-size: 0.68rem;
    font-weight: 800;
    line-height: 1;
    z-index: 11;
    box-shadow: 0 2px 8px rgba(var(--ds-accent-rgb), 0.35);
}

.weak-frame-badge span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.missing-frame .weak-frame-badge {
    background: rgba(var(--ds-danger-rgb), 0.94);
    box-shadow: 0 2px 8px rgba(var(--ds-danger-rgb), 0.35);
}

.frame-refs {
    display: inline-flex;
    align-items: center;
    min-width: 0;
    padding: 2px 7px;
    border-radius: 6px;
    font-size: 10px;
    background: rgba(var(--ds-muted-rgb), 0.18);
    color: inherit;
    opacity: 0.85;
    font-variant-numeric: tabular-nums;
}

.frame-flow-chip {
    display: inline-flex;
    align-items: center;
    min-width: 0;
    padding: 2px 7px;
    border-radius: 6px;
    background: rgba(var(--primary-color-rgb), 0.09);
    color: var(--primary-color);
    font-size: 10px;
    font-weight: 600;
    white-space: nowrap;
}

.frame-flow-chip.new_scene {
    background: rgba(var(--ds-accent-rgb), 0.12);
    color: var(--ds-accent);
}

.frame-flow-chip.same_scene {
    background: rgba(var(--ds-ok-rgb), 0.11);
    color: var(--ds-ok);
}

/* Bridge-insert "+" — appears on the right edge on hover; inserts an AI scene after this frame */
.frame-insert-slot {
    position: absolute;
    top: 38%;
    right: 6px;
    transform: translateY(-50%);
    width: 28px;
    height: 28px;
    border-radius: 9px;
    border: 1px solid rgba(255, 255, 255, 0.48);
    background: rgba(var(--ds-surface-rgb), 0.94);
    color: var(--ds-ink);
    font-size: 13px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0;
    z-index: 12;
    transition: opacity 0.15s ease, transform 0.15s ease, background 0.15s ease;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.22);
    backdrop-filter: blur(8px);
}
.contact-sheet-frame:hover .frame-insert-slot { opacity: 1; }
.frame-insert-slot:hover {
    background: var(--primary-color);
    transform: translateY(-50%) scale(1.05);
}

.frame-insert-slot:disabled {
    cursor: wait;
    opacity: 1;
}

/* Bridge-insert: animated same-size frame shown in place until the image arrives */
.contact-sheet-frame.bridge-loading {
    pointer-events: none;
    border-style: dashed;
    border-color: rgba(var(--primary-color-rgb), 0.36);
}
.bridge-loading-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-sm);
    text-align: center;
    padding: 12px;
    color: var(--text-secondary);
    font-size: 0.78rem;
    font-weight: 600;
    background:
        linear-gradient(135deg, rgba(var(--primary-color-rgb), 0.07), transparent 52%),
        var(--bg-tertiary);
    animation: sb-modal-fade 0.2s ease;
}

/* Frame Image */
.frame-image-wrapper {
    position: relative;
    /* Driven by the run's real aspect ratio (set on the grid by JS) so frames
       are shown at their true proportions instead of being cropped to 3:4. */
    aspect-ratio: var(--sb-frame-aspect, 3 / 4);
    background: var(--bg-tertiary);
    overflow: hidden;
}

.frame-image-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.25s ease;
}

.contact-sheet-frame:hover .frame-image-wrapper img {
    transform: scale(1.025);
}

.frame-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: 2rem;
}

/* Status Icon */
.status-icon {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-size: 0.65rem;
    color: var(--ds-on-media);
    box-shadow: var(--shadow-md);
}

.status-icon.approved {
    background: var(--success-color);
}

.status-icon.locked {
    background: var(--warning-color);
}

.status-icon.rejected {
    background: var(--error-color);
}

/* Frame Info */
.frame-info {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: center;
    gap: 5px;
    padding: 8px 10px;
    background: var(--bg-elevated);
    height: var(--frame-info-height);
    min-width: 0;
}

.frame-info-main,
.frame-meta-row {
    display: flex;
    align-items: center;
    gap: 7px;
    min-width: 0;
}

.frame-info-main {
    justify-content: space-between;
}

.frame-meta-row {
    min-height: 16px;
    overflow: hidden;
}

.frame-number {
    font-size: 0.875rem;
    font-weight: 700;
    color: var(--primary-color);
    font-variant-numeric: tabular-nums;
}

.frame-role {
    min-width: 0;
    flex: 1;
    font-size: 0.68rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: none;
    letter-spacing: 0;
    text-align: right;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Frame Actions */
.frame-actions {
    position: absolute;
    bottom: var(--frame-info-height);
    left: 0;
    right: 0;
    display: flex;
    justify-content: center;
    gap: var(--spacing-sm);
    padding: var(--spacing-sm);
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.7));
    opacity: 0;
    transition: opacity var(--transition-fast);
    z-index: 2;
}

.contact-sheet-frame:hover .frame-actions {
    opacity: 1;
}

.frame-action-btn {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    transition: all var(--transition-fast);
    font-size: 0.75rem;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.16);
}

.frame-action-btn.approve {
    background: var(--success-color);
    color: var(--ds-on-media);
}

.frame-action-btn.lock {
    background: var(--warning-color);
    color: var(--ds-on-media);
}

.frame-action-btn.regenerate {
    background: var(--primary-color);
    color: var(--ds-accent-ink);
}

.frame-action-btn.video {
    border: 1px solid rgba(var(--primary-color-rgb), 0.48);
    background: var(--primary-color);
    color: var(--accent-contrast, #ffffff);
    box-shadow: 0 8px 18px rgba(var(--primary-color-rgb), 0.3);
}

.frame-action-btn.edit,
.frame-action-btn.enhance,
.frame-action-btn.revert {
    background: rgba(var(--ds-media-glass-rgb), 0.92);
    color: var(--ds-ink);
}

.frame-action-btn.enhance {
    color: var(--ds-accent);
}

.frame-action-btn:hover {
    transform: scale(1.15);
}

.frame-action-btn:disabled {
    cursor: not-allowed;
    opacity: 0.42;
    transform: none;
    filter: grayscale(0.2);
}

/* ============================================================================
   EDIT COMMAND SECTION
   ============================================================================ */

.edit-command-section {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
    padding-top: var(--spacing-md);
    border-top: 1px solid var(--border-light);
}

.edit-command-wrapper {
    display: flex;
    gap: var(--spacing-sm);
}

.edit-command-input {
    flex: 1;
    padding: var(--spacing-sm) var(--spacing-md);
    border: 1px solid var(--border-light);
    border-radius: 9999px;
    background: var(--input-background);
    color: var(--text-primary);
    font-size: 0.875rem;
}

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

.edit-command-send {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 50%;
    background: var(--primary-color);
    color: var(--ds-accent-ink);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.edit-command-send:hover {
    background: var(--primary-dark);
}

/* Edit Command Hints */
.edit-command-hints {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.hint-tag {
    padding: 4px 10px;
    background: rgba(var(--primary-color-rgb), 0.1);
    color: var(--primary-color);
    border-radius: 12px;
    font-size: 0.7rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.hint-tag:hover {
    background: var(--primary-color);
    color: var(--ds-accent-ink);
}

/* ============================================================================
   EXPORT DIALOG
   ============================================================================ */

.export-dialog-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.export-dialog {
    background: var(--bg-elevated);
    border-radius: 18px;
    border: 1px solid var(--border-light);
    box-shadow: var(--shadow-xl);
    width: 90%;
    max-width: 400px;
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.export-dialog-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--spacing-lg);
    border-bottom: 1px solid var(--border-light);
    background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--bg-tertiary) 100%);
    border-radius: 18px 18px 0 0;
}

.export-dialog-header h3 {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    font-size: 1rem;
    font-weight: 600;
    margin: 0;
    color: var(--text-primary);
}

.export-dialog-header h3 i {
    color: var(--primary-color);
}

.export-dialog-close {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-size: 1.5rem;
    cursor: pointer;
    border-radius: 50%;
    transition: all var(--transition-fast);
}

.export-dialog-close:hover {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.export-dialog-content {
    padding: var(--spacing-lg);
}

.export-formats {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
}

.export-format-option {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    padding: var(--spacing-md);
    border: 2px solid var(--border-light);
    border-radius: 14px;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.export-format-option:hover {
    border-color: var(--primary-color);
    background: rgba(var(--primary-color-rgb), 0.05);
}

.export-format-option:has(input:checked) {
    border-color: var(--primary-color);
    background: linear-gradient(135deg,
            rgba(var(--primary-color-rgb), 0.1),
            rgba(var(--secondary-color-rgb), 0.05));
}

.export-format-option input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--primary-color);
}

.format-icon {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-secondary);
    border-radius: 8px;
    color: var(--text-secondary);
    font-size: 1rem;
}

.export-format-option:has(input:checked) .format-icon {
    background: var(--primary-color);
    color: var(--ds-accent-ink);
}

.format-name {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-primary);
}

.export-dialog-footer {
    display: flex;
    justify-content: flex-end;
    gap: var(--spacing-sm);
    padding: var(--spacing-lg);
    border-top: 1px solid var(--border-light);
}

.export-dialog-footer .btn-secondary {
    padding: var(--spacing-sm) var(--spacing-lg);
    border: 1px solid var(--border-medium);
    border-radius: 9999px;
    background: transparent;
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.export-dialog-footer .btn-secondary:hover {
    background: var(--bg-secondary);
}

.export-dialog-footer .btn-primary {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    padding: var(--spacing-sm) var(--spacing-lg);
    border: none;
    border-radius: 9999px;
    background: var(--primary-color);
    color: var(--ds-accent-ink);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.export-dialog-footer .btn-primary:hover {
    background: var(--primary-dark);
}

.export-dialog-footer .btn-primary:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

/* ============================================================================
   DARK MODE ADJUSTMENTS
   ============================================================================ */

.dark-mode .storyboard-wizard {
    background: var(--bg-elevated);
}

.dark-mode .wizard-info {
    background: rgba(var(--primary-color-rgb), 0.1);
}

.dark-mode .storyboard-viewer {
    background: var(--bg-elevated);
}

.dark-mode .contact-sheet-frame {
    background: var(--bg-tertiary);
}

.dark-mode .export-dialog {
    background: var(--bg-secondary);
}

/* ============================================================================
   RESPONSIVE ADJUSTMENTS
   ============================================================================ */

@media (max-width: 768px) {
    .contact-sheet-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: var(--spacing-sm);
    }

    .sb-board-scorecard {
        grid-template-columns: 1fr;
    }

    .storyboard-anchor-panel {
        flex-direction: column;
        align-items: stretch;
    }

    .storyboard-anchor-panel .anchor-preview {
        width: 100%;
        max-width: 220px;
        margin: 0 auto;
    }

    .storyboard-actions {
        flex-wrap: wrap;
    }

    .storyboard-action-btn span {
        display: none;
    }

    .frame-count-selector {
        gap: var(--spacing-xs);
    }

    .frame-count-btn {
        padding: var(--spacing-sm);
    }

    .frame-count-btn .count-number {
        font-size: 1.25rem;
    }
}

@media (max-width: 480px) {
    .contact-sheet-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .storyboard-viewer-header {
        flex-direction: column;
        gap: var(--spacing-sm);
        align-items: flex-start;
    }

    .storyboard-actions {
        width: 100%;
        justify-content: flex-start;
    }
}

/* Placeholder for loading state */
.storyboard-placeholder {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-md);
    padding: 60px 40px;
    color: var(--text-muted);
    font-size: 0.95rem;
}

.storyboard-placeholder .processing-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border-light);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* ============================================================================
   FRAME COUNT SLIDER - 2-12 Arası Esnek Seçim
   ============================================================================ */

.frame-count-display {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 28px;
    height: 22px;
    margin-left: 8px;
    padding: 0 6px;
    background: var(--primary-color);
    border-radius: 9999px;
    color: var(--ds-accent-ink);
    font-size: 0.75rem;
    font-weight: 600;
}

.frame-count-slider-container {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 4px 0;
}

.frame-count-slider {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 6px;
    background: var(--bg-tertiary);
    border-radius: 9999px;
    outline: none;
    cursor: pointer;
    transition: background 0.2s ease;
}

.frame-count-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    background: var(--primary-color);
    border-radius: 50%;
    cursor: grab;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
    transition: all 0.15s ease;
}

.frame-count-slider::-webkit-slider-thumb:hover {
    transform: scale(1.15);
    box-shadow: 0 3px 10px rgba(var(--primary-rgb), 0.4);
}

.frame-count-slider::-webkit-slider-thumb:active {
    cursor: grabbing;
    transform: scale(1.1);
}

.frame-count-slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    background: var(--primary-color);
    border: none;
    border-radius: 50%;
    cursor: grab;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

.slider-labels {
    display: flex;
    justify-content: space-between;
    padding: 0 2px;
}

.slider-labels span {
    font-size: 0.65rem;
    color: var(--text-muted);
    font-weight: 500;
}

/* Dark mode adjustments */
.dark-mode .frame-count-slider {
    background: var(--bg-secondary);
}

.dark-mode .slider-labels span {
    color: var(--text-tertiary);
}

/* ============================================================================
   WIZARD V2 - Yeni Butonlar
   ============================================================================ */

/* Senaryo Türü Butonları - Tek satır, tam oval */
.scenario-type-selector {
    display: flex;
    gap: 8px;
}

.scenario-type-selector.pill-row {
    display: flex;
    gap: 6px;
}

.scenario-btn.pill {
    flex: 1;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 10px;
    background: transparent;
    border: 1px solid var(--border-medium);
    border-radius: 9999px;
    color: var(--text-secondary);
    font-size: 0.7rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.scenario-btn.pill:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.scenario-btn.pill.active {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: var(--ds-accent-ink);
}

/* Sektör Butonları - Senaryo butonlarıyla aynı stil */
.sector-selector {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.sector-btn.pill {
    flex: 1;
    min-width: 70px;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    padding: 8px 10px;
    background: transparent;
    border: 1px solid var(--border-medium);
    border-radius: 9999px;
    color: var(--text-secondary);
    font-size: 0.7rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.sector-btn.pill:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.sector-btn.pill.active {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: var(--ds-accent-ink);
}

.env-btn {
    padding: 8px 12px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-light);
    border-radius: 8px;
    color: var(--text-secondary);
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.env-btn:hover {
    background: var(--bg-secondary);
    border-color: var(--primary-color);
}

.env-btn.active {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: var(--ds-accent-ink);
}

/* ============================================================================
   GRID VIEWER - V2
   ============================================================================ */

.storyboard-grid-viewer {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    background: var(--bg-primary);
}

.dark-mode .storyboard-grid-viewer {
    background: var(--ds-bg);
}

/* Grid Viewer Header */
.grid-viewer-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 24px;
    background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--bg-tertiary) 100%);
    border-bottom: 1px solid var(--border-light);
}

.viewer-title {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.viewer-title i {
    color: var(--primary-color);
}

.grid-status {
    padding: 4px 12px;
    background: var(--bg-tertiary);
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-muted);
}

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

.viewer-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-light);
    border-radius: 9999px;
    color: var(--text-secondary);
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.viewer-btn:hover:not(:disabled) {
    background: var(--bg-secondary);
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.viewer-btn.active {
    background: rgba(var(--primary-rgb), 0.12);
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.viewer-btn.primary {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    border-color: var(--primary-color);
    color: var(--ds-accent-ink);
}

.viewer-btn.primary:hover:not(:disabled) {
    filter: brightness(1.1);
}

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

.viewer-btn.ready {
    animation: pulse-glow 2s infinite;
}

@keyframes pulse-glow {

    0%,
    100% {
        box-shadow: 0 0 0 0 rgba(var(--primary-rgb), 0.4);
    }

    50% {
        box-shadow: 0 0 20px 5px rgba(var(--primary-rgb), 0.2);
    }
}

/* Grid Viewer Body */
.grid-viewer-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding: 24px;
    gap: 16px;
}

/* Grid Image Container */
.grid-image-container {
    flex: 1;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-tertiary);
    border-radius: 16px;
    overflow: hidden;
}

.grid-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    color: var(--text-muted);
}

.grid-image {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 8px;
}

/* Cell Overlays */
.cell-overlay-container {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
}

.cell-overlay {
    position: absolute;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 2px solid transparent;
    cursor: pointer;
    pointer-events: all;
    transition: all 0.2s ease;
}

.cell-overlay:hover {
    background: rgba(var(--primary-rgb), 0.1);
    border-color: var(--primary-color);
}

.cell-overlay.selected {
    background: rgba(var(--primary-rgb), 0.15);
    border-color: var(--primary-color);
    border-width: 3px;
}

.cell-overlay.approved {
    background: rgba(var(--ds-ok-rgb), 0.1);
    border-color: var(--ds-ok);
}

.cell-overlay.approved .cell-status i {
    color: var(--ds-ok);
}

.cell-overlay.locked {
    border-color: var(--ds-warn);
}

/* Director's Cut States (V2 Grid) */
.cell-overlay.director-fail {
    border: 3px solid var(--ds-danger) !important;
    box-shadow: inset 0 0 20px rgba(var(--ds-danger-rgb), 0.3), 0 0 15px rgba(var(--ds-danger-rgb), 0.4) !important;
    animation: director-pulse-v2 2s ease-in-out infinite;
}

.cell-overlay.director-warning {
    border: 2px solid var(--ds-warn) !important;
    box-shadow: inset 0 0 15px rgba(var(--ds-warn-rgb), 0.2) !important;
}

@keyframes director-pulse-v2 {

    0%,
    100% {
        box-shadow: inset 0 0 20px rgba(var(--ds-danger-rgb), 0.3), 0 0 15px rgba(var(--ds-danger-rgb), 0.4);
    }

    50% {
        box-shadow: inset 0 0 30px rgba(var(--ds-danger-rgb), 0.4), 0 0 25px rgba(var(--ds-danger-rgb), 0.5);
    }
}

.cell-overlay .cell-label {
    position: absolute;
    top: 8px;
    left: 8px;
    padding: 4px 8px;
    background: rgba(0, 0, 0, 0.6);
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--ds-on-media);
}

.cell-overlay .cell-role {
    padding: 6px 12px;
    background: rgba(0, 0, 0, 0.7);
    border-radius: 8px;
    font-size: 0.7rem;
    font-weight: 500;
    color: var(--ds-on-media);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.cell-overlay:hover .cell-role,
.cell-overlay.selected .cell-role {
    opacity: 1;
}

.cell-overlay .cell-status {
    position: absolute;
    top: 8px;
    right: 8px;
    display: flex;
    gap: 4px;
}

.cell-overlay .cell-status i {
    font-size: 1rem;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.5));
}

/* Grid adjust mode */
.grid-image-container.adjust-mode .cell-overlay {
    pointer-events: none;
    opacity: 0.35;
}

.grid-image-container.cell-adjust-mode .cell-overlay {
    pointer-events: none;
    opacity: 0.3;
}

.grid-adjust-box {
    position: absolute;
    border: 2px dashed rgba(var(--primary-rgb), 0.85);
    box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.15);
    z-index: 6;
    cursor: move;
}

.cell-adjust-box {
    position: absolute;
    border: 2px solid rgba(var(--ds-accent-rgb), 0.95);
    box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.12);
    z-index: 7;
    cursor: move;
}

.cell-adjust-box .grid-handle {
    position: absolute;
    width: 12px;
    height: 12px;
    background: var(--ds-accent);
    border: 2px solid rgba(0, 0, 0, 0.6);
    border-radius: 4px;
}

.cell-adjust-box .grid-handle.tl {
    top: -6px;
    left: -6px;
    cursor: nwse-resize;
}

.cell-adjust-box .grid-handle.tr {
    top: -6px;
    right: -6px;
    cursor: nesw-resize;
}

.cell-adjust-box .grid-handle.bl {
    bottom: -6px;
    left: -6px;
    cursor: nesw-resize;
}

.cell-adjust-box .grid-handle.br {
    bottom: -6px;
    right: -6px;
    cursor: nwse-resize;
}

.cell-adjust-box .grid-handle.tm {
    top: -6px;
    left: 50%;
    transform: translateX(-50%);
    cursor: ns-resize;
}

.cell-adjust-box .grid-handle.bm {
    bottom: -6px;
    left: 50%;
    transform: translateX(-50%);
    cursor: ns-resize;
}

.cell-adjust-box .grid-handle.ml {
    left: -6px;
    top: 50%;
    transform: translateY(-50%);
    cursor: ew-resize;
}

.cell-adjust-box .grid-handle.mr {
    right: -6px;
    top: 50%;
    transform: translateY(-50%);
    cursor: ew-resize;
}

.grid-adjust-box .grid-handle {
    position: absolute;
    width: 12px;
    height: 12px;
    background: var(--primary-color);
    border: 2px solid rgba(0, 0, 0, 0.6);
    border-radius: 4px;
}

.grid-adjust-box .grid-handle.tl {
    top: -6px;
    left: -6px;
    cursor: nwse-resize;
}

.grid-adjust-box .grid-handle.tr {
    top: -6px;
    right: -6px;
    cursor: nesw-resize;
}

.grid-adjust-box .grid-handle.bl {
    bottom: -6px;
    left: -6px;
    cursor: nesw-resize;
}

.grid-adjust-box .grid-handle.br {
    bottom: -6px;
    right: -6px;
    cursor: nwse-resize;
}

.grid-adjust-box .grid-handle.tm {
    top: -6px;
    left: 50%;
    transform: translateX(-50%);
    cursor: ns-resize;
}

.grid-adjust-box .grid-handle.bm {
    bottom: -6px;
    left: 50%;
    transform: translateX(-50%);
    cursor: ns-resize;
}

.grid-adjust-box .grid-handle.ml {
    left: -6px;
    top: 50%;
    transform: translateY(-50%);
    cursor: ew-resize;
}

.grid-adjust-box .grid-handle.mr {
    right: -6px;
    top: 50%;
    transform: translateY(-50%);
    cursor: ew-resize;
}

/* Cell Actions Panel */
.cell-actions-panel {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 24px;
    padding: 16px 24px;
    background: var(--bg-secondary);
    border-radius: 16px;
}

.selected-cell-info {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
}

.cell-label {
    color: var(--text-muted);
}

.cell-id {
    font-weight: 600;
    color: var(--primary-color);
}

.cell-role {
    padding: 4px 10px;
    background: var(--bg-tertiary);
    border-radius: 6px;
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.cell-action-buttons {
    display: flex;
    gap: 12px;
}

.cell-action-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border: none;
    border-radius: 9999px;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.cell-action-btn.approve {
    background: linear-gradient(135deg, var(--ds-ok) 0%, var(--ds-ok) 100%);
    color: var(--ds-on-media);
}

.cell-action-btn.approve:hover {
    filter: brightness(1.1);
}

.cell-action-btn.regenerate {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-light);
    color: var(--text-secondary);
}

.cell-action-btn.regenerate:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.cell-action-btn.adjust {
    background: rgba(var(--primary-rgb), 0.12);
    border: 1px solid rgba(var(--primary-rgb), 0.4);
    color: var(--primary-color);
}

.cell-action-btn.adjust:hover {
    border-color: var(--primary-color);
    filter: brightness(1.05);
}

.cell-action-btn.adjust-save {
    background: linear-gradient(135deg, var(--ds-accent) 0%, var(--ds-accent) 100%);
    color: var(--ds-accent);
}

.cell-action-btn.adjust-save:hover {
    filter: brightness(1.05);
}

.regenerate-prompt-container {
    display: flex;
    gap: 8px;
}

.regenerate-input {
    padding: 10px 16px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-light);
    border-radius: 9999px;
    color: var(--text-primary);
    font-size: 0.85rem;
    min-width: 200px;
}

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

.regenerate-confirm-btn {
    padding: 10px 16px;
    background: var(--primary-color);
    border: none;
    border-radius: 9999px;
    color: var(--ds-accent-ink);
    cursor: pointer;
    transition: all 0.2s ease;
}

.regenerate-confirm-btn:hover {
    filter: brightness(1.1);
}

/* Finalize Progress */
.finalize-progress {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 24px;
}

.progress-bar {
    width: 100%;
    max-width: 400px;
    height: 8px;
    background: var(--bg-tertiary);
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), var(--primary-dark));
    border-radius: 4px;
    transition: width 0.3s ease;
}

.progress-text {
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* Finalized Results */
.finalized-results {
    padding: 24px;
}

.results-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 24px;
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--ds-ok);
}

.results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.result-frame {
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    background: var(--bg-tertiary);
}

.result-frame img {
    width: 100%;
    aspect-ratio: 3/4;
    object-fit: cover;
}

.result-frame .frame-info {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 12px;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.8), transparent);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.result-frame .frame-id {
    font-weight: 600;
    color: var(--ds-on-media);
}

.result-frame .frame-role {
    font-size: 0.7rem;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.7);
}

.results-actions {
    display: flex;
    justify-content: center;
}

.export-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 32px;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    border: none;
    border-radius: 9999px;
    color: var(--ds-accent-ink);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.export-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(var(--primary-rgb), 0.3);
}

/* Small spinner */
.processing-spinner.small {
    width: 16px;
    height: 16px;
    border-width: 2px;
}

/* Body state when viewer is open */
body.grid-viewer-open {
    overflow: hidden;
}

/* Dark mode adjustments */
.dark-mode .grid-viewer-header {
    background: var(--ds-surface);
    border-bottom-color: rgba(255, 255, 255, 0.1);
}

.dark-mode .cell-actions-panel {
    background: var(--ds-surface);
}

.dark-mode .grid-image-container {
    background: var(--ds-bg);
}

/* ============================================================================
   STORYBOARD GALLERY LIGHTBOX
   ============================================================================ */

.storyboard-lightbox {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.95);
    backdrop-filter: blur(10px);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease;
}

.storyboard-lightbox .lightbox-content {
    position: relative;
    max-width: 90vw;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--spacing-md);
}

.storyboard-lightbox .lightbox-close {
    position: absolute;
    top: -40px;
    right: -10px;
    width: 36px;
    height: 36px;
    border: none;
    background: rgba(255, 255, 255, 0.1);
    color: var(--ds-on-media);
    border-radius: 50%;
    cursor: pointer;
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    z-index: 10;
}

.storyboard-lightbox .lightbox-close:hover {
    background: var(--error-color);
    transform: scale(1.1);
}

.storyboard-lightbox .lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 48px;
    height: 48px;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 50%;
    color: var(--ds-on-media);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    transition: all 0.2s ease;
    z-index: 5;
}

.storyboard-lightbox .lightbox-nav:hover {
    background: var(--primary-color);
    transform: translateY(-50%) scale(1.1);
}

.storyboard-lightbox .lightbox-nav.prev {
    left: -70px;
}

.storyboard-lightbox .lightbox-nav.next {
    right: -70px;
}

.storyboard-lightbox #storyboardLightboxImage {
    max-width: 80vw;
    max-height: 70vh;
    object-fit: contain;
    border-radius: var(--border-radius);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

.storyboard-lightbox #storyboardLightboxHistory {
    display: flex;
    gap: var(--spacing-sm);
    padding: var(--spacing-md);
    background: rgba(255, 255, 255, 0.05);
    border-radius: var(--border-radius);
    overflow-x: auto;
    max-width: 80vw;
}

.storyboard-lightbox .edit-lightbox-thumb {
    flex-shrink: 0;
    width: 60px;
    height: 60px;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all 0.2s ease;
    position: relative;
}

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

.storyboard-lightbox .edit-lightbox-thumb:hover {
    border-color: rgba(255, 255, 255, 0.5);
    transform: scale(1.05);
}

.storyboard-lightbox .edit-lightbox-thumb.active {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(var(--primary-rgb), 0.3);
}

.storyboard-lightbox .edit-lightbox-thumb .edit-history-label {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(0, 0, 0, 0.7);
    color: var(--ds-on-media);
    font-size: 0.6rem;
    padding: 2px 4px;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.storyboard-lightbox .lightbox-info {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    color: var(--ds-on-media);
    font-size: 0.85rem;
}

.storyboard-lightbox .frame-counter {
    background: rgba(255, 255, 255, 0.1);
    padding: 4px 12px;
    border-radius: 12px;
}

.storyboard-lightbox .frame-label {
    color: rgba(255, 255, 255, 0.7);
    font-weight: 500;
}


/* ============================================================================
   STORYBOARD SESSION LIGHTBOX (uses edit-session-lightbox base styles)
   ============================================================================ */

.storyboard-session-lightbox .edit-lightbox-nav {
    /* Inherits from edit session thumbnails */
    pointer-events: auto;
}

.storyboard-session-lightbox .lightbox-counter {
    /* Frame label styling */
    font-size: 0.9rem;
}

/* ============================================================================
   STORYBOARD MODE - HIDE REDUNDANT STYLE CATEGORIES
   LLM Scene Director automatically determines these, so hiding them prevents
   confusion and conflicting user selections.
   ============================================================================ */

/* ============================================================================
   STORYBOARD MODE - STYLE CUSTOMIZATION
   Adjusting advanced style options for Storyboard mode:
   1. Hide redundant categories (LLM handles these)
   2. Rename "Ürün Kategorisi" to "Sektör"
   3. Optimize grid layout
   ============================================================================ */

/* 5. Spacing & Layout Balance for Storyboard Mode */

/* Storyboard/Social: visually attach the style direction controls to the mode panel. */

.storyboard-wizard[data-profile="social"] #scenarioToggleBtn.is-locked {
    cursor: default;
    opacity: 0.82;
}

.storyboard-wizard[data-profile="social"] #scenarioToggleBtn.is-locked .toggle-icon {
    display: none;
}

/* ============================================================================
   QUALITY LAYER BUTTONS (V6) - Same style as sector/scenario buttons
   ============================================================================ */

/* Quality Mode Buttons */
.quality-btn.pill,
.look-btn.pill,
.detail-btn.pill {
    flex: 1;
    min-width: 60px;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    padding: 8px 10px;
    background: transparent;
    border: 1px solid var(--border-medium);
    border-radius: 9999px;
    color: var(--text-secondary);
    font-size: 0.7rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.quality-btn.pill:hover,
.look-btn.pill:hover,
.detail-btn.pill:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.quality-btn.pill.active,
.look-btn.pill.active,
.detail-btn.pill.active {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: var(--ds-accent-ink);
}

/* Quality settings panel */
.quality-settings-panel {
    padding-top: 8px;
}

/* Wizard subsection styling for quality layer */
.wizard-subsection {
    margin-top: 8px;
}

.wizard-sublabel {
    font-size: 11px;
    opacity: 0.7;
    display: block;
    margin-bottom: 6px;
}

/* ============================================================================
   TOGGLE DROPDOWN - Compact Sector/Scenario Selector
   ============================================================================ */

.toggle-dropdown {
    position: relative;
}

.toggle-dropdown-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 10px 14px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-medium);
    border-radius: 9999px;
    color: var(--text-primary);
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.toggle-dropdown-btn:hover {
    border-color: var(--primary-color);
}

.toggle-dropdown-btn.open {
    border-color: var(--primary-color);
    background: var(--bg-secondary);
}

.toggle-dropdown-btn .toggle-label {
    font-weight: 500;
    opacity: 0.7;
    font-size: 0.75rem;
}

.toggle-dropdown-btn .toggle-value {
    flex: 0 0 auto;
    font-weight: 600;
    color: var(--primary-color);
    text-align: left;
}

.toggle-dropdown-btn .toggle-meta {
    flex: 1;
    font-size: 0.68rem;
    color: var(--text-secondary);
    opacity: 0.75;
    text-align: center;
    white-space: nowrap;
}

.toggle-dropdown-btn .toggle-icon {
    font-size: 0.65rem;
    opacity: 0.6;
    transition: transform 0.2s ease;
    margin-left: auto;
}

.toggle-dropdown-btn.open .toggle-icon {
    transform: rotate(180deg);
}

.toggle-dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 100;
    margin-top: 4px;
    padding: 6px;
    background: var(--bg-elevated);
    border: 1px solid var(--border-medium);
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 4px;
}

/* Scenario dropdown: limit visible rows to ~6 items (3 rows of 2) */
#scenarioMenu {
    max-height: 180px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--primary-color) transparent;
}

#scenarioMenu::-webkit-scrollbar {
    width: 4px;
}

#scenarioMenu::-webkit-scrollbar-track {
    background: transparent;
}

#scenarioMenu::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 4px;
}

.toggle-dropdown-menu .dropdown-item {
    padding: 8px 10px;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 8px;
    color: var(--text-secondary);
    font-size: 0.7rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
    text-align: center;
}

.toggle-dropdown-menu .dropdown-item:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.toggle-dropdown-menu .dropdown-item.active {
    background: var(--primary-color);
    color: var(--ds-accent-ink);
    border-color: var(--primary-color);
}

/* Compact version for 3-column layout */
.toggle-dropdown-btn-sm {
    padding: 8px 10px;
    font-size: 0.75rem;
}

.toggle-dropdown-btn-sm .toggle-label {
    font-size: 0.65rem;
}

.toggle-dropdown-btn-sm .toggle-value {
    font-size: 0.7rem;
}

.toggle-dropdown-btn-sm .toggle-meta {
    font-size: 0.62rem;
}

.toggle-dropdown-btn-sm .toggle-icon {
    font-size: 0.55rem;
}

.cgi-preset-select {
    gap: 2px;
}

.cgi-preset-select .toggle-label {
    min-width: 30px;
}

.cgi-preset-select .toggle-value {
    margin-left: 0;
}

.cgi-preset-select .toggle-meta {
    flex: 1;
    text-align: center;
}


/* CGI Preset */
.cgi-preset-section {
    margin-top: 8px;
    gap: var(--spacing-sm);
}

.cgi-preset-section .wizard-label {
    font-size: 0.8rem;
    font-weight: 500;
}

.cgi-preset-text {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.cgi-preset-title {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-primary);
}

.cgi-preset-subtitle {
    font-size: 0.68rem;
    color: var(--text-secondary);
    opacity: 0.8;
}

/* ── Premium frame editor modal (token-based, low-border) ─────────────── */
.sb-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: sb-modal-fade 0.18s ease;
}
@keyframes sb-modal-fade { from { opacity: 0; } to { opacity: 1; } }
.sb-modal {
    background: var(--bg-elevated);
    color: var(--text-primary);
    border-radius: 14px;
    max-width: 620px;
    width: 100%;
    max-height: 88vh;
    overflow-y: auto;
    padding: 24px;
    box-shadow: 0 24px 70px rgba(0, 0, 0, 0.26);
}
.sb-modal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}
.sb-modal-title {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--text-primary);
}
.sb-modal-close {
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 9px;
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background var(--transition-fast);
}
.sb-modal-close:hover { background: var(--border-medium); }
.sb-modal-qc {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 10px;
    font-size: 0.82rem;
    margin-bottom: 14px;
}
.sb-modal-qc.pass { background: rgba(var(--ds-ok-rgb), 0.12); color: var(--ds-ok); }
.sb-modal-qc.flag { background: rgba(var(--ds-danger-rgb), 0.12); color: var(--ds-danger); }
.sb-modal-qc.repaired { background: rgba(var(--ds-accent-rgb), 0.14); color: var(--ds-accent); }
.sb-modal-label {
    display: block;
    font-size: 0.78rem;
    color: var(--text-secondary);
    margin: 12px 0 6px;
    font-weight: 500;
}
.sb-modal-input {
    width: 100%;
    box-sizing: border-box;
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 1px solid var(--border-light);
    border-radius: 12px;
    padding: 10px 12px;
    font-size: 0.88rem;
    font-family: inherit;
    resize: vertical;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}
.sb-modal-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(var(--ds-accent-rgb), 0.15);
}
.sb-ref-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.sb-ref-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 8px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-light);
    font-size: 0.8rem;
    cursor: pointer;
    transition: all var(--transition-fast);
}
.sb-ref-chip:hover { border-color: var(--primary-color); }
.sb-ref-chip input { accent-color: var(--primary-color); }
.sb-modal-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 22px;
}

/* ── Faz 5b: controlled edit presets + contract transparency ──────────────── */
.sb-preset-wrap { margin: 14px 0 4px; }
.sb-preset-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
}
.sb-preset-btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 9px 14px;
    border-radius: 10px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-light);
    color: var(--text-primary);
    font-size: 0.82rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
}
.sb-preset-btn i { color: var(--primary-color); }
.sb-preset-btn:hover:not(:disabled) {
    border-color: var(--primary-color);
    background: rgba(var(--primary-color-rgb), 0.08);
    transform: translateY(-1px);
}
.sb-preset-btn:disabled { opacity: 0.55; cursor: default; }

/* Korunacaklar (must_not_change) chips */
.sb-guard-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    margin: 12px 0 2px;
}
.sb-guard-title {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-right: 4px;
}
.sb-guard-title i { color: var(--accent-color, #FF9500); }
.sb-guard-chip {
    padding: 3px 9px;
    border-radius: 999px;
    background: rgba(var(--ds-accent-rgb), 0.12);
    color: var(--ds-accent);
    font-size: 0.72rem;
    border: 1px solid rgba(var(--ds-accent-rgb), 0.25);
}

/* Kalite kırılımı (multi-axis scorecard) */
.sb-axis-card {
    margin: 12px 0 2px;
    padding: 12px 14px;
    border-radius: 10px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-light);
}
.sb-axis-head {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 8px;
}
.sb-axis {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 5px 0;
}
.sb-axis-label { flex: 0 0 84px; font-size: 0.76rem; color: var(--text-secondary); }
.sb-axis-track {
    flex: 1;
    height: 7px;
    border-radius: 4px;
    background: var(--bg-tertiary);
    overflow: hidden;
}
.sb-axis-fill { display: block; height: 100%; border-radius: 4px; transition: width 0.3s ease; }
.sb-axis-fill.good { background: var(--ds-ok); }
.sb-axis-fill.warn { background: var(--ds-warn); }
.sb-axis-fill.bad  { background: var(--ds-danger); }
.sb-axis-val { flex: 0 0 28px; text-align: right; font-size: 0.74rem; font-variant-numeric: tabular-nums; color: var(--text-primary); }

/* Advanced (free) edit, collapsed by default */
.sb-edit-advanced { margin-top: 14px; }
.sb-edit-advanced > summary {
    cursor: pointer;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-secondary);
    padding: 8px 0;
    list-style: revert;
}
.sb-edit-advanced > summary:hover { color: var(--primary-color); }
.sb-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    border-radius: 10px;
    font-size: 0.88rem;
    font-weight: 500;
    cursor: pointer;
    border: none;
    transition: all var(--transition-fast);
}
.sb-btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border-light);
}
.sb-btn-ghost:hover { background: var(--bg-tertiary); }
.sb-btn-primary { background: var(--primary-color); color: var(--ds-accent-ink); }
.sb-btn-primary:hover { background: var(--primary-dark, #0051D5); }
.sb-btn-primary:disabled { opacity: 0.6; cursor: default; }

@media (prefers-reduced-motion: reduce) {
    .contact-sheet-frame,
    .frame-image-wrapper img,
    .frame-action-btn,
    .frame-insert-slot,
    .sb-live-line,
    .sb-live-slot img,
    .contact-sheet-grid.sb-just-revealed {
        animation: none !important;
        transition: none !important;
    }

    .contact-sheet-frame:hover,
    .contact-sheet-frame:hover .frame-image-wrapper img,
    .frame-action-btn:hover,
    .frame-insert-slot:hover {
        transform: none !important;
    }
}
