/* Shared design system: tokens, GlassPanel, Button, FormControl and functional widgets. */

:root,[data-theme="dark"] {
  color-scheme: dark;
  --page-bg: #191919;
  --text: #e8e6e1;
  --muted: #aaa79f;
  --surface: #242424;
  --surface-soft: #2c2c2b;
  --field-bg: #2c2c2b;
  --solid-surface: #242424;
  --task-bg: #242424;
  --hover-bg: #343432;
  --border: #494845;
  --control-border: #514e47;
  --accent: #d4c39f;
  --accent-hover: #e0d1b0;
  --accent-soft: #363127;
  --accent-text: #d4c39f;
  --success-bg: rgba(94,168,128,.17);
  --success-text: #b2dfc1;
  --error-bg: rgba(204,91,106,.16);
  --error-text: #f2a9b2;
  --pending-bg: rgba(210,167,86,.16);
  --pending-text: #ebd09b;
  --ui-shadow: 0 4px 18px rgba(0,0,0,.08);
  --radius: 10px;
  --glass-blur: 0px;
  --font-sans: Inter,-apple-system,BlinkMacSystemFont,"Segoe UI","Microsoft YaHei",sans-serif;
  --accent-contrast: #28251f;
  --chrome: #141414;
}

[data-theme="light"] {
  color-scheme: light;
  --page-bg: #f6f5f2;
  --text: #302f2b;
  --muted: #77746d;
  --surface: #fffefa;
  --surface-soft: #efede8;
  --field-bg: #efede8;
  --solid-surface: #fffefa;
  --task-bg: #fffefa;
  --hover-bg: #e9e6df;
  --border: #cfc9bd;
  --control-border: #cbc6bb;
  --accent: #76613c;
  --accent-hover: #655132;
  --accent-soft: #e9e2d4;
  --accent-text: #76613c;
  --success-bg: rgba(78,156,112,.12);
  --success-text: #256640;
  --error-bg: rgba(196,77,97,.11);
  --error-text: #a5354a;
  --pending-bg: rgba(169,128,55,.12);
  --pending-text: #846022;
  --ui-shadow: 0 4px 18px rgba(48,47,43,.035);
  --accent-contrast: #fffefa;
  --chrome: #eeece6;
}

html {
  min-height: 100%;
  scrollbar-gutter: stable
}

body {
  margin: 0;
  background: var(--page-bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.55;
  min-height: 100vh
}

h1,h2,h3,h4,p {
  margin-top: 0
}

h2 {
  font-size: 20px;
  line-height: 1.4;
  margin-bottom: 0
}

h3 {
  font-size: 17px;
  line-height: 1.45
}

a {
  color: inherit
}

svg {
  display: block
}

button,input,textarea,select {
  font: inherit;
  color: inherit
}

button,a,input,select,textarea {
  touch-action: manipulation
}

button,.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 38px;
  padding: 8px 14px;
  border: 1px solid var(--control-border);
  border-radius: 9px;
  background: var(--surface-soft);
  color: var(--text);
  text-decoration: none;
  cursor: pointer;
  transition: background .15s,border-color .15s,box-shadow .15s;
  line-height: 1.4
}

button:hover:not(:disabled),.button:hover {
  background: var(--hover-bg);
  border-color: color-mix(in srgb,var(--control-border),var(--text) 20%)
}

button:disabled {
  opacity: .46;
  cursor: not-allowed
}

button svg,[data-icon] svg {
  width: 20px;
  height: 20px;
  flex: none
}

.primary,.send-btn {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-contrast);
  font-weight: 650
}

.primary:hover:not(:disabled),.send-btn:hover:not(:disabled) {
  background: var(--accent-hover);
  border-color: var(--accent-hover)
}

.small {
  min-height: 30px;
  padding: 5px 10px;
  font-size: 12px
}

.icon-button {
  width: 40px;
  height: 40px;
  padding: 9px
}

.danger {
  color: var(--error-text)
}

.success {
  color: var(--success-text)
}

:where(body:not(.admin-page)) :where(input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="file"]),select,textarea) {
  min-width: 0;
  border: 1px solid var(--control-border);
  border-radius: 9px;
  background: var(--field-bg);
  color: var(--text);
  padding: 9px 11px;
  outline: none
}

select {
  max-width: 100%;
  height: 40px;
  padding-right: 26px;
  text-overflow: ellipsis
}

:where(body:not(.admin-page)) select option {
  background: var(--solid-surface);
  color: var(--text)
}

:where(body:not(.admin-page)) :is(input,textarea)::placeholder {
  color: var(--muted);
  opacity: .78
}

textarea {
  resize: vertical;
  line-height: 1.7
}

input[type="checkbox"],input[type="radio"],input[type="range"] {
  accent-color: var(--accent)
}

:where(body:not(.admin-page)) :is(input,textarea,select,[contenteditable="true"]):focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb,var(--accent) 17%,transparent)
}

