.video-page-active .header-section { padding: 14px 0; margin-bottom: 14px; }
.video-page-active .header-section h1 { font-size: 25px; margin-bottom: 6px; letter-spacing: 0; }
.video-page-active .header-section .header-logo { width: 32px; height: 32px; }
.video-page-active .header-section .subtitle { display: none; }
.video-page-active .page-mode-switch { margin: 14px auto 22px; border-radius: 8px; }
.video-page-active .page-mode-btn { border-radius: 6px; }
.video-workbench {
    --vw-accent: #ff9f1c;
    --vw-border: #e2e8f0;
    --vw-text: #2d3748;
    --vw-surface: #fff8e1;
    --vw-highlight: #fbd38d;
    --vw-muted: #718096;
    --vw-primary: linear-gradient(135deg, #ffaa00 0%, #ff8800 100%);
    color: var(--vw-text);
    min-width: 0;
    padding: 12px 0 32px;
    letter-spacing: 0;
}
.video-workbench *, .video-prompt-insert { box-sizing: border-box; letter-spacing: 0; }
.video-workbench [hidden], .video-prompt-insert[hidden] { display: none !important; }
.vw-header, .vw-toolbar, .vw-card-head, .vw-card-footer, .vw-ref-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}
.vw-header { padding: 12px 0 20px; flex-wrap: wrap; }
.vw-header h2 { font-size: 23px; margin: 0 0 6px; color: var(--vw-text); }
#videoQueueStats { font-size: 13px; color: var(--vw-muted); }
.vw-actions, .vw-prompt-tools { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.video-workbench button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 36px;
    padding: 7px 11px;
    background: #fff;
    color: var(--vw-text);
    border: 1px solid var(--vw-border);
    border-radius: 6px;
    font: inherit;
    font-size: 13px;
    line-height: 1.4;
    cursor: pointer;
    white-space: normal;
}
.video-workbench button:hover:not(:disabled) { background: #fff7ed; border-color: var(--vw-highlight); }
.video-workbench button:focus-visible, .video-workbench input:focus-visible,
.video-workbench select:focus-visible, .video-workbench textarea:focus-visible {
    outline: 2px solid var(--vw-accent);
    outline-offset: 2px;
}
.video-workbench button:disabled { opacity: .5; cursor: not-allowed; }
.video-workbench button.vw-primary { background: var(--vw-primary); color: white; border-color: var(--vw-accent); }
.video-workbench button.vw-primary:hover:not(:disabled) { background: linear-gradient(135deg, #ff9f1c 0%, #f07800 100%); }
.video-workbench .lucide, #videoPageBtn .lucide { width: 17px; height: 17px; flex: 0 0 17px; }
.vw-api { display: flex; gap: 12px; padding: 16px 0; align-items: end; flex-wrap: wrap; border-top: 1px solid var(--vw-border); }
.vw-api label { flex: 1 1 240px; min-width: 0; font-size: 13px; }
.video-workbench input:not([type="checkbox"]), .video-workbench select, .video-workbench textarea {
    width: 100%; min-width: 0; border: 1px solid var(--vw-border); border-radius: 5px;
    background: #fff; color: var(--vw-text); padding: 9px; font: inherit; font-size: 13px;
}
.video-workbench input[type="checkbox"], .video-prompt-insert input { accent-color: #ff9f1c; width: 16px; height: 16px; }
.vw-toolbar { padding: 12px 0; margin-bottom: 18px; border-block: 1px solid var(--vw-border); flex-wrap: wrap; }
.vw-toolbar > label, .vw-card-title { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.vw-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; align-items: start; }
.vw-card {
    min-width: 0; padding: 18px; background: var(--vw-surface); border: 1px solid var(--vw-border);
    border-radius: 8px; box-shadow: 0 4px 6px -1px #0000000d;
}
.vw-card.is-active { border-color: var(--vw-accent); box-shadow: 0 0 0 1px var(--vw-accent); }
.vw-card-head { margin-bottom: 16px; }
.vw-card-title { font-weight: 600; white-space: nowrap; }
.vw-card-head .vw-actions { margin-left: auto; flex-wrap: nowrap; }
.vw-card-head button, .vw-ref-heading button { padding: 7px; width: 34px; height: 34px; min-height: 34px; }
.vw-target { color: #c05621; font-size: 11px; min-height: 16px; }
.vw-field { display: flex; flex-direction: column; gap: 7px; min-width: 0; font-size: 12px; color: #4a5568; }
.vw-field textarea { resize: vertical; min-height: 110px; line-height: 1.7; overflow-wrap: anywhere; }
.vw-prompt-tools { justify-content: flex-end; margin: 8px 0 16px; }
.vw-prompt-tools button { min-height: 30px; padding-block: 4px; }
.vw-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.vw-model-field, .vw-priced-format { grid-column: 1 / -1; }
.vw-model-id { font-size: 11px; line-height: 1.5; overflow-wrap: anywhere; color: var(--vw-muted); }
.vw-model-picker { position: relative; min-width: 0; }
.video-workbench .vw-model-trigger, .video-workbench .vw-model-option {
    display: grid; grid-template-columns: minmax(0, 1fr) 17px; width: 100%; gap: 12px;
    padding: 4px 12px; min-height: 51px; text-align: left;
}
.vw-model-trigger[aria-expanded="true"] { border-color: var(--vw-accent); }
.vw-model-trigger > .lucide { color: var(--vw-muted); transition: transform .15s; }
.vw-model-trigger[aria-expanded="true"] > .lucide { transform: rotate(180deg); }
.vw-model-summary { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: start; gap: 2px 12px; width: 100%; min-width: 0; }
.vw-model-name { font-size: 14px; font-weight: 600; line-height: 1.5; overflow-wrap: anywhere; color: #a53928; }
.vw-model-price { font-size: 14px; line-height: 1.5; font-weight: 600; color: #c03e31; white-space: nowrap; text-align: right; }
.vw-model-price.is-unset { font-size: 11px; line-height: 21px; font-weight: 400; color: var(--vw-muted); }
.vw-model-tags { grid-column: 1 / -1; display: flex; flex-wrap: wrap; align-items: center; gap: 5px; min-width: 0; }
.vw-model-tag { display: inline-block; padding: 0 6px; border: 1px solid #b5d8c1; background: #f1f8f3; color: #2d6a46; border-radius: 3px; font-size: 11px; line-height: 16px; white-space: nowrap; }
.vw-model-tag[data-kind="frames"] { background: #fff7ed; border-color: #edc88f; color: #945215; }
.vw-model-tag[data-kind="audio"] { background: #f0f7fc; border-color: #b7d4e9; color: #286080; }
.vw-model-tag[data-kind="text"] { background: #f7f8fa; border-color: #d8dde4; color: #5a6574; }
.vw-model-menu {
    position: absolute; z-index: 40; top: calc(100% + 5px); left: 0; right: 0;
    max-height: 420px; overflow-y: auto; overscroll-behavior: contain; scroll-padding: 4px;
    background: #fff; border: 1px solid var(--vw-highlight); border-radius: 6px;
    box-shadow: 0 8px 22px #46321821;
}
.vw-model-menu.is-above { top: auto; bottom: calc(100% + 5px); }
.vw-model-group-heading {
    position: sticky; top: 0; z-index: 1; min-height: 25px; padding: 5px 12px 4px;
    background: #fff8e1; border-block: 1px solid #f0d9a6; color: #8c5b20;
    font-size: 11px; font-weight: 600; line-height: 15px;
}
.vw-model-group-heading:not(:first-child) { border-top-color: #e4e9dc; }
.video-workbench .vw-model-option { border: 0; border-bottom: 1px solid #e4e9dc; border-radius: 0; background: #fff; }
.video-workbench .vw-model-option:last-child { border-bottom: 0; }
.video-workbench .vw-model-option:hover, .video-workbench .vw-model-option.is-highlighted { background: #fff7ed; }
.vw-model-option > .lucide { color: #bd5d10; opacity: 0; }
.vw-model-option[aria-selected="true"] > .lucide { opacity: 1; }
.vw-model-option[aria-selected="true"] { box-shadow: inset 3px 0 #ff9f1c; }
.vw-ref-heading { margin-top: 18px; font-size: 12px; color: #4a5568; }
.vw-references {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: 8px;
    min-height: 112px; padding: 10px 0; align-content: start;
    border-bottom: 1px solid var(--vw-border);
}
.vw-references.is-dragover { outline: 2px dashed var(--vw-accent); outline-offset: 2px; background: #fff7ed; }
.vw-reference { position: relative; min-width: 0; aspect-ratio: 1 / 1; overflow: hidden; border-radius: 5px; background: #fffdf5; }
.vw-reference img { width: 100%; height: 100%; object-fit: contain; }
.vw-reference-label { position: absolute; left: 4px; top: 4px; font-size: 10px; background: #fffffff0; color: var(--vw-text); padding: 2px 5px; border-radius: 3px; }
.vw-reference-actions { position: absolute; display: flex; justify-content: center; gap: 3px; bottom: 4px; left: 0; right: 0; }
.vw-reference-actions button { width: 26px; height: 26px; padding: 3px; min-height: 26px; background: #fffffff0; }
.vw-reference-actions .lucide { width: 13px; height: 13px; flex-basis: 13px; }
.vw-empty { grid-column: 1 / -1; display: grid; place-items: center; height: 88px; color: var(--vw-muted); font-size: 12px; background: #fffdf5; }
.vw-status { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; padding: 14px 0 10px; font-size: 12px; min-height: 43px; }
.vw-state { color: var(--vw-muted); }
.vw-status[data-state="completed"] .vw-state { color: #147a56; }
.vw-status[data-state="failed"] .vw-state, .vw-status[data-state="unknown"] .vw-state,
.vw-status[data-state="interrupted"] .vw-state { color: #ae5437; }
.vw-status progress { height: 6px; flex: 1; min-width: 40px; accent-color: var(--vw-accent); }
.vw-message { margin: 0; flex-basis: 100%; color: #aa4b3d; overflow-wrap: anywhere; line-height: 1.6; }
.vw-card-footer { justify-content: flex-end; min-height: 36px; flex-wrap: wrap; }
.vw-estimate { display: flex; flex-direction: column; gap: 2px; flex: 1 1 120px; min-width: 0; min-height: 40px; margin-right: auto; line-height: 1.5; }
.vw-estimate-total { color: #a53928; font-size: 14px; font-weight: 600; }
.vw-estimate-detail { font-size: 11px; color: var(--vw-muted); overflow-wrap: anywhere; }
.vw-preview { margin-bottom: 12px; width: 100%; aspect-ratio: 16 / 9; background: #202020; border-radius: 5px; overflow: hidden; }
.vw-preview video { width: 100%; height: 100%; object-fit: contain; }
.vw-history { margin-top: 32px; padding-top: 20px; border-top: 1px solid var(--vw-border); min-width: 0; }
.vw-history h3 { font-size: 17px; }
.vw-history .video-tasks-scroll { max-width: 100%; }
.vw-history .video-tasks-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); width: 100%; gap: 16px; }
.vw-history .video-task-card { min-width: 0; width: 100%; }
.vw-history-card { padding: 12px; border: 1px solid var(--vw-border); border-radius: 8px; background: var(--vw-surface); min-width: 280px; width: 300px; }
.vw-history-head { display: flex; flex-direction: column; gap: 5px; padding-bottom: 10px; font-size: 12px; overflow-wrap: anywhere; }
.vw-history-head span { color: var(--vw-muted); font-size: 11px; }
.vw-history-preview { width: 100%; aspect-ratio: 16 / 9; display: grid; place-items: center; background: #fffdf5; overflow: hidden; font-size: 12px; color: var(--vw-muted); }
.vw-history-preview span { padding: 14px; overflow-wrap: anywhere; }
.vw-history-preview video { width: 100%; height: 100%; object-fit: contain; }
.vw-history-meta { font-size: 11px; color: var(--vw-muted); overflow-wrap: anywhere; padding: 8px 0; margin: 0; }
.vw-history-prompt { font-size: 12px; margin-bottom: 12px; }
.vw-history-prompt summary { cursor: pointer; }
.vw-history-prompt p { white-space: pre-wrap; overflow-wrap: anywhere; max-height: 160px; overflow: auto; }
.vw-dialog { border: 1px solid var(--vw-border); border-radius: 8px; padding: 24px; width: 560px; max-width: calc(100% - 28px); max-height: 85vh; color: var(--vw-text); background: var(--vw-surface); }
.vw-dialog::backdrop { background: #00000059; }
.vw-dialog h3 { margin: 0 0 16px; font-size: 19px; }
.vw-dialog p { font-size: 13px; line-height: 1.6; }
.vw-dialog .vw-actions { justify-content: flex-end; }
.vw-summary-row { padding-bottom: 12px; border-bottom: 1px solid var(--vw-border); white-space: pre-wrap; overflow-wrap: anywhere; }
.vw-summary-estimate { display: block; margin-top: 6px; color: #a53928; }
.vw-summary-total { font-weight: 600; }
.vw-dialog .vw-price-note { color: var(--vw-muted); font-size: 12px; }
.video-prompt-insert { border: 0; margin: 0 0 10px; padding: 4px 12px; display: flex; gap: 15px; font-size: 12px; }
.video-prompt-insert legend { font-size: 11px; color: #4a5568; }
.video-prompt-insert label { display: flex; align-items: center; gap: 5px; }
.vw-media-url { display: flex; align-items: center; gap: 8px; margin-top: 10px; min-width: 0; }
.vw-media-url input { flex: 1; }
.vw-audio { margin-top: 12px; padding-top: 4px; border-top: 1px solid var(--vw-border); min-width: 0; }
.vw-audio-item { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; padding: 12px 0; border-bottom: 1px solid var(--vw-border); }
.vw-audio-name { align-self: center; font-size: 12px; overflow-wrap: anywhere; }
.vw-audio-item audio { grid-column: 1 / -1; width: 100%; min-width: 0; height: 36px; }
.vw-audio-item .vw-actions { flex-wrap: nowrap; gap: 4px; }
.vw-audio-item button { min-height: 28px; width: 28px; padding: 4px; }
@media (min-width: 1700px) { .vw-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 820px) {
    .vw-grid { grid-template-columns: minmax(0, 1fr); }
    .vw-header h2 { font-size: 21px; }
    .vw-card { padding: 14px; }
    .vw-toolbar .vw-actions { gap: 6px; }
}
@media (max-width: 440px) {
    .video-page-active .page-mode-switch { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); width: 100%; max-width: 100%; gap: 4px; padding: 5px; }
    .video-page-active .page-mode-btn { width: 100%; min-width: 0; padding: 9px 4px; font-size: 12px; min-height: 40px; }
    .vw-header { gap: 14px; }
    .vw-toolbar { align-items: flex-start; }
    .vw-toolbar > .vw-actions { width: 100%; justify-content: flex-end; }
    .video-workbench button { padding-inline: 8px; font-size: 12px; }
    .video-workbench .vw-model-trigger, .video-workbench .vw-model-option { padding: 4px 10px; gap: 7px; }
    .vw-model-summary { column-gap: 8px; }
    .vw-model-name { font-size: 13px; }
    .vw-card-head { gap: 6px; }
    .vw-target { font-size: 10px; }
    .vw-references { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .vw-reference-actions { gap: 1px; }
    .vw-reference-actions button { width: 22px; min-height: 24px; height: 24px; }
    .video-page-active #historyCard .card-header { flex-direction: column; align-items: stretch; gap: 12px; }
    .video-page-active #historyCard h3 { display: block; font-size: 12px; line-height: 1.7; }
    .video-page-active #historyCard .icon-box { display: none; }
    .video-page-active #historyCard .history-count-badge { white-space: nowrap; }
}
