body[data-page="commercial-video"] {
    background: #f5f6fb;
    color: #111827;
}

.cv-app {
    min-height: 100vh;
}

.cv-topbar {
    height: 68px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 28px;
    border-bottom: 1px solid #dfe3f0;
    background: #fff;
}

.cv-topbar-left {
    display: flex;
    align-items: center;
    gap: 18px;
}

.cv-back-link {
    border-radius: 999px;
}

.cv-workspace {
    height: calc(100vh - 68px);
    display: grid;
    grid-template-columns: 300px minmax(470px, 600px) minmax(520px, 1fr);
    gap: 14px;
    padding: 14px;
    overflow: hidden;
}

.cv-task-panel,
.cv-chat-panel,
.cv-result-panel {
    min-height: 0;
    border: 1px solid #dfe3f0;
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 8px 28px rgba(74, 85, 140, .08);
}

.cv-task-panel {
    display: flex;
    flex-direction: column;
    padding: 14px;
}

.cv-new-task {
    height: 46px;
    border: 0;
    border-radius: 7px;
    color: #fff;
    background: linear-gradient(100deg, #48b7ef, #8757f7);
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
}

.cv-task-list {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    margin: 14px -4px 10px;
    padding: 0 4px;
}

.cv-task-item {
    width: 100%;
    display: grid;
    grid-template-columns: 60px 1fr auto;
    gap: 10px;
    align-items: center;
    padding: 11px;
    margin-bottom: 8px;
    border: 1px solid transparent;
    border-radius: 7px;
    background: #fff;
    text-align: left;
}

.cv-task-item:hover {
    background: #f7f8ff;
}

.cv-task-item.is-active {
    border-color: #9694ff;
    background: #f1f1ff;
}

.cv-task-thumb {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border: 1px solid #dfe3f0;
    border-radius: 7px;
    background: #f4f6fb;
}

.cv-task-copy {
    min-width: 0;
}

.cv-task-name {
    display: block;
    overflow: hidden;
    color: #202638;
    font-size: 14px;
    font-weight: 750;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.cv-task-meta {
    display: block;
    margin-top: 5px;
    color: #667085;
    font-size: 12px;
}

.cv-task-delete {
    border: 0;
    color: #98a2b3;
    background: transparent;
}

.cv-task-state {
    display: inline-block;
    margin-top: 6px;
    padding: 2px 7px;
    border-radius: 999px;
    color: #6b7280;
    background: #f3f4f6;
    font-size: 11px;
}

.cv-task-state.scene,
.cv-task-state.script,
.cv-task-state.storyboard,
.cv-task-state.video,
.cv-task-state.processing {
    color: #5b55e7;
    background: #eeedff;
}

.cv-task-state.done {
    color: #159447;
    background: #eafaf0;
}

.cv-task-state.failed {
    color: #dc2626;
    background: #fef2f2;
}

.cv-task-empty {
    padding: 18px 8px;
    color: #98a2b3;
    font-size: 13px;
    text-align: center;
}

.cv-task-filter {
    padding-top: 10px;
    border-top: 1px solid #edf0f7;
}

.cv-search {
    height: 38px;
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 0 10px;
    border: 1px solid #dfe3f0;
    border-radius: 6px;
    color: #98a2b3;
}

.cv-search input {
    width: 100%;
    border: 0;
    outline: 0;
    color: #30364a;
}

.cv-chat-panel {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.cv-chat-head,
.cv-result-head {
    min-height: 72px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 16px;
    border-bottom: 1px solid #dfe3f0;
}

.cv-chat-title {
    color: #111827;
    font-size: 16px;
    font-weight: 800;
}

.cv-chat-subtitle,
.cv-result-head p {
    margin: 5px 0 0;
    color: #667085;
    font-size: 12px;
}

.cv-status {
    flex: 0 0 auto;
    padding: 4px 9px;
    border-radius: 999px;
    color: #5b55e7;
    background: #eeedff;
    font-size: 12px;
    font-weight: 750;
}

.cv-chat-scroll,
.cv-result-scroll {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 16px;
}

.cv-source-card {
    padding: 16px;
    border: 1px solid #dcdfff;
    border-radius: 8px;
    background: #fafaff;
}

.cv-source-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
    color: #202638;
    font-weight: 800;
}

.cv-field {
    display: block;
    margin-top: 13px;
}

.cv-field > label,
.cv-form-grid > div > span {
    display: block;
    margin-bottom: 7px;
    color: #344054;
    font-size: 13px;
    font-weight: 650;
}

.cv-field b {
    color: #ef4444;
}

#cv-chat-input,
.cv-script-preview {
    width: 100%;
    border: 1px solid #d8dcef;
    border-radius: 6px;
    outline: 0;
    color: #30364a;
    background: #fff;
}

#cv-chat-input:focus,
.cv-script-preview:focus {
    border-color: #635bff;
    box-shadow: 0 0 0 3px rgba(99, 91, 255, .1);
}

.cv-upload-box {
    min-height: 146px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    border: 1px dashed #a9adff;
    border-radius: 7px;
    color: #5d63a3;
    background: #fff;
    text-align: center;
    cursor: pointer;
}

.cv-upload-box:hover,
.cv-upload-box.is-dragover {
    border-color: #635bff;
    background: #eef2ff;
}

.cv-upload-box.is-dragover {
    border-style: solid;
    box-shadow: inset 0 0 0 1px rgba(99, 91, 255, .14);
}

.cv-upload-box i {
    color: #635bff;
    font-size: 25px;
}

.cv-upload-box strong {
    color: #30364a;
    font-size: 13px;
}

.cv-upload-box small {
    color: #8b92a7;
}

.cv-upload-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    margin-top: 0;
}

.cv-upload-actions .btn {
    border-radius: 999px;
    color: #635bff;
    border-color: #a7a5ff;
    background: #fff;
    font-weight: 750;
}

.cv-preview-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 9px;
}

