:root {
  --bg: #f5f6fb; --surface: #fff; --surface-muted: #f1f2f7; --text: #202131; --muted: #7b7f93;
  --line: #e5e6ee; --brand: #6555d8; --brand-dark: #4e3bb7; --accent: #f3b94b;
  --success: #2f9e68; --danger: #d85757; --shadow: 0 12px 32px rgba(35, 31, 66, .08);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif; color: var(--text); background: var(--bg);
}
* { box-sizing: border-box; }
html, body, #app { height: 100%; min-height: 0; }
body { margin: 0; overflow: hidden; background: radial-gradient(circle at 20% -10%, #eeeaff 0, transparent 32%), var(--bg); }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
a { color: inherit; text-decoration: none; }
button:disabled, input:disabled, textarea:disabled, select:disabled { cursor: not-allowed; opacity: .55; }
.login-page { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login-card { width: min(440px, 100%); background: rgba(255,255,255,.92); border: 1px solid var(--line); border-radius: 24px; padding: 34px; box-shadow: var(--shadow); }
.brand-mark { display: inline-flex; width: 44px; height: 44px; align-items: center; justify-content: center; border-radius: 14px; background: linear-gradient(135deg, var(--brand), #9f8dff); color: #fff; font-weight: 800; letter-spacing: -2px; }
.brand-title { font-size: 24px; font-weight: 800; margin: 16px 0 6px; }
.brand-subtitle { color: var(--muted); font-size: 14px; line-height: 1.7; }
.shell { display: grid; grid-template-columns: 246px minmax(0, 1fr); height: 100dvh; min-height: 0; overflow: hidden; }
.shell.sidebar-collapsed { grid-template-columns: 76px minmax(0, 1fr); }
.sidebar { min-height: 0; overflow-y: auto; overflow-x: hidden; padding: 22px 14px; background: rgba(255,255,255,.78); border-right: 1px solid var(--line); }
.sidebar-brand { display: flex; gap: 10px; align-items: center; padding: 0 8px 22px; }
.sidebar-brand .brand-mark { width: 36px; height: 36px; border-radius: 11px; font-size: 14px; flex-shrink: 0; }
.sidebar-brand strong { font-size: 16px; white-space: nowrap; }
.sidebar-brand small { display: block; color: var(--muted); margin-top: 2px; font-size: 11px; }
.collapse-button, .topbar-icon { border: 1px solid var(--line); color: var(--muted); background: var(--surface); border-radius: 9px; min-width: 28px; height: 28px; line-height: 1; }
.collapse-button:hover, .topbar-icon:hover { color: var(--brand-dark); border-color: #cfc8ff; }
.sidebar-brand .collapse-button { margin-left: auto; }
.nav-section { color: #a0a2b1; font-size: 11px; letter-spacing: .08em; padding: 10px 12px 6px; }
.nav-link { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 12px; color: #64677b; font-size: 14px; margin: 3px 0; }
.nav-link:hover, .nav-link.active { background: #eeebff; color: var(--brand-dark); font-weight: 700; }
.nav-icon { width: 20px; text-align: center; opacity: .85; flex-shrink: 0; }
.sidebar-footer { margin: 22px 8px 0; padding-top: 16px; border-top: 1px solid var(--line); font-size: 12px; color: var(--muted); }
.sidebar-collapsed .brand-copy, .sidebar-collapsed .nav-label, .sidebar-collapsed .sidebar-footer { display: none; }
.sidebar-collapsed .sidebar-brand { justify-content: center; padding-left: 0; padding-right: 0; }
.sidebar-collapsed .sidebar-brand .collapse-button { position: absolute; left: 51px; }
.sidebar-collapsed .nav-link { justify-content: center; padding: 12px 8px; }
.sidebar-collapsed .nav-icon { width: auto; font-size: 17px; }
.main { min-width: 0; min-height: 0; height: 100%; display: grid; grid-template-rows: 70px minmax(0, 1fr); overflow: hidden; }
.topbar { height: 70px; min-height: 0; padding: 0 30px; display: flex; justify-content: space-between; align-items: center; background: rgba(255,255,255,.72); border-bottom: 1px solid var(--line); backdrop-filter: blur(12px); position: relative; z-index: 10; }
.topbar-left, .topbar-right, .project-picker, .user-menu-trigger { display: flex; align-items: center; }
.topbar-left { gap: 12px; }
.topbar-title { font-weight: 800; font-size: 18px; }
.topbar-right { gap: 16px; }
.global-search { position: relative; width: min(360px, 32vw); }
.global-search-input-wrap { display: flex; align-items: center; gap: 5px; padding: 3px 4px 3px 10px; background: #fff; border: 1px solid var(--line); border-radius: 11px; }
.global-search-input-wrap > span { color: var(--muted); font-size: 18px; line-height: 1; }
.global-search-input-wrap input { min-width: 0; padding: 6px 5px; border: 0; box-shadow: none; font-size: 12px; background: transparent; }
.global-search-input-wrap input:focus { box-shadow: none; }
.global-search-input-wrap button { padding: 6px 9px; color: var(--brand-dark); background: #f0edff; border: 0; border-radius: 7px; font-size: 11px; }
.global-search-results { position: absolute; z-index: 30; top: calc(100% + 7px); right: 0; width: min(420px, 70vw); max-height: 470px; overflow: auto; padding: 7px; background: #fff; border: 1px solid var(--line); border-radius: 13px; box-shadow: var(--shadow); }
.global-search-result { display: block; width: 100%; padding: 10px; text-align: left; background: transparent; border: 0; border-radius: 9px; }
.global-search-result:hover { background: #f4f2ff; }
.global-search-result-title, .global-search-result-meta { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.global-search-result-title strong { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; }
.global-search-result-meta { justify-content: flex-start; margin-top: 4px; color: var(--muted); font-size: 10px; }
.global-search-result p { margin: 6px 0 0; color: #66697b; font-size: 11px; line-height: 1.45; white-space: normal; }
.global-search-result mark { padding: 0 2px; color: var(--brand-dark); background: #fff0ae; border-radius: 3px; }
.global-search-empty { padding: 18px 12px; color: var(--muted); font-size: 12px; text-align: center; }
.project-picker { gap: 8px; color: var(--muted); font-size: 12px; }
.project-picker select { color: var(--text); font-weight: 700; }
.project-switch { min-width: 132px; }
.user-menu { position: relative; }
.user-menu-trigger { gap: 7px; border: 0; background: transparent; color: var(--text); padding: 4px 2px; font-weight: 700; }
.avatar { width: 28px; height: 28px; display: inline-flex; align-items: center; justify-content: center; background: #eeebff; color: var(--brand-dark); border-radius: 50%; font-size: 13px; }
.chevron { color: var(--muted); }
.user-menu-panel { position: absolute; right: 0; top: 40px; display: none; min-width: 150px; padding: 8px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); }
.user-menu.open .user-menu-panel { display: grid; gap: 4px; }
.user-menu-role { padding: 7px 9px; color: var(--muted); font-size: 12px; border-bottom: 1px solid var(--line); }
.user-menu-panel button { border: 0; padding: 8px 9px; text-align: left; background: transparent; color: var(--danger); border-radius: 8px; }
.user-menu-panel button:hover { background: #fff1f1; }
.content { min-height: 0; height: 100%; overflow: auto; padding: 24px 30px 44px; max-width: 1800px; margin: 0 auto; }
.page-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; margin-bottom: 18px; }
.page-heading h1 { margin: 0 0 5px; font-size: 26px; letter-spacing: -.03em; }
.page-heading p { margin: 0; color: var(--muted); font-size: 14px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; box-shadow: 0 6px 20px rgba(50, 45, 90, .04); }
.card-pad { padding: 20px; }
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.field { display: grid; gap: 6px; }
.field.full { grid-column: 1 / -1; }
label { color: #5d6072; font-size: 12px; font-weight: 700; }
input, select, textarea { width: 100%; padding: 10px 11px; color: var(--text); background: #fff; border: 1px solid #dfe1ea; border-radius: 10px; outline: none; }
input:focus, select:focus, textarea:focus { border-color: #9b90ef; box-shadow: 0 0 0 3px #eeebff; }
textarea { resize: vertical; min-height: 80px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 5px; padding: 9px 13px; color: #5b5e72; background: #fff; border: 1px solid #dfe1ea; border-radius: 10px; font-size: 13px; }
.btn:hover { border-color: #bdb6f4; color: var(--brand-dark); }
.btn-primary { color: #fff; background: var(--brand); border-color: var(--brand); }
.btn-primary:hover { color: #fff; background: var(--brand-dark); }
.btn-quiet { padding: 7px 9px; background: transparent; border-color: transparent; }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.check { display: inline-flex; align-items: center; gap: 7px; color: var(--muted); font-size: 12px; font-weight: 500; }
.check input { width: auto; }
.badge { display: inline-flex; align-items: center; width: fit-content; padding: 3px 7px; border-radius: 999px; color: #6a6d7e; background: #f0f1f7; font-size: 11px; white-space: nowrap; }
.badge-success { color: #287b54; background: #e7f7ee; }
.badge-danger { color: #a43d3d; background: #fff0f0; }
.badge-warn { color: #8c6414; background: #fff4d9; }
.tag { display: inline-flex; margin: 4px 4px 0 0; padding: 2px 6px; color: #6255b6; background: #f1efff; border-radius: 5px; font-size: 11px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.section-title { margin: 0 0 14px; font-size: 16px; }
.table-wrap { overflow: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { padding: 12px 10px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--line); }
th { color: var(--muted); font-size: 11px; font-weight: 700; }
.wrap { max-width: 430px; white-space: normal; word-break: break-word; }
.notice { padding: 11px 13px; border-radius: 11px; font-size: 12px; line-height: 1.6; }
.notice.brand { color: #554a9f; background: #f4f1ff; border: 1px solid #e6e0ff; }
.toast { position: fixed; z-index: 30; right: 24px; bottom: 24px; padding: 12px 15px; color: #fff; background: #292a3a; border-radius: 11px; box-shadow: var(--shadow); font-size: 13px; }

/* 三个工作台：两侧栏收起后，聊天区仍保持可用宽度；输入区永远在聊天区域底部。 */
.workspace-layout { display: grid; grid-template-columns: minmax(220px, 252px) minmax(0, 1fr) 288px; height: min(100%, calc(100dvh - 118px)); min-height: 0; overflow: hidden; }
.workspace-layout.conversations-collapsed { grid-template-columns: 52px minmax(0, 1fr) 288px; }
.workspace-layout.context-collapsed { grid-template-columns: minmax(220px, 252px) minmax(0, 1fr) 54px; }
.workspace-layout.conversations-collapsed.context-collapsed { grid-template-columns: 52px minmax(0, 1fr) 54px; }
.conversation-sidebar { position: relative; padding: 14px; background: #fbfbfd; border-right: 1px solid var(--line); overflow: auto; }
.conversation-sidebar.collapsed { padding: 10px 7px; }
.conversation-sidebar.collapsed > .collapse-button { display: block; margin: 0 auto; }
.collapsed-rail-label { margin-top: 28px; color: var(--muted); writing-mode: vertical-rl; font-size: 12px; text-align: center; }
.conversation-header { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.conversation-header strong { display: block; font-size: 14px; }
.conversation-header small { display: block; max-width: 145px; margin-top: 3px; color: var(--muted); font-size: 11px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conversation-header-actions { display: flex; align-items: center; gap: 4px; }
.conversation-header .btn { padding: 7px 9px; font-size: 12px; }
.conversation-search { margin-bottom: 9px; }
.conversation-search input { padding: 8px 9px; font-size: 12px; }
.conversation-scope { color: var(--muted); font-size: 11px; line-height: 1.5; margin: 0 4px 12px; }
.conversation-item { position: relative; display: flex; align-items: center; gap: 4px; padding: 8px 6px 8px 9px; border-radius: 11px; margin-bottom: 4px; }
.conversation-item:hover, .conversation-item.active { background: #eeebff; }
.conversation-item.archived { opacity: .68; }
.conversation-item-main { min-width: 0; flex: 1; padding: 2px 0; text-align: left; color: inherit; background: transparent; border: 0; }
.conversation-item-main strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.conversation-item-main small { color: var(--muted); font-size: 11px; }
.conversation-menu-trigger { flex: 0 0 26px; height: 26px; border: 0; color: var(--muted); background: transparent; border-radius: 7px; font-size: 18px; line-height: 1; }
.conversation-menu-trigger:hover { color: var(--brand-dark); background: #fff; }
.conversation-menu { position: absolute; z-index: 4; right: 7px; top: 38px; display: none; min-width: 106px; padding: 5px; background: #fff; border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow); }
.conversation-menu.open { display: grid; }
.conversation-menu button { padding: 7px 8px; text-align: left; border: 0; color: #5d6072; background: transparent; border-radius: 7px; font-size: 12px; }
.conversation-menu button:hover { background: #f3f1ff; color: var(--brand-dark); }
.danger-text { color: var(--danger) !important; }
.workspace-chat { min-width: 0; min-height: 0; display: flex; flex-direction: column; overflow: hidden; background: #fff; }
.chat-heading { flex: 0 0 auto; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 17px 21px 14px; border-bottom: 1px solid var(--line); }
.chat-title-row { display: flex; align-items: center; gap: 8px; }
.chat-title-row strong { font-size: 16px; }
.chat-heading small { display: block; margin-top: 4px; color: var(--muted); font-size: 11px; }
.history-toggle { flex-shrink: 0; padding: 7px 9px; border: 1px solid var(--line); border-radius: 9px; }
.chat-messages { flex: 1 1 auto; min-height: 0; overflow-y: auto; overflow-x: hidden; padding: 18px 22px; background: linear-gradient(180deg, #fff 0%, #fcfcfe 100%); }
.message { max-width: min(780px, 86%); margin-bottom: 14px; padding: 12px 14px; border-radius: 14px; line-height: 1.65; font-size: 13px; white-space: pre-wrap; }
.message.user { margin-left: auto; color: #fff; background: linear-gradient(135deg, #6b5bdd, #8376eb); border-bottom-right-radius: 5px; }
.message.assistant { margin-right: auto; background: #f3f3f8; border-bottom-left-radius: 5px; }
.message-actions { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 9px; }
.message-actions button, .text-button { padding: 0; border: 0; color: var(--brand-dark); background: transparent; font-size: 11px; }
.message-actions button:hover, .text-button:hover { text-decoration: underline; }
.message-action-group { display: inline-flex; flex-wrap: wrap; gap: 5px; padding-right: 4px; border-right: 1px solid #d9d8e8; }
.message-actions button.copied { color: var(--success); font-weight: 700; text-decoration: none; }
.chat-compose { flex: 0 0 auto; min-height: 0; max-height: 46%; overflow-y: auto; overflow-x: hidden; padding: 13px 21px 16px; border-top: 1px solid var(--line); background: rgba(255,255,255,.98); }
.chat-compose form#chatForm > textarea { display: block; min-height: 72px; max-height: 130px; }
.compose-tools { display: flex; align-items: flex-end; gap: 12px; margin-top: 9px; }
.material-select { min-width: 0; flex: 1; display: grid; gap: 5px; }
.material-select select, .generator-panel select[multiple] { min-height: 44px; padding: 7px; font-size: 11px; }
.compose-actions { display: grid; justify-items: end; gap: 5px; }
.generator-panel { margin-top: 12px; padding: 11px 12px; border: 1px solid #e4e1fa; border-radius: 12px; background: #f8f7ff; }
.generator-title { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; font-size: 12px; }
.help-text { color: var(--muted); font-size: 11px; }
.generator-panel .form-grid { gap: 8px; }
.generator-panel .field { gap: 4px; }
.generator-panel input, .generator-panel select { padding: 7px 8px; font-size: 12px; }
.generator-panel select[multiple] { min-height: 54px; }
.director-confirmation { margin-bottom: 10px; padding: 11px 12px; border: 1px solid #e4e1fa; border-radius: 12px; background: #fbfaff; }
.confirm-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 7px 14px; color: #66697b; font-size: 11px; }
.confirm-grid .check { color: var(--text); }
.director-confirmation .notice { margin-top: 9px; padding: 7px 9px; font-size: 11px; }
.generating { border-color: #dcd6ff; background: #f8f7ff; }
.generating small { display: block; margin-top: 6px; color: var(--muted); font-size: 11px; }
.image-result-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 10px; margin-top: 12px; }
.image-result-card { overflow: hidden; border: 1px solid #dfddec; border-radius: 12px; background: #fff; }
.image-result-preview { aspect-ratio: 1 / 1; overflow: hidden; background: #f1f0fb; }
.image-result-preview img { display: block; width: 100%; height: 100%; object-fit: cover; }
.image-result-meta { display: grid; gap: 3px; padding: 8px 9px 0; color: var(--muted); font-size: 10px; }
.image-result-meta strong { color: var(--text); font-size: 12px; }
.image-result-actions { display: flex; flex-wrap: wrap; gap: 5px; padding: 8px 9px 10px; }
.image-result-actions button, .image-result-actions .btn { padding: 4px 6px; border: 0; color: var(--brand-dark); background: transparent; font-size: 10px; text-decoration: none; cursor: pointer; }
.image-result-actions button:hover, .image-result-actions .btn:hover { background: #f1efff; border-radius: 5px; }
.image-reference-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 7px; max-height: 190px; overflow: auto; padding: 5px; border: 1px solid #e6e3f1; border-radius: 8px; background: #fff; }
.image-reference-card { position: relative; display: grid; gap: 3px; padding: 5px; color: var(--muted); border: 1px solid #ecebf3; border-radius: 8px; font-size: 10px; cursor: pointer; }
.image-reference-card:has(input:checked) { border-color: var(--brand); background: #f4f1ff; }
.image-reference-card > input { position: absolute; top: 6px; right: 6px; }
.image-reference-card strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); font-size: 10px; }
.image-reference-card small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.image-reference-thumb { aspect-ratio: 1 / 1; display: grid; place-items: center; overflow: hidden; border-radius: 6px; color: #7569b4; background: #f2f0fb; }
.image-reference-thumb img { width: 100%; height: 100%; object-fit: cover; }
.image-reference-card select { width: 100%; padding: 3px; font-size: 10px; }
.image-submit-note { margin: 8px 0; color: var(--muted); font-size: 10px; }
.context-panel { min-width: 0; background: #fbfbfd; border-left: 1px solid var(--line); overflow: hidden; }
.context-panel.collapsed { width: 54px; }
.context-heading { display: flex; align-items: center; justify-content: space-between; min-height: 59px; padding: 12px 13px; border-bottom: 1px solid var(--line); }
.context-heading strong { display: block; font-size: 14px; }
.context-heading small { display: block; margin-top: 3px; color: var(--muted); font-size: 10px; }
.context-panel.collapsed .context-heading { justify-content: center; padding: 10px 7px; }
.context-panel.collapsed .context-heading strong { writing-mode: vertical-rl; }
.context-body { height: calc(100% - 59px); overflow: auto; padding: 13px; }
.context-overview { margin-bottom: 9px; padding: 10px; background: #fff; border: 1px solid #ececf3; border-radius: 11px; }
.context-overview p { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; overflow: hidden; margin: 0 0 8px; color: #686b7b; font-size: 11px; line-height: 1.5; }
.context-meta { display: grid; gap: 4px; color: var(--muted); font-size: 10px; line-height: 1.35; }
.context-card { margin: 7px 0; background: #fff; border: 1px solid #ececf3; border-radius: 10px; }
.context-card > summary { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px; color: #55586b; cursor: pointer; list-style: none; font-size: 11px; font-weight: 800; }
.context-card > summary::-webkit-details-marker { display: none; }
.context-card > summary::after { content: "＋"; color: var(--muted); font-size: 13px; }
.context-card[open] > summary::after { content: "−"; }
.context-card > summary span { margin-left: auto; color: var(--muted); font-size: 10px; font-weight: 400; }
.context-card-body { padding: 0 10px 10px; border-top: 1px solid #f0f0f5; }
.context-recent { display: grid; gap: 8px; margin: 9px 0; }
.context-recent small, .context-asset small { display: block; color: var(--muted); font-size: 10px; }
.context-recent p { max-height: 3.2em; overflow: hidden; margin: 3px 0 0; color: #686b7b; font-size: 11px; line-height: 1.55; white-space: pre-wrap; }
.context-edit-row { margin-top: 8px; }
.context-note { margin-top: 8px; line-height: 1.5; }
.context-assets { display: grid; gap: 7px; padding-top: 8px; }
.context-asset { display: flex; align-items: center; gap: 8px; min-width: 0; }
.context-asset strong { display: block; max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11px; }
.context-asset-thumb { width: 36px; height: 36px; display: flex; align-items: center; justify-content: center; overflow: hidden; flex: 0 0 36px; color: #766bb9; background: #f1f0fb; border-radius: 7px; font-size: 9px; text-align: center; }
.context-asset-thumb img { width: 100%; height: 100%; object-fit: cover; }
.context-section { padding-bottom: 14px; margin-bottom: 14px; border-bottom: 1px solid var(--line); }
.context-section:last-child { border-bottom: 0; }
.context-label { margin-bottom: 8px; color: #55586b; font-size: 12px; font-weight: 800; }
.context-label span { display: block; margin-top: 3px; color: var(--muted); font-size: 10px; font-weight: 400; }
.summary-preview { margin: 0 0 7px; color: #66697b; font-size: 12px; line-height: 1.55; }
.summary-editor { display: grid; gap: 7px; margin-top: 8px; }
.summary-editor textarea { min-height: 66px; font-size: 12px; }
.context-chip { margin: 5px 0; padding: 7px 8px; color: #686b7b; background: #fff; border: 1px solid #e9e9f0; border-radius: 8px; font-size: 11px; line-height: 1.5; }
.context-chip.fixed { color: #5d4da7; background: #f2efff; border-color: #e5dfff; }
.inline-add { display: flex; gap: 5px; margin-top: 8px; }
.inline-add input { min-width: 0; padding: 7px 8px; font-size: 11px; }
.inline-add .btn { padding: 6px 8px; font-size: 11px; }
.asset-line { display: flex; justify-content: space-between; gap: 8px; padding: 5px 0; font-size: 11px; border-bottom: 1px dashed #e7e7ee; }
.asset-line span { color: var(--muted); }

/* AI视频结果与参数 */
.video-generator-panel { margin-top: 12px; padding: 12px; background: #fbfaff; border: 1px solid #e8e4fb; border-radius: 13px; }
.video-workbench-header, .video-prompt-heading, .video-reference-heading, .video-prompt-footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.video-workbench-header { margin-bottom: 12px; padding-bottom: 10px; border-bottom: 1px solid #ece9f8; }
.video-workbench-header small, .video-prompt-heading small, .video-reference-heading small { display: block; margin-top: 3px; color: var(--muted); font-size: 10px; line-height: 1.45; }
.mode-pill { padding: 5px 9px; border-radius: 999px; color: #51439a; background: #eeeaff; font-size: 10px; font-weight: 800; }
.mode-pill.live { color: #9c5b2e; background: #fff0dc; }
.video-prompt-card, .video-reference-card { padding: 12px; border: 1px solid #e4e0f7; border-radius: 12px; background: #fff; }
.video-prompt-card textarea { width: 100%; min-height: 132px; margin-top: 10px; padding: 12px; resize: vertical; border: 1px solid #ddd8f2; border-radius: 10px; background: #fcfbff; line-height: 1.6; }
.prompt-tools { display: flex; gap: 9px; }
.video-prompt-footer { margin-top: 8px; color: var(--muted); font-size: 10px; }
.video-prompt-footer select { padding: 6px 8px; font-size: 10px; }
.video-reference-card { margin-top: 10px; }
.video-dropzone { display: grid; justify-items: center; gap: 4px; margin-top: 10px; padding: 18px 12px; border: 1px dashed #beb5ee; border-radius: 10px; color: #6554b5; background: #faf9ff; text-align: center; cursor: pointer; }
.video-dropzone input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.video-dropzone.dragging, .video-dropzone.has-file { border-color: #7664db; background: #f0edff; }
.video-dropzone.invalid { border-color: #b65363; background: #fff3f4; }
.dropzone-icon { display: grid; width: 30px; height: 30px; place-items: center; border-radius: 50%; color: #fff; background: #7867d2; font-size: 22px; }
.video-reference-file-info { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-top: 8px; padding: 8px 10px; border-radius: 8px; background: #f3f1fc; color: var(--muted); font-size: 10px; }
.video-reference-file-info strong { color: var(--text); }
.file-kind { color: #5c4daf; font-weight: 800; }
.video-reference-library { margin-top: 12px; }
.video-reference-library > summary { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 8px; color: #5b4da4; border: 1px solid #e6e3f1; border-radius: 8px; background: #fff; cursor: pointer; font-size: 10px; list-style: none; }
.video-reference-library > summary::-webkit-details-marker { display: none; }
.video-reference-library > summary::after { content: "＋"; color: var(--muted); font-size: 12px; }
.video-reference-library[open] > summary::after { content: "−"; }
.video-reference-library > summary span { color: var(--muted); }
.video-parameter-bar { display: flex; align-items: end; flex-wrap: wrap; gap: 8px; margin-top: 12px; padding: 10px; border: 1px solid #e4e0f7; border-radius: 11px; background: #f8f7ff; }
.video-parameter-bar label { display: grid; min-width: 92px; gap: 4px; color: var(--muted); font-size: 10px; }
.video-parameter-bar label > span { font-weight: 700; }
.video-parameter-bar select, .video-parameter-bar input { min-height: 31px; padding: 6px 7px; font-size: 11px; }
.video-parameter-bar .audio-toggle { display: flex; min-width: auto; align-items: center; align-self: center; gap: 5px; padding: 0 5px; }
.video-parameter-bar .audio-toggle input { min-height: auto; }
.video-cost { display: grid; min-width: 145px; gap: 2px; margin-left: auto; color: var(--muted); font-size: 10px; }
.video-cost strong { color: #53439c; font-size: 11px; }
.video-cost small { font-size: 9px; }
.video-generate-button { min-height: 36px; padding: 0 16px; }
.video-prompt-editor { display: grid; gap: 6px; margin: 10px 0; }
.video-prompt-editor textarea { min-height: 92px; resize: vertical; }
.video-parameter-details { margin: 10px 0; border-top: 1px solid #ece9f8; border-bottom: 1px solid #ece9f8; }
.video-parameter-details > summary { padding: 9px 0; color: #5b4da4; cursor: pointer; font-size: 12px; font-weight: 800; list-style: none; }
.video-parameter-details > summary::-webkit-details-marker { display: none; }
.video-parameter-details > summary::after { content: "＋"; float: right; color: var(--muted); }
.video-parameter-details[open] > summary::after { content: "−"; }
.video-reference-grid { max-height: 230px; overflow: auto; }
.video-submit-note { margin: 10px 0; color: var(--muted); font-size: 11px; line-height: 1.5; }

/* AI视频固定工作台：只有消息区滚动，创作区不参与页面高度计算。 */
@media (min-width: 901px) {
  .content:has(.workspace-layout) { display: flex; min-height: 0; overflow: hidden; padding: 16px 30px 18px; }
  .content:has(.workspace-layout) > .workspace-layout { width: 100%; flex: 1 1 auto; min-height: 0; }
  .video-workspace { height: 100%; max-height: 100%; min-height: 0; }
  .video-conversation { min-height: 0; overflow: hidden; }
  .video-messages { flex: 1 1 auto; min-height: 0; overflow-y: auto; overflow-x: hidden; }
  .video-composer { flex: 0 0 min(600px, calc(100% - 114px)); height: min(600px, calc(100% - 114px)); max-height: none; min-height: 0; overflow: hidden; padding: 8px 16px 10px; }
  .video-composer #chatForm > textarea { height: 48px; min-height: 48px; max-height: 64px; overflow-y: auto; }
  .video-composer .compose-tools { align-items: center; gap: 8px; margin-top: 5px; }
  .video-composer .material-select { gap: 3px; }
  .video-composer .material-select select { height: 32px; min-height: 32px; padding: 4px 6px; }
  .video-composer .compose-actions { gap: 2px; }
  .video-composer .compose-actions .btn { padding: 6px 10px; }
  .video-composer .video-generator-panel { margin-top: 7px; padding: 7px 8px; }
  .video-composer .video-workbench-header { min-height: 26px; margin-bottom: 4px; padding-bottom: 4px; }
  .video-composer .video-workbench-header > div,
  .video-composer .video-prompt-heading > div,
  .video-composer .video-reference-heading > div { min-width: 0; flex: 1 1 auto; }
  .video-composer .video-workbench-header small,
  .video-composer .video-prompt-heading small,
  .video-composer .video-reference-heading small { display: none; }
  .video-composer .video-prompt-card,
  .video-composer .video-reference-card { padding: 7px; }
  .video-composer .video-prompt-card textarea { height: 86px; min-height: 76px; max-height: 104px; margin-top: 6px; padding: 8px; overflow-y: auto; }
  .video-composer .video-prompt-heading,
  .video-composer .video-reference-heading { min-height: 30px; }
  .video-composer .video-prompt-footer { margin-top: 5px; }
  .video-composer .video-prompt-footer select { padding: 4px 6px; }
  .video-composer .video-reference-card { margin-top: 7px; }
  .video-composer .video-dropzone { display: flex; align-items: center; justify-content: center; gap: 7px; height: 36px; margin-top: 5px; padding: 4px 10px; }
  .video-composer .video-dropzone .dropzone-icon { width: 24px; height: 24px; font-size: 17px; }
  .video-composer .video-dropzone small { white-space: nowrap; }
  .video-composer .video-reference-library { display: block; height: auto; margin-top: 6px; }
  .video-composer .video-reference-library > summary { height: 28px; padding: 4px 7px; }
  .video-composer .video-reference-grid { min-width: 0; max-height: 92px; grid-template-columns: repeat(auto-fill, minmax(108px, 1fr)); gap: 4px; padding: 3px; }
  .video-composer .video-reference-grid .image-reference-card { min-height: 24px; padding: 3px; }
  .video-composer .video-reference-grid .image-reference-card > strong,
  .video-composer .video-reference-grid .image-reference-card > small,
  .video-composer .video-reference-grid .image-reference-card > select,
  .video-composer .video-reference-grid .image-reference-thumb { display: none; }
  .video-composer .video-reference-grid .image-reference-card::after { content: "选择素材"; display: block; padding: 3px; color: var(--brand-dark); font-size: 10px; text-align: center; }
  .video-composer .video-parameter-bar { flex-wrap: nowrap; gap: 5px; margin-top: 6px; padding: 4px 6px; overflow-x: auto; }
  .video-composer .video-parameter-bar label { min-width: 70px; gap: 2px; }
  .video-composer .video-parameter-bar select,
  .video-composer .video-parameter-bar input { min-height: 26px; height: 26px; padding: 3px 5px; font-size: 10px; }
  .video-composer .video-parameter-bar .audio-toggle { min-width: 52px; padding: 0 2px; }
  .video-composer .video-cost { min-width: 112px; margin-left: auto; }
  .video-composer .video-cost { grid-template-rows: repeat(3, 10px); height: 30px; overflow: hidden; white-space: nowrap; }
  .video-composer .video-cost strong,
  .video-composer .video-cost small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .video-composer .video-cost strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .video-composer .video-generate-button { flex: 0 0 auto; min-height: 30px; height: 30px; padding: 0 11px; white-space: nowrap; }
  .video-composer .video-submit-note { margin: 6px 0 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .video-composer #chatForm > textarea { height: 40px; min-height: 40px; max-height: 52px; }
  .video-composer .material-select label { font-size: 10px; }
  .video-composer .compose-actions .small { display: none; }
}

@media (min-width: 901px) and (max-height: 780px) {
  .video-composer { flex-basis: calc(100% - 114px); height: calc(100% - 114px); }
  .video-composer .video-workbench-header { min-height: 26px; margin-bottom: 4px; padding-bottom: 4px; }
  .video-composer .video-workbench-header small,
  .video-composer .video-prompt-heading small,
  .video-composer .video-reference-heading small { display: none; }
  .video-composer .video-prompt-heading,
  .video-composer .video-reference-heading { min-height: 24px; }
  .video-composer .video-prompt-card textarea { height: 80px; min-height: 68px; max-height: 92px; }
  .video-composer .video-prompt-footer { display: none; }
  .video-composer .video-reference-card { margin-top: 5px; }
  .video-composer .video-dropzone { height: 40px; margin-top: 4px; }
  .video-composer .video-reference-library { height: auto; margin-top: 4px; }
  .video-composer .video-reference-library > summary { height: 24px; }
  .video-composer .video-reference-grid { max-height: 72px; }
  .video-composer .video-parameter-bar { margin-top: 1px; }
  .video-composer .video-submit-note { display: none; }
  .video-composer #chatForm > textarea { height: 42px; min-height: 42px; }
  .video-composer .compose-tools { margin-top: 4px; }
  .video-composer .material-select select { height: 28px; min-height: 28px; }
}

@media (min-width: 901px) and (max-width: 1500px) {
  .video-composer .video-parameter-bar { gap: 2px; padding: 3px; }
  .video-composer .video-parameter-bar > label { min-width: 0; flex: 0 0 46px; }
  .video-composer .video-parameter-bar > label:first-child { flex-basis: 62px; }
  .video-composer .video-parameter-bar > label:nth-child(2) { flex-basis: 42px; }
  .video-composer .video-parameter-bar > label:nth-child(3) { flex-basis: 52px; }
  .video-composer .video-parameter-bar > label:nth-child(4) { flex-basis: 44px; }
  .video-composer .video-parameter-bar > label:nth-child(5) { flex-basis: 42px; }
  .video-composer .video-parameter-bar .audio-toggle { flex-basis: 40px; min-width: 40px; }
  .video-composer .video-cost { flex-basis: 72px; min-width: 72px; font-size: 9px; }
  .video-composer .video-cost strong { font-size: 9px; }
  .video-composer .video-generate-button { flex-basis: 70px; padding: 0 6px; font-size: 10px; }
  .video-composer .video-parameter-bar select,
  .video-composer .video-parameter-bar input { width: 100%; }
}
.video-result-grid { display: grid; grid-template-columns: minmax(240px, 1fr); gap: 12px; margin-top: 12px; }
.video-result-card { overflow: hidden; max-width: 560px; border: 1px solid #e5e2f2; border-radius: 13px; background: #fff; }
.video-result-preview { position: relative; min-height: 180px; background: #211f35; }
.video-result-preview video { display: block; width: 100%; max-height: 420px; background: #161522; }
.video-result-cover { position: absolute; left: 9px; bottom: 9px; padding: 4px 7px; color: #fff; border-radius: 5px; background: rgba(20, 18, 35, .68); font-size: 10px; pointer-events: none; }
.video-result-meta { display: grid; gap: 4px; padding: 10px 11px 0; color: var(--muted); font-size: 11px; }
.video-result-meta strong { color: var(--text); font-size: 12px; }
.video-result-meta .badge { width: max-content; }
.video-result-actions { display: flex; flex-wrap: wrap; gap: 5px; padding: 8px 9px 10px; }
.video-result-actions button, .video-result-actions .btn { padding: 4px 6px; border: 0; color: var(--brand-dark); background: transparent; font-size: 10px; text-decoration: none; cursor: pointer; }
.video-result-actions .danger-text { color: #a54d5a; }
.video-detail-modal { width: min(720px, calc(100vw - 32px)); }
.video-detail-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 14px 0; color: var(--muted); font-size: 11px; }
.video-detail-prompt { padding: 10px; border-radius: 8px; background: #f7f5ff; }
.video-detail-prompt pre { max-height: 300px; margin: 6px 0 0; overflow: auto; white-space: pre-wrap; font: inherit; line-height: 1.5; }

/* 素材库 */
.material-filter-bar { display: flex; flex-wrap: wrap; align-items: end; gap: 9px; margin-bottom: 18px; padding: 12px; background: #fafaff; border: 1px solid #ecebfa; border-radius: 13px; }
.material-filter-bar label { display: grid; gap: 5px; min-width: 120px; }
.material-filter-bar .material-search { flex: 1 1 220px; }
.material-filter-bar input, .material-filter-bar select { padding: 8px 9px; font-size: 12px; }
.materials-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(235px, 1fr)); gap: 14px; }
.material-card { overflow: hidden; border: 1px solid var(--line); border-radius: 14px; background: #fff; }
.material-card-preview { padding: 10px 10px 0; }
.material-thumb, .material-media { height: 132px; display: flex; align-items: center; justify-content: center; overflow: hidden; border-radius: 10px; background: #f1f0fb; }
.material-thumb img, .video-media img, .video-media video { width: 100%; height: 100%; object-fit: cover; }
.placeholder-thumb { color: #766bb9; background: linear-gradient(135deg, #eeeaff, #f8f7ff); font-size: 12px; }
.audio-media { justify-content: flex-start; gap: 10px; padding: 10px; background: #f5f3ff; }
.media-icon { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; color: #fff; background: var(--brand); border-radius: 50%; font-size: 23px; }
.audio-media audio { width: calc(100% - 48px); height: 34px; }
.video-media { position: relative; color: #fff; background: linear-gradient(135deg, #302d4b, #7770a0); }
.video-play { font-size: 30px; text-shadow: 0 2px 8px #111; }
.video-cover-label { position: absolute; right: 8px; bottom: 7px; padding: 3px 6px; border-radius: 5px; background: rgba(0,0,0,.55); font-size: 10px; }
.neutral-media { color: var(--muted); background: #f4f4f7; font-size: 12px; }
.material-card-body { padding: 11px 12px 12px; }
.material-card-title { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.material-card-title strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.material-tags { min-height: 22px; }
.project-tag { display: inline-flex; margin-top: 8px; padding: 4px 7px; color: #514697; background: #f0edff; border-radius: 6px; font-size: 11px; }
.material-meta, .material-license { margin-top: 8px; color: var(--muted); font-size: 11px; line-height: 1.5; }
.material-license { min-height: 17px; color: #686b7b; }
.material-card-actions { display: flex; align-items: center; justify-content: space-between; gap: 6px; margin-top: 10px; }
.material-card-actions .btn { padding: 5px 7px; font-size: 11px; }
.material-form-wrap { margin-top: 16px; }
.material-empty { grid-column: 1 / -1; padding: 40px 0; }

.modal-backdrop { position: fixed; z-index: 20; inset: 0; display: grid; place-items: center; padding: 20px; background: rgba(23, 23, 40, .38); }
.modal-card { width: min(620px, 100%); max-height: 90vh; overflow: auto; padding: 20px; background: var(--surface); border-radius: 16px; box-shadow: var(--shadow); }
.modal-heading { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.modal-heading strong { font-size: 16px; }
.empty { display: grid; place-items: center; min-height: 120px; color: var(--muted); font-size: 13px; text-align: center; }

@media (max-width: 1260px) {
  .workspace-layout, .workspace-layout.conversations-collapsed, .workspace-layout.context-collapsed, .workspace-layout.conversations-collapsed.context-collapsed { grid-template-columns: 220px minmax(0, 1fr) 250px; }
  .workspace-layout.conversations-collapsed { grid-template-columns: 52px minmax(0, 1fr) 250px; }
  .workspace-layout.context-collapsed { grid-template-columns: 220px minmax(0, 1fr) 54px; }
  .workspace-layout.conversations-collapsed.context-collapsed { grid-template-columns: 52px minmax(0, 1fr) 54px; }
  .workspace-chat { min-width: 0; }
}
@media (max-width: 900px) {
  .shell, .shell.sidebar-collapsed { display: block; }
  .sidebar { position: sticky; top: 0; z-index: 12; display: flex; align-items: center; gap: 8px; padding: 8px 12px; overflow: auto; border-right: 0; border-bottom: 1px solid var(--line); }
  .sidebar-brand { padding: 0; }
  .sidebar-brand .collapse-button, .nav-section, .sidebar-footer { display: none; }
  .nav-link { margin: 0; padding: 8px; white-space: nowrap; }
  .nav-label, .brand-copy { display: none; }
  .topbar { padding: 0 16px; }
  .global-search { width: min(300px, 42vw); }
  .global-search-input-wrap button { display: none; }
  .content { padding: 18px 16px 30px; }
  .workspace-layout, .workspace-layout.conversations-collapsed, .workspace-layout.context-collapsed, .workspace-layout.conversations-collapsed.context-collapsed { display: block; height: auto; min-height: 0; overflow: visible; }
  .conversation-sidebar, .conversation-sidebar.collapsed { max-height: 220px; border-right: 0; border-bottom: 1px solid var(--line); }
  .conversation-sidebar.collapsed { max-height: 48px; }
  .workspace-chat { min-height: 720px; }
  .context-panel, .context-panel.collapsed { width: auto; border-left: 0; border-top: 1px solid var(--line); }
  .context-panel.collapsed .context-heading { justify-content: space-between; }
  .context-panel.collapsed .context-heading strong { writing-mode: horizontal-tb; }
  .context-panel.collapsed .context-heading::before { content: "上下文"; color: var(--text); font-size: 14px; font-weight: 800; }
  .context-panel.collapsed .context-heading strong { display: none; }
  .form-grid, .grid-2 { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
  .topbar-right { gap: 7px; }
  .global-search { width: 42vw; }
  .global-search-input-wrap { padding-left: 6px; }
  .global-search-input-wrap > span { display: none; }
  .project-picker > span, .user-menu-trigger > span:not(.avatar):not(.chevron) { display: none; }
  .project-switch { min-width: 104px; }
  .page-heading { display: block; }
  .page-heading .btn, .page-heading .badge { margin-top: 12px; }
  .chat-heading { display: block; }
  .history-toggle { margin-top: 10px; }
  .video-parameter-bar { align-items: stretch; }
  .video-cost { margin-left: 0; }
  .video-detail-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .compose-tools { display: grid; align-items: stretch; }
  .compose-actions { display: flex; justify-content: space-between; align-items: center; }
  .materials-grid { grid-template-columns: 1fr; }
  .confirm-grid { grid-template-columns: 1fr; }
}

/* 2C 布局优化：恢复创作区自然高度，由中间工作台承担垂直滚动。 */
@media (min-width: 901px) {
  .content:has(.video-workspace) {
    display: block;
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
    scrollbar-gutter: stable;
    padding: 16px 30px 30px;
  }

  .content:has(.video-workspace) > .video-workspace {
    height: auto;
    min-height: calc(100dvh - 118px);
    max-height: none;
    overflow: hidden;
    contain: layout paint;
  }

  .video-workspace .video-conversation {
    height: calc(100dvh - 118px);
    min-height: calc(100dvh - 118px);
    max-height: calc(100dvh - 118px);
    overflow-x: hidden;
    overflow-y: auto;
    scrollbar-gutter: stable;
  }

  .video-workspace .video-messages {
    flex: 0 0 auto;
    min-height: 180px;
    overflow: visible;
    padding: 20px 22px;
  }

  .video-workspace .video-composer {
    flex: 0 0 auto;
    height: auto;
    max-height: none;
    min-height: 0;
    overflow: visible;
    padding: 20px 22px 28px;
  }

  .video-workspace .video-composer #chatForm > textarea {
    height: 190px;
    min-height: 160px;
    max-height: 260px;
    padding: 14px 16px;
    font-size: 14px;
    line-height: 1.7;
    overflow-y: auto;
  }

  .video-workspace .video-composer .compose-tools {
    align-items: end;
    gap: 12px;
    margin-top: 12px;
  }

  .video-workspace .video-composer .material-select select {
    height: 44px;
    min-height: 44px;
    padding: 8px 10px;
    font-size: 12px;
  }

  .video-workspace .video-composer .compose-actions {
    gap: 6px;
  }

  .video-workspace .video-composer .compose-actions .small {
    display: inline;
  }

  .video-workspace .video-generator-panel {
    margin-top: 18px;
    padding: 20px;
    border-radius: 16px;
  }

  .video-workspace .video-workbench-header {
    min-height: 44px;
    margin-bottom: 16px;
    padding-bottom: 14px;
  }

  .video-workspace .video-workbench-header small,
  .video-workspace .video-prompt-heading small,
  .video-workspace .video-reference-heading small {
    display: block;
    font-size: 11px;
  }

  .video-workspace .video-prompt-card,
  .video-workspace .video-reference-card {
    padding: 18px;
  }

  .video-workspace .video-prompt-card textarea {
    height: 220px;
    min-height: 180px;
    max-height: 320px;
    margin-top: 14px;
    padding: 14px 16px;
    font-size: 14px;
    line-height: 1.7;
    overflow-y: auto;
  }

  .video-workspace .video-prompt-footer {
    margin-top: 12px;
    font-size: 11px;
  }

  .video-workspace .video-prompt-footer select {
    min-width: 150px;
    padding: 8px 10px;
    font-size: 11px;
  }

  .video-workspace .video-reference-card {
    min-height: 220px;
    margin-top: 18px;
  }

  .video-workspace .video-reference-heading {
    min-height: 42px;
  }

  .video-workspace .video-dropzone {
    min-height: 128px;
    margin-top: 14px;
    padding: 24px 16px;
    gap: 7px;
  }

  .video-workspace .video-dropzone .dropzone-icon {
    width: 38px;
    height: 38px;
  }

  .video-workspace .video-reference-file-info {
    min-height: 42px;
    margin-top: 12px;
    padding: 10px 12px;
  }

  .video-workspace .video-reference-library {
    margin-top: 14px;
  }

  .video-workspace .video-reference-library > summary {
    min-height: 40px;
    padding: 9px 12px;
    font-size: 12px;
  }

  .video-workspace .video-reference-grid {
    display: flex;
    min-height: 92px;
    max-height: 240px;
    gap: 10px;
    padding: 8px;
    overflow-x: auto;
    overflow-y: hidden;
  }

  .video-workspace .video-reference-grid .image-reference-card {
    flex: 0 0 148px;
    min-height: 90px;
    padding: 7px;
  }

  .video-workspace .video-reference-grid .image-reference-card > strong,
  .video-workspace .video-reference-grid .image-reference-card > small,
  .video-workspace .video-reference-grid .image-reference-card > select,
  .video-workspace .video-reference-grid .image-reference-thumb {
    display: grid;
  }

  .video-workspace .video-reference-grid .image-reference-thumb {
    min-height: 52px;
  }

  .video-workspace .video-parameter-bar {
    display: flex;
    align-items: end;
    flex-wrap: wrap;
    gap: 14px 12px;
    margin-top: 18px;
    padding: 16px;
    overflow: visible;
  }

  .video-workspace .video-parameter-bar > label {
    flex: 1 1 108px;
    min-width: 100px;
    gap: 6px;
    font-size: 11px;
  }

  .video-workspace .video-parameter-bar > label:first-child {
    flex-basis: 140px;
  }

  .video-workspace .video-parameter-bar select,
  .video-workspace .video-parameter-bar input {
    min-height: 38px;
    height: 38px;
    padding: 8px 9px;
    font-size: 12px;
  }

  .video-workspace .video-parameter-bar .audio-toggle {
    flex: 0 0 100px;
    min-width: 100px;
    min-height: 38px;
    padding: 0 5px;
    font-size: 12px;
  }

  .video-workspace .video-cost {
    flex: 1 1 210px;
    min-width: 180px;
    min-height: 48px;
    margin-left: 0;
    font-size: 11px;
    white-space: normal;
  }

  .video-workspace .video-cost strong,
  .video-workspace .video-cost small {
    overflow: visible;
    text-overflow: clip;
    white-space: normal;
  }

  .video-workspace .video-cost strong {
    font-size: 12px;
  }

  .video-workspace .video-generate-button {
    flex: 0 0 140px;
    min-width: 140px;
    min-height: 42px;
    height: 42px;
    padding: 0 18px;
    font-size: 13px;
    white-space: nowrap;
  }

  .video-workspace .video-submit-note {
    margin: 14px 0 0;
    overflow: visible;
    white-space: normal;
    font-size: 11px;
  }
}

@media (min-width: 1501px) {
  .video-workspace .video-parameter-bar {
    display: grid;
    grid-template-columns: minmax(140px, 1.35fr) minmax(100px, .8fr) minmax(110px, .9fr) minmax(100px, .8fr) minmax(90px, .65fr);
  }

  .video-workspace .video-parameter-bar > label,
  .video-workspace .video-parameter-bar > label:first-child {
    min-width: 0;
    flex: none;
  }

  .video-workspace .video-parameter-bar .audio-toggle {
    grid-column: 1;
    min-width: 0;
  }

  .video-workspace .video-parameter-bar .video-cost {
    grid-column: 2 / span 2;
    min-width: 0;
  }

  .video-workspace .video-parameter-bar .video-generate-button {
    grid-column: 4 / span 2;
    width: 100%;
  }
}

@media (min-width: 901px) and (max-width: 1100px) {
  .content:has(.video-workspace) > .video-workspace,
  .content:has(.video-workspace) > .video-workspace.conversations-collapsed,
  .content:has(.video-workspace) > .video-workspace.context-collapsed,
  .content:has(.video-workspace) > .video-workspace.conversations-collapsed.context-collapsed {
    grid-template-columns: 160px minmax(0, 1fr) 180px;
  }

  .content:has(.video-workspace) > .video-workspace.conversations-collapsed {
    grid-template-columns: 52px minmax(0, 1fr) 180px;
  }

  .content:has(.video-workspace) > .video-workspace.context-collapsed {
    grid-template-columns: 160px minmax(0, 1fr) 54px;
  }

  .content:has(.video-workspace) > .video-workspace.conversations-collapsed.context-collapsed {
    grid-template-columns: 52px minmax(0, 1fr) 54px;
  }
}

@media (max-width: 900px) {
  .content:has(.video-workspace) {
    overflow-x: hidden;
    overflow-y: auto;
    scrollbar-gutter: stable;
  }

  .video-workspace,
  .content:has(.video-workspace) > .video-workspace {
    height: auto;
    max-height: none;
    min-height: 0;
    overflow: visible;
  }

  .video-workspace .video-conversation {
    height: auto;
    max-height: none;
    min-height: 0;
    overflow: visible;
  }

  .video-workspace .video-messages {
    flex: 0 0 auto;
    min-height: 180px;
    overflow: visible;
  }

  .video-workspace .video-composer {
    max-height: none;
    overflow: visible;
    padding: 16px;
  }

  .video-workspace .video-composer #chatForm > textarea {
    height: 180px;
    min-height: 150px;
    max-height: 260px;
    overflow-y: auto;
  }

  .video-workspace .video-generator-panel {
    padding: 16px;
  }

  .video-workspace .video-prompt-card textarea {
    height: 200px;
    min-height: 180px;
    max-height: 300px;
    overflow-y: auto;
  }

  .video-workspace .video-reference-card {
    min-height: 210px;
  }

  .video-workspace .video-parameter-bar {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: end;
    overflow: visible;
  }

  .video-workspace .video-parameter-bar > label,
  .video-workspace .video-parameter-bar > label:first-child,
  .video-workspace .video-parameter-bar .audio-toggle,
  .video-workspace .video-cost,
  .video-workspace .video-generate-button {
    min-width: 0;
    width: auto;
    flex: none;
  }

  .video-workspace .video-cost,
  .video-workspace .video-generate-button {
    grid-column: 1 / -1;
  }

  .video-workspace .video-generate-button {
    width: 100%;
  }
}
