.video-studio-root {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.video-panel {
    min-width: 0;
}

.video-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.5fr) minmax(260px, .8fr);
    gap: 1rem;
    align-items: start;
}

.video-compose textarea {
    min-height: 260px;
    resize: vertical;
}

/* Shared prompt UI primitives used by Text to Video, Image to Video, task detail,
   and future prompt-based Video Studio features. */
.video-prompt-field {
    width: 100%;
    box-sizing: border-box;
    border: 1px solid var(--gray-300);
    border-radius: 6px;
    background: var(--gray-50);
    color: var(--gray-900);
    font-family: inherit;
    font-size: 13px;
    line-height: 1.35;
    box-shadow: inset 0 1px 2px rgba(15, 23, 42, .04);
    transition: border-color .12s ease, background .12s ease, box-shadow .12s ease;
}

.video-prompt-field:focus {
    outline: none;
    border-color: var(--gray-500);
    background: #f8fafc;
    box-shadow: 0 0 0 3px rgba(15, 23, 42, .06);
}

.video-prompt-field-row {
    height: 50px;
    min-height: 50px;
    max-height: 96px;
    padding: 7px 9px;
    resize: vertical;
}

.video-compose textarea.video-prompt-field-row,
textarea.video-prompt-field-row {
    height: 50px;
    min-height: 50px;
    max-height: 96px;
}

/* Task name — simple input matching voice studio style */
.video-task-name-input {
    width: 100%;
    border: 1.5px solid var(--border, var(--border-color));
    border-radius: var(--radius, 8px);
    padding: 11px 14px;
    background: var(--card-bg, #fff);
    color: var(--text-primary);
    font-size: 14px;
    font-family: inherit;
    transition: border-color 0.2s ease;
    outline: none;
}

.video-task-name-input:focus {
    border-color: var(--primary, var(--primary-color));
}

/* Generate bar — button + controls in one row */
.video-generate-bar {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid var(--border-color, var(--border));
    flex-wrap: wrap;
}

.video-generate-controls {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
}

.video-i2v-toolbar {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 18px;
}

.video-i2v-picker {
    position: relative;
    overflow: hidden;
}

.video-i2v-picker input {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
}

.video-i2v-count {
    margin: 0 0 0 auto;
    min-width: 70px;
}

.video-i2v-table-wrap {
    height: clamp(420px, calc(100vh - 470px), 680px);
    max-height: 680px;
    min-height: 420px;
    overflow: auto;
    border: 1px solid var(--border-color);
    border-radius: 8px;
}

.video-i2v-table {
    table-layout: fixed;
}

.video-i2v-table th,
.video-i2v-table td {
    padding: 4px 10px;
    vertical-align: middle;
}

.video-i2v-table thead th {
    position: sticky;
    top: 0;
    z-index: 2;
}

.video-i2v-file {
    display: flex;
    align-items: center;
    gap: 9px;
    min-width: 0;
}

.video-i2v-file img {
    width: 64px;
    height: 46px;
    object-fit: cover;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    background: var(--gray-100);
    flex-shrink: 0;
}

.video-i2v-file div {
    min-width: 0;
    display: grid;
    gap: 3px;
}

.video-i2v-file strong,
.video-i2v-file span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.video-i2v-file strong {
    color: var(--gray-800);
    font-size: 13px;
}

.video-i2v-file span {
    color: var(--gray-500);
    font-size: 12px;
}

.video-i2v-inline-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-left: auto;
    flex-shrink: 0;
}

.video-i2v-order-stack {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.video-i2v-inline-actions .vs-table-icon-btn {
    width: 22px;
    height: 22px;
}

.video-i2v-file-compact img {
    width: 54px;
    height: 40px;
}

.video-i2v-warning {
    color: var(--red-500);
    font-weight: 700;
}

.video-smart-editor.video-smart-editor-i2v {
    height: 120px;
    max-height: 120px;
}

.video-smart-editor.video-smart-editor-i2v .video-editor-textarea {
    height: 120px;
    max-height: 120px;
    min-height: 120px;
}

/* Start-End (first + last frame) */
.video-se-missing {
    color: var(--gray-400);
    font-size: 12px;
    font-style: italic;
    padding: 14px 6px;
    text-align: center;
    border: 1px dashed var(--border-color);
    border-radius: 6px;
    background: var(--gray-50, var(--gray-100));
}

.video-se-counts {
    white-space: nowrap;
}

.video-se-frames {
    display: grid;
    gap: 8px;
}

.video-se-tag {
    display: inline-block;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--primary-600, var(--gray-600));
}