.cv-preview-item {
    position: relative;
    width: 64px;
    height: 64px;
}

.cv-preview-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border: 1px solid #d7dbea;
    border-radius: 6px;
}

.cv-preview-role {
    position: absolute;
    left: 3px;
    bottom: 3px;
    padding: 1px 5px;
    border-radius: 4px;
    color: #fff;
    background: rgba(17, 24, 39, .72);
    font-size: 10px;
}

.cv-preview-delete {
    position: absolute;
    top: -6px;
    right: -6px;
    width: 18px;
    height: 18px;
    border: 2px solid #fff;
    border-radius: 50%;
    color: #fff;
    background: #ef4444;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    cursor: pointer;
    box-shadow: 0 1px 2px rgba(15, 23, 42, .16);
}

.cv-preview-delete i {
    font-size: 11px;
    line-height: 1;
}

.cv-preview-delete:hover {
    background: #dc2626;
}

.cv-char-count {
    margin-top: 8px;
    color: #98a2b3;
    font-size: 12px;
}

.cv-form-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 11px;
}

.cv-segmented {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
}

.cv-segmented button {
    height: 38px;
    border: 1px solid #d8dcef;
    border-radius: 7px;
    color: #4b5563;
    background: #fff;
    font-weight: 400;
    cursor: pointer;
}

.cv-segmented button.active {
    border-color: #7775ff;
    color: #5b5ff0;
    background: #eef2ff;
}

.cv-duration-select {
    position: relative;
    width: calc((100% - 16px) / 3);
}

.cv-duration-trigger {
    width: 100%;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    border: 1px solid #d8dcef;
    border-radius: 7px;
    color: #111827;
    background: #fff;
    font-size: 13px;
    font-weight: 400;
    line-height: 1;
    white-space: nowrap;
    cursor: pointer;
    box-shadow: none;
}

.cv-duration-trigger i {
    flex: 0 0 auto;
    color: #5961f4;
    font-size: 13px;
    line-height: 1;
}

.cv-duration-trigger span {
    display: inline-flex;
    align-items: baseline;
    gap: 3px;
    margin: 0;
    color: inherit;
    font-size: inherit;
    font-weight: inherit;
    line-height: 1;
    white-space: nowrap;
}

.cv-duration-trigger strong {
    font-size: inherit;
    font-weight: inherit;
    line-height: inherit;
}

.cv-duration-trigger .fa-chevron-down {
    margin-left: 0;
    font-size: 11px;
    transition: transform .18s ease;
}

.cv-duration-select.open .cv-duration-trigger {
    border-color: #7775ff;
    background: #f6f7ff;
}

.cv-duration-select.open .cv-duration-trigger .fa-chevron-down {
    transform: rotate(180deg);
}