:is(button,a,[tabindex]):focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px
}

.panel,.glass-panel,.modal-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--ui-shadow);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  min-width: 0
}

.panel {
  position: relative;
  padding: 24px
}

.hidden,[hidden] {
  display: none!important
}

.sr-only,.plaza-sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0
}

.muted {
  color: var(--muted);
  font-size: 12px
}

.eyebrow {
  font-size: 11px;
  letter-spacing: .15em;
  font-weight: 700;
  color: var(--accent-text)
}

* {
  box-sizing: border-box;
  scrollbar-width: thin;
  scrollbar-color: color-mix(in srgb,var(--muted) 40%,transparent) transparent
}

::-webkit-scrollbar {
  width: 6px;
  height: 6px
}

::-webkit-scrollbar-thumb {
  border-radius: 12px;
  background: color-mix(in srgb,var(--muted) 40%,transparent)
}

/* Video workbench. One glass workspace and a separately scrolling queue. */

.grid {
  display: grid;
  grid-template-columns: minmax(0,1.75fr) minmax(360px,1fr);
  gap: 18px;
  min-width: 0;
  min-height: 0
}

.creation-workspace {
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overscroll-behavior: contain;
  min-height: 0;
  padding: 24px
}

.creation-workspace>.panel {
  background: none;
  border: 0;
  box-shadow: none;
  backdrop-filter: none;
  padding: 0;
  overflow: visible;
  flex: none
}

.prompt-panel {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0
}

/* The editor yields height to the controls on shorter desktop screens. */
.creation-workspace>.prompt-panel:not(.prompt-expanded) {
  flex: 1 1 auto
}

@media(min-width:951px) {
  /* Let the shell deduct the actual header and notice heights, including zoom. */
  .app-shell:has(>#workspaceGrid:not(.hidden)) {
    height: 100dvh;
    min-height: 0
  }

  #workspaceGrid {
    flex: 1;
    min-height: 0
  }

  #workspaceGrid>.creation-workspace {
    padding-bottom: 8px
  }

  .creation-workspace>.prompt-panel:not(.prompt-expanded) {
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain
  }

  .creation-workspace>.prompt-panel:not(.prompt-expanded)>.editor {
    height: clamp(160px,calc(100dvh - 740px),240px)
  }
}

.prompt-panel>:not(.editor) {
  flex-shrink: 0
}

.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px
}

.prompt-section-title {
  align-items: flex-start;
  flex-wrap: wrap;
  margin-bottom: 2px
}

.workspace-heading h2 {
  font-size: 23px
}

.workspace-heading p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px
}

.prompt-upload-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 7px;
  min-width: 0;
  margin-left: auto
}

.prompt-upload-actions .small {
  min-height: 34px;
  font-size: 12px;
  padding: 6px 9px
}

.prompt-upload-actions [data-icon] svg {
  width: 16px;
  height: 16px
}

.face-protection-toggle {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 32px;
  padding: 5px 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--muted);
  font-size: 11px;
  cursor: pointer;
  white-space: nowrap
}

.face-protection-toggle input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0
}

.face-protection-switch {
  position: relative;
  width: 27px;
  height: 16px;
  border-radius: 20px;
  background: color-mix(in srgb,var(--muted) 40%,transparent)
}

.face-protection-switch::after {
  content: "";
  position: absolute;
  left: 2px;
  top: 2px;
  width: 12px;
  height: 12px;
  background: #fff;
  border-radius: 50%;
  transition: transform .15s
}

.face-protection-toggle input:checked+.face-protection-switch {
  background: var(--accent)
}

.face-protection-toggle input:checked+.face-protection-switch::after {
  transform: translateX(11px)
}

.face-protection-toggle:focus-within {
  outline: 2px solid var(--accent);
  outline-offset: 2px
}

.image-shelf {
  height: 160px;
  min-height: 160px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px;
  border: 1px dashed var(--control-border);
  border-radius: 12px;
  background: var(--field-bg);
  transition: border-color .15s
}

/* Keep uploaded thumbnails usable; only the empty drop target is compact. */

#dropZone:has(.image-list.empty) {
  height: 104px;
  min-height: 104px
}

.image-shelf.over,.editor.over {
  border-color: var(--accent);
  background: var(--accent-soft)
}

.image-shelf-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
  gap: 8px;
  color: var(--muted)
}

.image-shelf-title {
  min-width: 0
}

.image-shelf-head em {
  font-style: normal;
  white-space: nowrap
}

.image-list {
  display: flex;
  gap: 8px;
  flex: 1;
  min-height: 0;
  overflow-x: auto;
  overflow-y: hidden;
  align-items: stretch
}

.image-list.empty {
  justify-content: center;
  align-items: center;
  cursor: pointer
}

.image-drop-empty {
  display: grid;
  grid-template-columns: auto auto;
  align-items: center;
  gap: 4px;
  text-align: center;
  pointer-events: none
}