/* ---- Character Sync tab ---- */
.video-cs-counts {
    white-space: nowrap;
}

/* Taller bulk-prompt editor for Character Sync. */
.video-smart-editor.video-smart-editor-cs {
    height: 320px;
    max-height: 320px;
}

.video-smart-editor.video-smart-editor-cs .video-editor-textarea {
    height: 320px;
    max-height: 320px;
    min-height: 320px;
}

.video-cs-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    align-items: start;
}

@media (max-width: 900px) {
    .video-cs-layout { grid-template-columns: 1fr; }
}

.video-cs-layout > div > label,
.video-cs-section-header > label {
    font-weight: 600;
    font-size: 13px;
}

.video-cs-layout > div > label {
    display: block;
    margin-bottom: 6px;
}

.video-cs-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 6px;
}

.video-cs-counts,
.video-cs-character-count {
    white-space: nowrap;
}

/* Compact character grid: 5 across, wraps to 2 rows for the 10 max. */
.video-cs-cards {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 8px;
}

.video-cs-cards-empty {
    grid-column: 1 / -1;
}

@media (max-width: 1200px) {
    .video-cs-cards { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 560px) {
    .video-cs-cards { grid-template-columns: repeat(2, 1fr); }
}

.video-cs-card {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 5px;
    padding: 8px 6px;
    border: 1.5px solid var(--border, var(--border-color));
    border-radius: var(--radius, 6px);
    background: var(--card-bg, #fff);
}

.video-cs-card img {
    width: 100%;
    height: 72px;
    object-fit: cover;
    border-radius: 5px;
}

.video-cs-index {
    font-size: 10px;
    font-weight: 700;
    color: var(--primary-600, var(--gray-600));
}

.video-cs-remove {
    position: absolute;
    top: 4px;
    right: 4px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.55);
    color: #fff;
    cursor: pointer;
    z-index: 2;
}

.video-cs-remove:hover {
    background: var(--red-500, #ef4444);
}

.video-cs-name-input {
    width: 100%;
    box-sizing: border-box;
    padding: 5px 8px;
    border: 1.5px solid var(--border, var(--border-color));
    border-radius: 5px;
    font-size: 12px;
    font-family: inherit;
    background: var(--card-bg, #fff);
    color: var(--text-primary);
    outline: none;
}

.video-cs-name-input:focus {
    border-color: var(--primary, var(--primary-color));
}

.video-cs-name-input.video-cs-name-dupe {
    border-color: var(--red-500, #ef4444);
}

.video-cs-chip {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
    background: var(--primary-50, var(--gray-100));
    color: var(--primary-700, var(--gray-700));
}

.video-cs-match-warn {
    font-size: 12px;
    font-weight: 600;
    color: var(--amber-600, #d97706);
}

.video-cs-preview-prompt {
    font-size: 12px;
    color: var(--text-secondary, var(--gray-600));
    max-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.video-cs-detail-chars {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.video-cs-detail-char {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    width: 56px;
}

.video-cs-detail-char img {
    width: 48px;
    height: 48px;
    object-fit: cover;
    border-radius: 5px;
}

.video-cs-detail-char span {
    font-size: 10px;
    font-weight: 600;
    color: var(--text-secondary, var(--gray-600));
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 56px;
}

.video-generate-select {
    padding: 7px 10px;
    border: 1.5px solid var(--border, var(--border-color));
    border-radius: var(--radius, 6px);
    background: var(--card-bg, #fff);
    color: var(--text-primary);
    font-size: 13px;
    font-family: inherit;
    cursor: pointer;
    outline: none;
}

.video-generate-select:focus {
    border-color: var(--primary, var(--primary-color));
}

.video-generate-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
}

.video-generate-toggle-label {
    font-weight: 600;
    font-size: 13px;
    white-space: nowrap;
    color: var(--text-primary);
}

.video-form-note {
    margin-top: 6px;
    color: var(--gray-500);
    font-size: 12px;
    text-align: right;
}

.video-toggle-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding-top: 26px;
}

.video-actions {
    display: flex;
    justify-content: flex-end;
}

.video-results-card {
    margin-top: 1rem;
}

.video-result-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    flex-wrap: wrap;
}

.video-progress {
    display: grid;
    gap: 8px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border-color);
}

.video-progress-head {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    font-size: 13px;
    font-weight: 700;
    text-transform: capitalize;
}

.video-progress-track {
    height: 10px;
    overflow: hidden;
    border-radius: 999px;
    background: var(--gray-100);
}

.video-progress-track div {
    height: 100%;
    border-radius: inherit;
    background: var(--primary-color);
    transition: width .2s ease;
}

.video-recent-tasks {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 12px;
}

.video-task-chip {
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 7px 9px;
    background: var(--card-bg);
    color: var(--text-primary);
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
}

.video-task-chip.active {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.video-select-all {
    margin-bottom: 12px;
    color: var(--gray-600);
    font-size: 13px;
}

.video-results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 14px;
}

.video-result-card {
    display: grid;
    gap: 10px;
    min-width: 0;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 12px;
    background: var(--card-bg);
}

.video-result-card.selected {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 1px var(--primary-color);
}

.video-result-top,
.video-result-footer,
.video-artifact-row {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    flex-wrap: wrap;
}

.video-check {
    display: inline-flex;
    align-items: center;
}

.video-preview {
    aspect-ratio: 16 / 9;
    overflow: hidden;
    border-radius: 6px;
    background: var(--gray-100);
}

.video-preview video,
.video-preview-empty {
    width: 100%;
    height: 100%;
}

.video-preview video {
    display: block;
    object-fit: contain;
    background: #000;
}

.video-preview-empty {
    display: grid;
    place-items: center;
    color: var(--gray-500);
    font-size: 13px;
    font-weight: 700;
    text-transform: capitalize;
}

.video-prompt-edit {
    display: grid;
    gap: 6px;
}

.video-prompt-edit span {
    color: var(--gray-500);
    font-size: 12px;
    font-weight: 700;
}

.video-prompt-edit textarea {
    min-height: 88px;
    resize: vertical;
}

.video-error {
    border-radius: 6px;
    padding: 8px;
    background: #fee2e2;
    color: #991b1b;
    font-size: 12px;
    overflow-wrap: anywhere;
}

.video-artifacts {
    display: grid;
    gap: 8px;
    margin-top: 18px;
    padding-top: 14px;
    border-top: 1px solid var(--border-color);
}

.video-artifacts h3 {
    margin: 0;
    font-size: 15px;
}

.video-artifact-row {
    justify-content: space-between;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 8px 10px;
}

.video-profile-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    flex-wrap: wrap;
}

.video-profile-actions input[type="file"] {
    max-width: 260px;
    font-size: 12px;
}

.video-inline-input {
    width: min(220px, 100%);
    min-width: 140px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 7px 9px;
    background: var(--card-bg);
    color: var(--text-primary);
}

.video-row-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}

.video-kv,
.video-setting-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 10px 0;
    border-bottom: 1px solid var(--border-color);
}

.video-kv:last-child,
.video-setting-row:last-child {
    border-bottom: 0;
}

.video-kv > span,
.video-setting-row > span {
    color: var(--gray-500);
    font-size: 13px;
}

.video-kv strong,
.video-setting-row strong {
    min-width: 0;
    overflow-wrap: anywhere;
    text-align: right;
}

.video-setting-row input,
.video-setting-row select {
    width: min(260px, 100%);
}

.video-status {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    padding: 0 8px;
    border-radius: 999px;
    background: var(--gray-100);
    color: var(--gray-700);
    font-size: 12px;
    font-weight: 700;
    text-transform: capitalize;
}

.video-status.active {
    background: #eef2ff;
    color: #3730a3;
}

.video-status.completed {
    background: #dcfce7;
    color: #166534;
}

.video-status.failed,
.video-status.canceled {
    background: #fee2e2;
    color: #991b1b;
}

.video-empty {
    padding: 28px;
    text-align: center;
    color: var(--gray-500);
}

.video-empty.compact {
    width: 100%;
    padding: 12px 0;
    text-align: left;
}

.video-mono {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 12px;
}

.video-settings-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0 28px;
}