.cv-duration-menu {
    position: absolute;
    left: 0;
    right: 0;
    bottom: calc(100% + 8px);
    z-index: 20;
    max-height: 318px;
    overflow-y: auto;
    display: none;
    padding: 8px;
    border: 1px solid #dbe1f2;
    border-radius: 18px;
    background: #fff;
    box-shadow: 0 18px 42px rgba(15, 23, 42, 0.16);
}

.cv-duration-select.open .cv-duration-menu {
    display: grid;
    gap: 2px;
}

.cv-duration-menu button {
    min-height: 38px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 12px;
    border: 0;
    border-radius: 10px;
    color: #1f2937;
    background: transparent;
    font-size: 13px;
    font-weight: 400;
    cursor: pointer;
}

.cv-duration-menu button[hidden] {
    display: none;
}

.cv-duration-menu button:hover,
.cv-duration-menu button.active {
    background: #f4f5ff;
    color: #4f46e5;
}

.cv-duration-menu button i {
    visibility: hidden;
    color: #111827;
    font-size: 12px;
}

.cv-duration-menu button.active i {
    visibility: visible;
}

.cv-start-btn {
    width: 100%;
    min-height: 58px;
    display: grid;
    grid-template-columns: 24px 1fr 18px;
    gap: 10px;
    align-items: center;
    margin-top: 14px;
    padding: 10px 14px;
    border: 0;
    border-radius: 7px;
    color: #fff;
    background: linear-gradient(100deg, #4a9ff2, #8757f7);
    text-align: left;
    cursor: pointer;
}

.cv-start-btn:disabled {
    cursor: wait;
    opacity: .7;
}

.cv-start-btn strong,
.cv-start-btn small {
    display: block;
}

.cv-start-btn strong {
    font-size: 15px;
}

.cv-start-btn small {
    margin-top: 3px;
    color: rgba(255, 255, 255, .8);
    font-size: 11px;
}

.cv-messages {
    padding: 18px 2px 4px;
}

.cv-message {
    display: flex;
    gap: 9px;
    margin-bottom: 14px;
}

.cv-message.is-user {
    flex-direction: row-reverse;
}

.cv-avatar {
    width: 31px;
    height: 31px;
    flex: 0 0 31px;
    display: grid;
    place-items: center;
    overflow: hidden;
    border-radius: 999px;
    color: #fff;
    background: #635bff;
    font-size: 12px;
    font-weight: 800;
}

.cv-avatar img {
    width: 100%;
    height: 100%;
    display: block;
}

.cv-message.is-user .cv-avatar {
    background: #111827;
}

.cv-bubble {
    max-width: 82%;
    padding: 10px 12px;
    border: 1px solid #e1e4f0;
    border-radius: 7px;
    color: #30364a;
    background: #fff;
    font-size: 14px;
    line-height: 1.7;
    overflow-wrap: anywhere;
}

.cv-message.is-user .cv-bubble {
    border-color: #dcd9ff;
    background: #efeeff;
}

.cv-thinking { display: flex; align-items: center; gap: 8px; color: #737b91; }
.cv-thinking-dots { display: inline-flex; gap: 3px; }
.cv-thinking-dots i { width: 5px; height: 5px; background: #2563eb; border-radius: 50%; animation: cv-thinking 1s infinite ease-in-out; }
.cv-thinking-dots i:nth-child(2) { animation-delay: .14s; }
.cv-thinking-dots i:nth-child(3) { animation-delay: .28s; }
@keyframes cv-thinking {
    0%, 80%, 100% { opacity: .3; transform: translateY(0); }
    40% { opacity: 1; transform: translateY(-2px); }
}

.cv-bubble p {
    margin: 0;
    white-space: pre-wrap;
}

.cv-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}

.cv-actions button,
.cv-result-actions button {
    border: 1px solid #7775ff;
    border-radius: 999px;
    padding: 8px 12px;
    color: #5b5ff0;
    background: #fff;
    font-size: 13px;
    font-weight: 850;
    cursor: pointer;
}

.cv-script-preview {
    max-height: 280px;
    overflow-y: auto;
    margin-top: 10px;
    padding: 12px;
    white-space: pre-wrap;
    line-height: 1.65;
}

.cv-image-card {
    display: grid;
    grid-template-columns: 112px 1fr;
    gap: 12px;
    align-items: start;
}

.cv-image-card img,
.cv-image-skeleton {
    width: 112px;
    height: 112px;
    border: 1px solid #d8dcef;
    border-radius: 7px;
    object-fit: cover;
    background: #f4f6fb;
}

.cv-image-skeleton {
    display: grid;
    place-items: center;
    color: #635bff;
    background:
        linear-gradient(90deg, #f3f4ff 25%, #e8eaff 37%, #f3f4ff 63%);
    background-size: 400% 100%;
    animation: cv-shimmer 1.4s ease infinite;
}

.cv-image-card strong {
    display: block;
    color: #202638;
    font-weight: 850;
}

.cv-image-card p {
    margin-top: 6px;
    color: #667085;
    font-size: 13px;
}

@keyframes cv-shimmer {
    0% { background-position: 100% 0; }
    100% { background-position: 0 0; }
}

.cv-chat-composer {
    padding: 12px 14px;
    border-top: 1px solid #dfe3f0;
    background: #fff;
}

#cv-chat-input {
    width: 100%;
    min-height: 70px;
    max-height: 140px;
    padding: 10px 12px;
    resize: vertical;
}

.cv-composer-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 8px;
}

.cv-price-summary {
    max-width: 72%;
    color: #60677b;
    font-size: 12px;
    font-weight: 650;
    line-height: 1.55;
}

.cv-price-summary.is-insufficient {
    color: #dc2626;
}

.cv-send-btn {
    height: 36px;
    padding: 0 15px;
    border: 0;
    color: #fff;
    background: #635bff;
    border-radius: 6px;
    font-weight: 700;
}

.cv-send-btn:disabled {
    background: #c9ccda;
    cursor: not-allowed;
}

.cv-result-panel {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.cv-result-head h2 {
    margin: 0;
    color: #111827;
    font-size: 16px;
    font-weight: 800;
}

.cv-result-empty {
    min-height: 360px;
    display: grid;
    place-items: center;
    align-content: center;
    gap: 8px;
    color: #98a2b3;
    text-align: center;
}

.cv-result-empty i {
    color: #c6c9d8;
    font-size: 34px;
}

.cv-result-empty strong {
    color: #667085;
    font-size: 15px;
}

.cv-result-empty span {
    max-width: 260px;
    font-size: 12px;
    line-height: 1.6;
}

.cv-result-stack {
    display: grid;
    gap: 14px;
}

.cv-result-card {
    padding: 14px;
    border: 1px solid #e1e4f0;
    border-radius: 8px;
    background: #fff;
}

.cv-result-card.is-pending {
    border-color: #dcd9ff;
    background: #fbfbff;
}

.cv-result-card.is-failed {
    border-color: #ffd5d5;
    background: #fffafa;
}

.cv-result-card-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}

.cv-result-title {
    color: #202638;
    font-size: 15px;
    font-weight: 850;
}

.cv-result-meta {
    margin-top: 4px;
    color: #98a2b3;
    font-size: 12px;
}

.cv-result-media {
    width: 100%;
    overflow: hidden;
    border-radius: 7px;
    background: #f4f6fb;
}

.cv-result-media img,
.cv-result-media video {
    width: 100%;
    display: block;
}

.cv-result-media.is-portrait {
    width: min(280px, 100%);
}

.cv-result-loading {
    min-height: 320px;
    display: grid;
    place-items: center;
    align-content: center;
    gap: 10px;
    color: #6b6ff5;
    text-align: center;
}

.cv-result-loading i {
    font-size: 30px;
}

.cv-result-loading strong {
    color: #202638;
    font-size: 16px;
}

.cv-result-loading span {
    color: #98a2b3;
    font-size: 12px;
}

.cv-result-loading.is-error {
    color: #ef4444;
}

.cv-image-preview-btn {
    display: block;
    width: 112px;
    height: 112px;
    flex: 0 0 112px;
    overflow: hidden;
    padding: 0;
    border: 0;
    border-radius: 7px;
    background: #f4f6fb;
    cursor: zoom-in;
}

.cv-image-preview-btn img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
}

.hidden {
    display: none !important;
}

@media (max-width: 1180px) {
    .cv-workspace {
        grid-template-columns: 260px minmax(430px, 1fr);
        overflow-y: auto;
    }

    .cv-result-panel {
        grid-column: 1 / -1;
        min-height: 520px;
    }
}

@media (max-width: 860px) {
    .cv-workspace {
        height: auto;
        grid-template-columns: 1fr;
    }

    .cv-task-panel,
    .cv-chat-panel,
    .cv-result-panel {
        min-height: 0;
    }

    .cv-chat-panel {
        min-height: 720px;
    }

    .cv-form-grid {
        grid-template-columns: 1fr;
    }
}