.image-drop-empty::before {
  content: "";
  width: 30px;
  height: 30px;
  grid-row: 1/3;
  margin: 0 8px 0 0;
  background: var(--muted);
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.5' stroke-linejoin='round'%3E%3Crect x='3' y='3' width='18' height='18' rx='3'/%3E%3Ccircle cx='8' cy='8' r='1.5'/%3E%3Cpath d='m3 17 5-5 4 4 4-6 5 7'/%3E%3C/svg%3E") center/contain no-repeat
}

.image-drop-empty strong {
  font-size: 13px;
  font-weight: 500
}

.image-drop-empty small {
  font-size: 11px;
  color: var(--muted)
}

.image-card {
  position: relative;
  flex: 0 0 108px;
  width: 108px;
  height: 108px;
  padding: 7px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-soft);
  display: flex;
  flex-direction: column;
  gap: 3px;
  overflow: hidden;
  cursor: grab
}

.image-card img {
  width: 48px;
  height: 48px;
  object-fit: cover;
  border-radius: 7px;
  margin: auto
}

.image-card .name {
  text-align: center;
  font-size: 10px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis
}

.image-card .row {
  display: flex;
  gap: 3px;
  margin-top: auto
}

.image-card .row button {
  min-height: 22px;
  font-size: 10px;
  padding: 2px 4px;
  flex: 1;
  border-radius: 5px
}

.image-card.dragging,.ref-tag.dragging {
  opacity: .45
}

.del {
  position: absolute;
  right: 3px;
  top: 3px;
  width: 20px;
  height: 20px;
  min-height: 20px;
  padding: 0;
  border-radius: 6px;
  z-index: 3;
  background: var(--solid-surface);
  color: var(--error-text)
}

.upload-state {
  position: absolute;
  left: 3px;
  top: 3px;
  padding: 2px 4px;
  z-index: 2;
  border-radius: 5px;
  max-width: calc(100% - 26px);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 9px;
  background: var(--solid-surface);
  color: var(--pending-text)
}

.upload-ok .upload-state {
  color: var(--success-text)
}

.upload-failed .upload-state,.image-error {
  color: var(--error-text)
}

.image-error {
  font-size: 9px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis
}

.reference-media-grid {
  display: grid;
  grid-template-columns: repeat(2,minmax(0,1fr));
  gap: 10px
}

.audio-reference-row {
  min-width: 0;
  min-height: 63px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: var(--field-bg);
  display: flex;
  flex-direction: column;
  gap: 5px
}

.audio-reference-row strong {
  font-size: 12px;
  font-weight: 500
}

.media-upload-zone {
  cursor: pointer;
  transition: border-color .15s, background .15s
}

.media-upload-zone:not([aria-disabled="true"]):hover,
.media-upload-zone.over {
  border-color: var(--accent);
  background: var(--accent-soft)
}

.media-upload-zone:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px
}

.media-upload-zone[aria-disabled="true"] {
  cursor: default
}

.media-upload-zone .audio-reference-item,
.media-upload-zone .image-card {
  cursor: default
}

.audio-reference-row em {
  font-size: 11px;
  color: var(--muted);
  font-style: normal;
  margin-left: 5px
}

.audio-reference-list {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  min-width: 0
}

.media-empty {
  font-size: 11px;
  color: var(--muted)
}

.audio-reference-item {
  display: flex;
  align-items: center;
  gap: 5px;
  flex: 0 0 auto;
  max-width: 350px;
  padding: 4px 6px;
  border-radius: 7px;
  background: var(--surface-soft);
  font-size: 10px
}

.media-reference-name {
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap
}

.audio-reference-item button {
  min-height: 23px;
  height: 23px;
  padding: 2px 5px;
  font-size: 10px;
  border-radius: 5px
}

.audio-del,.video-del {
  color: var(--error-text)
}

.media-upload-status {
  padding: 2px 4px;
  border-radius: 4px;
  white-space: nowrap;
  color: var(--muted)
}

.media-upload-status.uploading {
  color: var(--pending-text)
}

.media-upload-status.ok {
  color: var(--success-text)
}

.media-upload-status.failed {
  color: var(--error-text)
}

.editor-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: -5px
}

.editor-label label {
  font-size: 13px;
  font-weight: 600
}

.editor-label span {
  font-size: 11px;
  color: var(--muted)
}