/* ── Settings tab — clean stacked-field cards ─────────────────────────── */
.vs-settings { position: relative; padding-bottom: 8px; }

.vs-settings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(290px, 1fr));
    gap: 18px;
    align-items: start;
}

/* Cards that hold a table (Profiles) span the full width of the grid. */
.vs-card-wide { grid-column: 1 / -1; }

/* Fields inside a card stack their label above the control and flow in a
   responsive sub-grid so short numeric fields sit two-up. */
.vs-field-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 16px;
}

.vs-field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.vs-field-full { grid-column: 1 / -1; }

.vs-field-label {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--gray-500);
}

.vs-field-input {
    width: 100%;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 9px 11px;
    background: var(--card-bg);
    color: var(--gray-800);
    font-size: 14px;
    transition: border-color .12s ease, box-shadow .12s ease;
}
.vs-field-input:focus {
    outline: none;
    border-color: var(--gray-500);
    box-shadow: 0 0 0 3px rgba(15, 23, 42, .07);
}
textarea.vs-field-input {
    resize: vertical;
    min-height: 112px;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 12.5px;
}

.vs-card-note {
    margin: 0 0 14px;
    color: var(--gray-500);
    font-size: 12.5px;
    line-height: 1.45;
}

/* One floating Save bar for the whole Settings tab. */
.vs-settings-save {
    position: sticky;
    bottom: 14px;
    display: flex;
    justify-content: flex-end;
    margin-top: 20px;
    pointer-events: none;
}
.vs-settings-save .btn {
    pointer-events: auto;
    box-shadow: 0 6px 18px rgba(15, 23, 42, .14);
}