.prompt-content-actions{display:flex;align-items:center;justify-content:flex-end;gap:8px;flex-wrap:wrap;min-width:0}
.prompt-content-actions button{background:var(--surface-soft);border:1px solid var(--control-border);border-radius:6px;padding:6px 10px;min-height:32px;font-size:12px;font-weight:500;color:var(--text);white-space:nowrap}
.prompt-content-actions button:hover{background:var(--hover-bg);color:var(--text)}
#fixedPromptOpen{background:var(--accent-soft)}
#fixedPromptOpen span{margin-left:5px;padding-left:7px;border-left:1px solid var(--control-border);color:var(--accent-text)}
dialog.fixed-prompt-dialog{width:min(520px,calc(100% - 32px));max-width:none;max-height:calc(100dvh - 32px);overflow:auto;margin:auto;padding:22px;border:1px solid var(--border);border-radius:12px;background:var(--solid-surface);color:var(--text);box-shadow:0 20px 60px rgba(0,0,0,.25)}
.fixed-prompt-dialog::backdrop{background:rgba(0,0,0,.48)}
.fixed-prompt-heading{display:flex;align-items:center;justify-content:space-between;gap:12px}
.fixed-prompt-heading h2{margin:0;font-size:18px}
#fixedPromptIntro{margin:10px 0 16px;color:var(--muted);font-size:12px;line-height:1.7}
.fixed-prompt-preset-select{width:100%;margin-bottom:10px;font-size:13px}
.fixed-prompt-input{display:block;width:100%;min-height:150px;height:180px;max-height:40dvh;resize:vertical;font-size:14px;line-height:1.7}
.fixed-prompt-footer{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-top:16px}
.fixed-prompt-footer span{font-size:11px;color:var(--muted)}
@media(max-width:600px){.editor-label{flex-wrap:wrap}.prompt-content-actions{margin-left:auto;gap:6px}.fixed-prompt-dialog .fixed-prompt-input{font-size:16px}}

.editor {
  height: 200px;
  min-height: 160px;
  max-height: none;
  resize: vertical;
  overflow: auto;
  flex: 1 0 auto;
  width: 100%;
  border: 1px solid var(--control-border);
  border-radius: 11px;
  padding: 13px 14px;
  background: var(--field-bg);
  outline: none;
  line-height: 1.8;
  font-size: 14px;
  white-space: pre-wrap;
  overflow-wrap: anywhere
}

.editor:empty::before {
  content: attr(data-placeholder);
  color: var(--muted);
  opacity: .8;
  pointer-events: none
}

.prompt-character-counter {
  font-size: 11px;
  color: var(--muted);
  text-align: right;
  margin-top: -6px;
  font-variant-numeric: tabular-nums
}

.prompt-character-counter.over-limit {
  color: var(--error-text)
}

.ref-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  max-width: 100%;
  vertical-align: middle;
  border: 1px solid var(--control-border);
  background: var(--surface-soft);
  border-radius: 7px;
  padding: 2px 5px;
  margin: 0 2px;
  cursor: grab;
  user-select: none;
  white-space: normal
}

.ref-tag img {
  width: 24px;
  height: 24px;
  object-fit: cover;
  border-radius: 5px;
  pointer-events: none
}

.ref-tag span {
  font-size: 12px
}

.ref-tag b {
  color: var(--error-text);
  cursor: pointer
}

.video-ref-icon {
  display: inline-grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 5px;
  background: var(--surface-soft);
  color: var(--muted)
}

.mention-popup {
  position: absolute;
  z-index: 100;
  width: 250px;
  max-width: calc(100vw - 44px);
  max-height: 220px;
  overflow: auto;
  padding: 5px;
  background: var(--solid-surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: var(--ui-shadow)
}

.mention-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px;
  border-radius: 6px;
  cursor: pointer
}

.mention-item:hover,.mention-item.active {
  background: var(--hover-bg)
}

.mention-item img {
  width: 36px;
  height: 36px;
  object-fit: cover;
  border-radius: 7px
}







.option-panel {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 8px
}

.option-row {
  display: grid;
  grid-template-columns: repeat(3,minmax(0,1fr));
  gap: 12px
}

.option-row .model-choice-field { grid-column:1/-1; grid-row:1; }

.option-row label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
  font-size: 12px;
  color: var(--muted)
}

.option-row select {
  width: 100%;
  font-size: 13px
}

.send-btn {
  width: 100%;
  height: 46px;
  font-size: 15px;
  border-radius: 10px
}

.status-line {
  font-size: 11px;
  min-height: 18px;
  line-height: 1.6;
  color: var(--muted);
  overflow-wrap: anywhere
}

.task-panel {
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow: hidden;
  min-height: 0
}

.task-section-title {
  gap: 8px;
  flex-wrap: wrap
}

.task-section-title h2 {
  order: -1;
  margin-right: auto;
  font-size: 23px
}

.task-title-actions {
  display: flex;
  gap: 5px;
  flex-wrap: wrap
}

.task-title-actions .small,#selectAllTasksBtn {
  font-size: 11px;
  padding: 5px 8px;
  min-height: 29px
}

.task-retention-note {
  color: var(--muted);
  font-size: 11px;
  margin: -5px 0 2px
}

.task-filters {display:flex;flex-wrap:wrap;gap:7px;flex-shrink:0}
.task-filters button {min-height:30px;padding:5px 12px;border:1px solid var(--border);border-radius:6px;background:transparent;color:var(--muted);font-size:12px;line-height:18px}
.task-filters button:hover {background:var(--surface-soft);color:var(--text)}
.task-filters button[aria-pressed="true"] {background:var(--accent-soft);border-color:var(--accent);color:var(--accent-text)}

.task-list {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  padding: 1px 3px 1px 1px
}

.task-load-more { display:block; margin:12px auto; }
.task-load-more[hidden] { display:none; }

.task-list.empty {
  border: 1px dashed var(--border);
  border-radius: 12px;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 13px;
  min-height: 160px
}

.task-card {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0,1fr) auto;
  gap: 10px;
  flex: none;
  min-width: 0;
  padding: 16px 12px 16px 34px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--task-bg);
  overflow: hidden
}

.task-card::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: color-mix(in srgb,var(--muted) 50%,transparent)
}

.task-selected {
  outline: 2px solid var(--accent);
  outline-offset: -2px
}

.task-left {
  display: flex;
  gap: 9px;
  min-width: 0
}

.task-main {
  min-width: 0;
  flex: 1
}

.task-head {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 5px 7px;
  font-size: 11px;
  line-height: 1.5
}

.task-head strong {
  font-size: 12px
}

.task-time,.task-elapsed {
  font-size: 10px;
  color: var(--muted)
}

.task-prompt {
  margin: 12px 0;
  font-size: 13px;
  line-height: 1.65;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
  white-space: pre-wrap;
  overflow-wrap: anywhere
}

.task-bottom {
  display: flex;
  flex-direction: column;
  gap: 10px
}

.task-info {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 9px;
  font-size: 10px;
  color: var(--muted);
  overflow-wrap: anywhere
}

.task-info span {
  max-width: 100%
}

.task-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 5px
}

.task-actions button {
  font-size: 10px;
  padding: 4px 7px;
  min-height: 27px;
  border-radius: 6px
}

.task-error {
  font-size: 11px;
  color: var(--error-text);
  line-height: 1.65;
  overflow-wrap: anywhere;
  max-height: 96px;
  overflow: auto;
  margin-bottom: 10px
}

.task-error-details {
  margin-bottom:10px;
  font-size:11px;
  line-height:1.65;
  overflow-wrap:anywhere;
}

.task-error-details summary {
  color:var(--error-text);
  cursor:pointer;
}

.task-error-details ul {
  margin:8px 0;
  padding-left:18px;
  white-space:pre-wrap;
}

.task-error-details dl {
  display:grid;
  grid-template-columns:auto minmax(0,1fr);
  gap:4px 10px;
  margin:8px 0;
}

.task-error-details dt, .task-error-details p {
  color:var(--muted);
}

.task-error-details dd {
  margin:0;
  user-select:text;
}

.fan {
  position: relative;
  flex: 0 0 44px;
  width: 44px;
  min-height: 60px
}

.fan:empty {
  display: none
}

.fan > img,.fan > .task-image-placeholder {
  position: absolute;
  top: 8px;
  width: 34px;
  height: 40px;
  object-fit: cover;
  border-radius: 5px;
  border: 1px solid var(--solid-surface)
}

.fan > :nth-child(1) {
  left: 0
}

.fan > :nth-child(2) {
  left: 5px;
  top: 14px
}

.fan > :nth-child(3) {
  left: 10px;
  top: 20px
}

.fan > .task-image-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 3px 1px;
  background: var(--solid-surface);
  border-color: var(--control-border);
  color: var(--muted);
  font-size: 9px;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden
}

.task-image-placeholder svg {
  width: 15px;
  height: 15px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.35;
  stroke-linecap: round;
  stroke-linejoin: round
}

.task-select {
  position: absolute;
  left: 11px;
  top: 18px;
  width: 15px;
  height: 16px;
  cursor: pointer
}

.task-select input {
  position: absolute;
  opacity: 0;
  width: 15px;
  height: 15px;
  margin: 0
}

.task-select span {
  display: block;
  width: 14px;
  height: 14px;
  border: 1px solid var(--control-border);
  border-radius: 4px;
  background: var(--field-bg)
}

.task-select input:checked+span {
  background: var(--accent);
  border-color: var(--accent);
  box-shadow: inset 0 0 0 3px var(--solid-surface)
}

.task-select input:focus-visible+span {
  outline: 2px solid var(--accent);
  outline-offset: 3px
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 6px;
  border-radius: 5px;
  font-size: 10px;
  white-space: nowrap;
  background: var(--success-bg);
  color: var(--success-text)
}

.badge.fail {
  background: var(--error-bg);
  color: var(--error-text)
}

.badge:is(.processing,.pending,.waiting) {
  background: var(--pending-bg);
  color: var(--pending-text)
}

.task-video-area {
  display: flex;
  gap: 10px;
  min-width: 0;
  align-items: stretch
}