.video-debug-filters {
    display: grid;
    grid-template-columns: repeat(5, minmax(130px, 1fr));
    gap: 10px;
    border-bottom: 1px solid var(--border-color);
}

.video-debug-filter {
    display: grid;
    gap: 5px;
}

.video-debug-filter span {
    color: var(--gray-500);
    font-size: 12px;
    font-weight: 700;
}

@media (max-width: 900px) {
    .video-grid,
    .video-settings-grid,
    .video-debug-filters {
        grid-template-columns: 1fr;
    }

    .video-result-actions {
        justify-content: flex-start;
    }
}

/* --- Task-Centric Extensions & Navigation --- */
.video-task-link {
    color: var(--text);
    font-weight: 600;
    text-decoration: none;
    transition: var(--transition);
}

.video-task-link:hover {
    color: var(--primary-hover);
    text-decoration: underline;
}

.video-progress-cell {
    display: flex;
    flex-direction: column;
    gap: 6px;
    align-items: flex-start;
    justify-content: center;
    min-width: 120px;
}

.video-mini-track {
    width: 100%;
    max-width: 140px;
    height: 5px;
    background: var(--gray-200);
    border-radius: 999px;
    overflow: hidden;
}

.video-mini-track div {
    height: 100%;
    background: var(--primary);
    border-radius: inherit;
    transition: width 0.3s ease;
}

/* --- Task Detail View Layout --- */
.video-task-detail-header-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 20px;
    background: var(--surface);
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    padding: 14px 20px;
    box-shadow: var(--shadow-sm);
}

.video-task-detail-meta {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.video-task-detail-meta strong {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--gray-900);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.video-task-detail-meta .vs-muted {
    font-size: 0.85rem;
    color: var(--gray-500);
}

.video-prompt-cell {
    max-width: 380px;
    word-break: break-word;
    white-space: pre-wrap;
    line-height: 1.5;
}

/* Compact prompts table — rows sized to fit the video thumbnail, content
   vertically centered so prompt / status / thumbnail / actions align. */
.video-prompts-scroll .data-table td {
    padding-top: 1px;
    padding-bottom: 1px;
    vertical-align: middle;
}

.video-prompt-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
}

.video-prompt-edit-actions {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}

.video-prompts-scroll textarea.video-prompt-field-row {
    height: 56px;
    min-height: 56px;
    max-height: 96px;
    margin: 0;
}

/* --- Task Summary Horizontal Card Layout --- */
.video-summary-horizontal {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    flex-wrap: wrap;
    padding: 1rem 1.25rem !important;
}