.task-video-divider {
  width: 1px;
  background: var(--border)
}

.task-video-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 85px
}

.task-preview-video {
  position: relative;
  width: 80px;
  height: 86px;
  min-height: 0;
  padding: 0;
  background: #17191e;
  overflow: hidden;
  border-radius: 8px
}

.task-cover {
  width: 100%;
  height: 100%;
  object-fit: cover
}
.task-cover:not([src]), .task-cover.cover-load-failed { opacity: 0; }

.task-cover-play {
  position: absolute;
  left: 50%;
  top: 45%;
  transform: translate(-50%,-50%);
  color: white;
  text-shadow: 0 1px 6px #000
}

.task-cover-label {
  position: absolute;
  bottom: 3px;
  font-size: 10px;
  left: 0;
  right: 0;
  color: white;
  text-shadow: 0 1px 6px #000
}

.task-video-box button:not(.task-preview-video) {
  min-height: 29px;
  font-size: 10px;
  padding: 5px 7px;
  width: 100%
}

.task-card:is(.status-processing,.status-pending,.status-queued,.status-submitting) .task-video-area {
  display: none
}

.media-load-failed {
  background: #252730!important;
  border: 1px dashed var(--control-border)!important;
  object-fit: contain!important
}

/* Shared dialogs, preserving upload, asset selection, prompt editing and download controls. */

.modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(5,6,10,.66);
  backdrop-filter: blur(5px)
}

.modal-card {
  position: relative;
  width: min(640px,96vw);
  max-height: 92dvh;
  overflow: auto;
  padding: 24px;
  background: var(--solid-surface)
}

.close {
  position: absolute;
  right: 12px;
  top: 12px;
  width: 30px;
  height: 30px;
  min-height: 30px;
  padding: 0;
  z-index: 5;
  font-size: 21px;
  border-radius: 8px
}

.preview-card,.asset-preview-card {
  display: flex;
  align-items: center;
  justify-content: center;
  width: min(1000px,94vw);
  height: 88dvh
}

.preview-card img,.asset-preview-card img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 8px
}

.video-card {
  width: min(1000px,94vw);
  height: 90dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  overflow: hidden
}

.video-frame {
  flex: 1;
  width: 100%;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #101114;
  border-radius: 10px;
  overflow: hidden
}

.video-frame video {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto
}

.video-preview-status {
  position: absolute;
  top: 18px;
  left: 18px;
  right: 55px;
  z-index: 3;
  padding: 5px 10px;
  background: rgba(20,21,26,.8);
  color: #ddd;
  font-size: 12px;
  border-radius: 8px;
  pointer-events: none
}

.video-preview-status:empty {
  display: none
}

.video-preview-status.error {
  color: #ffc1c8
}

.video-download-btn {
  flex: none;
  min-width: 130px
}

.edit-prompt-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: min(900px,94vw);
  height: min(800px,90dvh);
  overflow: auto
}

.edit-prompt-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-right: 34px
}

.edit-prompt-editor {
  flex: 1;
  min-height: 170px
}

.edit-prompt-send {
  align-self: flex-end;
  background: var(--accent);
  color: white
}

.edit-image-shelf {
  flex: none
}

.edit-prompt-character-counter {
  flex: none
}

.download-card {
  width: min(560px,94vw)
}

.download-mode-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 18px
}

.download-mode-tab.active {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent-text)
}

.download-mode-panel {
  display: none;
  gap: 14px
}

.download-modal[data-mode="download"] .download-directory-panel,.download-modal[data-mode="package"] .download-package-panel {
  display: flex;
  flex-direction: column
}

.download-main-input {
  width: 100%;
  height: 42px
}

.download-modal-actions,.confirm-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px
}

.confirm-delete-card {
  width: min(480px,94vw)
}

.confirm-delete-card p {
  font-size: 14px;
  line-height: 1.8
}

.download-notice {
  position: fixed;
  left: 50%;
  top: 12%;
  transform: translateX(-50%);
  z-index: 9999;
  max-width: calc(100vw - 32px);
  padding: 9px 16px;
  background: var(--solid-surface);
  border: 1px solid var(--border);
  border-radius: 30px;
  box-shadow: var(--ui-shadow);
  pointer-events: none;
  font-size: 13px
}

.download-notice-ok {
  color: var(--success-text)
}

.download-notice-fail {
  color: var(--error-text)
}

.announcement-card {
  width: min(760px,94vw);
  min-height: min(440px,84dvh);
  max-height: 90dvh;
  padding: 30px;
  display: flex;
  flex-direction: column;
  overflow: auto
}

.announcement-card-head {
  display: flex;
  gap: 12px;
  align-items: center;
  padding-right: 30px;
  margin-bottom: 20px
}

.announcement-card-head small {
  color: var(--muted);
  font-size: 11px
}

.announcement-card-icon {
  font-size: 24px;
  color: var(--muted)
}

.announcement-modal-text {
  font-size: 16px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  line-height: 1.9;
  flex: 1 0 auto
}

.announcement-modal-image {
  display: block;
  max-width: 100%;
  max-height: 46dvh;
  object-fit: contain;
  margin: 15px auto;
  border-radius: 9px
}

.announcement-card-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 24px;
  flex-shrink: 0
}

.prompt-editor-expanded {
  overflow: hidden
}

.creation-workspace:has(.prompt-expanded) {
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  overflow: visible
}

.prompt-panel.prompt-expanded {
  position: fixed;
  inset: 4dvh max(24px,calc((100vw - 1260px)/2));
  z-index: 160;
  overflow: auto;
  padding: 26px;
  background: var(--solid-surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: 0 0 0 100vmax rgba(5,6,10,.7)
}

.prompt-expanded #editor {
  height: 36dvh;
  max-height: none;
  min-height: 170px
}

@media(max-width:1450px) {

  .creation-workspace,.task-panel {
    padding: 20px
  }

  .grid {
    grid-template-columns: minmax(0,1.55fr) minmax(340px,1fr)
  }

  .prompt-upload-actions {
    justify-content: flex-start;
    margin-left: 0
  }

  .task-card {
    padding-right: 9px
  }

  .task-video-box {
    width: 72px
  }

  .task-preview-video {
    width: 68px;
    height: 76px
  }

  .option-row {
    gap: 8px
  }
}

@media(max-width:1100px) {

  .grid {
    grid-template-columns: minmax(0,1.35fr) minmax(300px,1fr)
  }

  .option-row {
    grid-template-columns: repeat(2,minmax(0,1fr))
  }

  .task-card {
    grid-template-columns: 1fr
  }

  .task-video-area {
    justify-content: flex-end
  }

  .task-video-divider {
    display: none
  }

  .task-video-box {
    flex-direction: row;
    width: auto
  }

  .task-preview-video {
    flex: none;
    width: 60px;
    height: 65px
  }

  .task-video-box button:not(.task-preview-video) {
    width: auto
  }

  .reference-media-grid {
    grid-template-columns: 1fr
  }


}

@media(max-width:950px) {

  .grid {
    height: auto;
    min-height: 0;
    grid-template-columns: 1fr;
    gap: 14px
  }

  .creation-workspace {
    overflow: visible
  }

  .editor {
    height: clamp(260px,38dvh,400px);
    flex: none
  }

  .task-panel {
    min-height: 300px
  }

  .task-list {
    flex: none;
    max-height: 65dvh;
    min-height: 180px
  }

  .task-list.empty {
    min-height: 200px
  }

  .reference-media-grid {
    grid-template-columns: repeat(2,minmax(0,1fr))
  }

  .task-card {
    grid-template-columns: minmax(0,1fr) auto
  }

  .task-video-box {
    width: 85px;
    flex-direction: column
  }

  .prompt-upload-actions {
    margin-left: auto
  }
}

@media(max-width:600px) {

  .announcement-card {
    width: calc(100vw - 28px);
    padding: 22px 18px
  }

  .announcement-modal-text {
    font-size: 15px
  }

  .creation-workspace,.panel {
    padding: 16px
  }

  .workspace-heading h2,.task-section-title h2 {
    font-size: 21px
  }

  .prompt-upload-actions {
    margin-left: 0;
    justify-content: flex-start;
    gap: 6px
  }

  .prompt-upload-actions .small {
    font-size: 11px;
    padding: 5px 8px
  }

  .prompt-upload-actions .face-protection-toggle {
    font-size: 10px
  }

  .reference-media-grid {
    grid-template-columns: 1fr 1fr;
    gap: 8px
  }

  .audio-reference-row {
    padding: 9px
  }




  .option-row {
    gap: 10px
  }

  .task-card {
    grid-template-columns: 1fr
  }

  .task-video-area {
    justify-content: flex-end
  }

  .task-video-box {
    flex-direction: row;
    width: auto
  }

  .modal {
    padding: 12px
  }

  .modal-card {
    padding: 18px;
    max-height: 94dvh
  }

.prompt-panel.prompt-expanded {
    inset: 10px;
    padding: 15px
  }

  .prompt-expanded .prompt-upload-actions {
    flex-wrap: wrap
  }

  .prompt-expanded #editor {
    height: 35dvh
  }

  .edit-prompt-head {
    flex-wrap: wrap
  }

  .video-card {
    height: 90dvh
  }

  .task-section-title {
    align-items: flex-start
  }

  .task-title-actions {
    margin-left: auto
  }
}

@media(prefers-reduced-motion:reduce) {

  *,*::before,*::after {
    animation: none!important;
    transition: none!important;
    scroll-behavior: auto!important
  }
}

@media(forced-colors:active) {

  .glass-panel,.panel,.modal-card {
    background: Canvas;
    border-color: CanvasText;
    backdrop-filter: none
  }

  .primary,.send-btn {
    border: 2px solid ButtonText
  }
}