/* Merged task-detail header: back/refresh on top, title + date, then stats. */
.video-task-detail-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 14px;
}
.video-task-detail-title { margin-bottom: 4px; }
.video-task-detail-title h2 {
    margin: 0;
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--gray-900);
}
.video-task-detail-title .vs-muted {
    display: block;
    margin-top: 4px;
    font-size: 13px;
    color: var(--gray-500);
}
/* Reuses the summary flex layout but sits inside a real card-body, so drop the
   standalone padding and add a divider above the stats. */
.video-task-detail-stats {
    padding: 16px 0 0 !important;
    border-top: 1px solid var(--border-color);
    margin-top: 16px;
}

.video-summary-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

.video-summary-item.flex-grow {
    flex: 1;
    min-width: 140px;
}

.video-summary-item .label {
    font-size: 11px;
    font-weight: 600;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: .05em;
    white-space: nowrap;
}

.video-summary-item .value {
    font-size: 14px;
    font-weight: 700;
    color: var(--gray-800);
}

.video-summary-item .value.text-red {
    color: var(--red-500);
}

.video-summary-divider {
    width: 1px;
    height: 32px;
    background: var(--border-light);
    align-self: center;
}

@media (max-width: 768px) {
    .video-summary-horizontal {
        gap: 1rem;
    }
    .video-summary-divider {
        display: none;
    }
    .video-summary-item {
        flex: 1 1 120px;
    }
}

/* --- Video Thumbnail overlay --- */
.video-thumbnail-container {
    position: relative;
    width: 96px;
    aspect-ratio: 16 / 9;
    border-radius: var(--radius-xs);
    overflow: hidden;
    background: #000;
    cursor: pointer;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-light);
}

.video-thumbnail-container video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.video-thumbnail-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.video-thumbnail-container:hover .video-thumbnail-overlay {
    opacity: 1;
}

.video-path-text {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 11px;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: inline-block;
    max-width: 160px;
    direction: rtl;
    text-align: left;
    unicode-bidi: plaintext;
}

/* --- Table Icon Buttons --- */
.vs-table-icon-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--white);
    border: 1.5px solid var(--border);
    color: var(--gray-600);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    flex-shrink: 0;
    padding: 0;
}

.vs-table-icon-btn svg {
    transition: transform 0.15s ease;
}

.vs-table-icon-btn:hover:not(:disabled) {
    background: var(--gray-900);
    color: var(--white);
    border-color: var(--gray-900);
    transform: scale(1.08);
}

.vs-table-icon-btn.is-playing {
    background: var(--primary);
    color: var(--white);
    border-color: var(--primary);
}

.vs-table-icon-btn.vs-btn-delete:hover {
    background: #fee2e2 !important;
    color: var(--red-600) !important;
    border-color: #fca5a5 !important;
}

.vs-table-icon-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* --- Floating Glassmorphic Video Player --- */
.video-player-bar {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translate(-50%, 120%);
    z-index: 1000;
    width: min(560px, 94%);
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border: 1px solid rgba(255, 255, 255, 0.45);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    border-radius: var(--radius);
    padding: 16px 20px;
    opacity: 0;
    pointer-events: none;
    transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.3s ease;
}

.video-player-bar.show {
    transform: translate(-50%, 0);
    opacity: 1;
    pointer-events: auto;
}

.video-player-container {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.video-player-close {
    position: absolute;
    top: -4px;
    right: -4px;
    background: none;
    border: none;
    color: var(--gray-500);
    cursor: pointer;
    padding: 6px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.video-player-close:hover {
    background: var(--gray-100);
    color: var(--gray-900);
}

.video-player-media {
    background: #000;
    border-radius: var(--radius-sm);
    overflow: hidden;
    aspect-ratio: 16 / 9;
    box-shadow: inset 0 0 12px rgba(0, 0, 0, 0.2);
}

.video-player-media video {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

.video-player-controls {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.video-player-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.video-player-name {
    font-size: 13px;
    font-weight: 700;
    color: var(--gray-800);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 90%;
}

.video-player-controls-row {
    display: flex;
    align-items: center;
    gap: 16px;
}

.video-player-transport {
    display: flex;
    align-items: center;
    gap: 10px;
}

.video-player-skip {
    background: none;
    border: none;
    color: var(--gray-600);
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.video-player-skip:hover {
    color: var(--primary);
}

.video-player-play {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--primary);
    border: none;
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    box-shadow: 0 3px 8px rgba(229, 57, 53, 0.3);
}

.video-player-play:hover {
    background: var(--primary-hover);
    transform: scale(1.05);
}

.video-player-progress-container {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 10px;
}

.video-player-time {
    font-size: 11px;
    color: var(--gray-500);
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-weight: 500;
    min-width: 32px;
}

.video-player-progress-bar-wrap {
    flex: 1;
    height: 6px;
    background: var(--gray-300);
    border-radius: 999px;
    position: relative;
    cursor: pointer;
    overflow: hidden;
    transition: height 0.15s ease;
}

.video-player-progress-bar-wrap:hover {
    height: 8px;
}

.video-player-progress-bar {
    height: 100%;
    background: var(--primary);
    border-radius: inherit;
    width: 0%;
}

.video-player-download {
    color: var(--gray-600);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4px;
    transition: var(--transition);
}

.video-player-download:hover {
    color: var(--primary);
}

/* --- Smart Prompt Editor --- */
.video-smart-editor {
    position: relative;
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    background: var(--gray-50);
    overflow: hidden;
    display: flex;
    height: 360px;
    max-height: 360px;
}

.video-editor-gutter {
    width: 48px;
    flex-shrink: 0;
    background: var(--gray-50);
    border-right: 1.5px solid var(--border);
    display: flex;
    flex-direction: column;
    user-select: none;
    pointer-events: none;
    overflow-x: hidden;
    overflow-y: hidden;
    padding-top: 12px;
    padding-bottom: 12px;
    color: var(--gray-400);
    font-size: 13px;
    line-height: 24px;
    text-align: right;
    padding-right: 10px;
    font-family: monospace;
}

.video-editor-gutter-line {
    display: flex;
    align-items: flex-start;
    justify-content: flex-end;
    line-height: 24px;
    flex-shrink: 0;
}

.video-editor-gutter-line.has-prompt {
    color: var(--gray-600);
    font-weight: 600;
}

.video-editor-backdrop {
    position: absolute;
    top: 0;
    left: 48px;
    right: 0;
    bottom: 0;
    pointer-events: none;
    overflow-x: hidden;
    overflow-y: hidden;
    padding: 12px 14px;
    display: flex;
    flex-direction: column;
}

.video-editor-backdrop-line {
    display: flex;
    align-items: flex-end;
    flex-shrink: 0;
}

.video-editor-backdrop-line .divider {
    width: 100%;
    border-bottom: 1px dashed var(--border);
    margin-bottom: 0px;
    opacity: 0.7;
}

.video-editor-textarea {
    flex: 1;
    height: 360px;
    max-height: 360px;
    min-height: 360px;
    background: transparent;
    color: var(--gray-900);
    border: none;
    padding: 12px 14px;
    font-family: inherit;
    font-size: 14px;
    line-height: 24px;
    resize: none;
    outline: none;
    white-space: pre-wrap;
    word-break: break-word;
    overflow-x: hidden;
    overflow-y: auto;
}

.video-smart-editor:focus-within {
    border-color: var(--gray-500);
    box-shadow: 0 0 0 3px rgba(15, 23, 42, .06);
}

/* ═══ TASK DETAIL PROMPTS TABLE — internal fixed-height scroll ═══ */
/* Keep the top bar, stats and the Prompts header/action buttons always
   visible by giving the prompts table its own scroll area instead of
   letting the whole page grow. Header row stays pinned while scrolling. */
.video-prompts-scroll {
    max-height: calc(100vh - 340px);
    min-height: 200px;
    overflow-y: auto;
    overflow-x: auto;
}
.video-prompts-scroll thead th {
    position: sticky;
    top: 0;
    z-index: 2;
}

/* History table — fixed height with its own scrollbar + sticky header, like
   the other data tables in the app. */
.video-history-scroll {
    max-height: calc(100vh - 240px);
    overflow-y: auto;
    overflow-x: auto;
}
.video-history-scroll thead th {
    position: sticky;
    top: 0;
    z-index: 2;
    background: var(--gray-50, #f9fafb);
}