/* Browser-local mixed-media library */


.asset-mention-icon { display:inline-flex; width:36px; flex:0 0 36px; justify-content:center; font-size:24px; color:var(--accent); }
.asset-preview-card { flex-direction:column; gap:16px; padding:32px; }
.asset-preview-card h3 { margin:0; max-width:100%; overflow-wrap:anywhere; padding-right:20px; }
.asset-preview-card img,.asset-preview-card video { min-height:0; max-height:calc(100% - 100px); max-width:100%; object-fit:contain; }
.asset-preview-card audio { width:min(600px,100%); }
#assetPreviewHint { margin:0; font-size:13px; }

/* Customer support uses the site's palette and shared overlay motion. */
.customer-service-trigger { display:inline-flex;align-items:center;gap:5px;white-space:nowrap;min-height:36px;padding:7px 10px;font-size:12px; }
.customer-service-trigger span { display:inline-flex;width:17px;height:17px; }
html:not([data-auth="user"]) .customer-service-trigger { display:none; }
dialog.customer-service-dialog { width:min(440px,calc(100% - 32px));max-width:none;max-height:calc(100dvh - 32px);margin:auto;padding:26px;border:1px solid var(--border);border-radius:18px;background:var(--solid-surface);color:var(--text);box-shadow:0 24px 70px rgba(0,0,0,.3); }
.customer-service-dialog::backdrop { background:rgba(0,0,0,.48); }
.customer-service-heading { display:flex;align-items:center;justify-content:space-between;gap:12px; }
.customer-service-heading h2 { margin:0;font-size:22px; }
.customer-service-intro { margin:8px 0 0;color:var(--muted);font-size:13px; }
.customer-service-card { margin-top:24px;padding:20px;border:1px solid var(--border);border-radius:12px;background:var(--surface-soft); }
.customer-service-card strong { font-size:14px;font-weight:600;overflow-wrap:anywhere; }
.customer-service-copyrow { display:flex;align-items:center;justify-content:space-between;gap:12px;margin-top:14px;flex-wrap:wrap; }
#customerServiceAccount { padding:0;border:0;background:transparent;box-shadow:none;font-size:22px;text-align:left;overflow-wrap:anywhere;min-width:0;max-width:100%;user-select:text; }
#customerServiceCopy { font-size:12px;white-space:nowrap;padding:8px 12px; }
.customer-service-hint { margin:18px 0 0;color:var(--muted);font-size:12px; }
.customer-service-feedback { margin:10px 0 0;min-height:19px;color:var(--success-text);font-size:12px; }
@media(max-width:600px) { dialog.customer-service-dialog { padding:20px; }.customer-service-card { padding:16px; }.customer-service-trigger { font-size:11px;padding:6px 8px; } }

.access-prompt{padding:clamp(96px,24vh,240px) 16px 40px;text-align:center;font-size:14px;font-weight:400;line-height:1.7}.access-prompt p{margin:0}.access-prompt p+p{margin-top:4px;color:var(--muted);font-size:13px}

/* Shared rich reference input; chip appearance is inherited from the video editor. */
.reference-editor-wrap {position:relative;min-width:0;width:100%}
.reference-prompt {white-space:pre-wrap;overflow-wrap:anywhere;outline:none;font-weight:400}
.reference-prompt:empty::before {content:attr(data-placeholder);color:var(--muted);pointer-events:none}
.reference-prompt .ref-tag {vertical-align:middle;white-space:nowrap;max-width:100%}
.reference-menu {position:absolute;z-index:70;left:10px;right:10px;bottom:10px;max-height:180px;overflow:auto;background:var(--surface);border:1px solid var(--border);border-radius:10px;padding:5px;box-shadow:0 8px 24px #0002}
.reference-menu[hidden] {display:none}
.reference-menu p {padding:8px;margin:0;color:var(--muted);font-size:12px}
.reference-menu .reference-menu-item {display:flex;align-items:center;gap:10px;width:100%;border:0;background:transparent;color:var(--text);padding:8px;border-radius:6px;text-align:left;font-size:13px;cursor:pointer}
.reference-menu-item[aria-selected="true"],.reference-menu-item:hover {background:var(--panel-soft,rgba(128,128,128,.12))}
.reference-menu-item img,.reference-menu-item>span:first-child {width:30px;height:30px;flex:none;object-fit:cover;border-radius:5px;display:grid;place-items:center}
.reference-menu-item>span:last-child {overflow:hidden;text-overflow:ellipsis;white-space:nowrap;min-width:0}

.reference-prompt .ref-tag>span {overflow:hidden;text-overflow:ellipsis;white-space:nowrap;min-width:0}
.reference-prompt .ref-tag>img,.reference-prompt .ref-tag>b {flex-shrink:0}
.reference-prompt .ref-tag {cursor:default}

