/* List history keeps the result large and its actions directly below its details. */
/* Grid cards retain their dimensions while displaying every source aspect ratio in full. */
/* Failed/cancelled tasks use the same surfaces and readable text as the rest of
   the workspace. Error colour is a small status cue, not the reading surface. */
html body.reference-ui-shell[data-studio-ui] .failure-summary {
  display:flex; flex-wrap:wrap; align-items:center; gap:16px 24px;
  padding:18px 20px; margin:0 0 20px; border:1px solid var(--studio-line);
  border-radius:14px; background:var(--studio-surface); box-shadow:none;
}
html body.reference-ui-shell[data-studio-ui] .failure-summary-main { flex:1 1 340px; min-width:0; }
html body.reference-ui-shell[data-studio-ui] .failure-summary strong {
  display:flex; align-items:center; gap:8px; margin:0 0 10px;
  color:var(--studio-text); font-size:14px; font-weight:600; line-height:1.5;
}
html body.reference-ui-shell[data-studio-ui] .failure-summary strong::before {
  content:""; width:6px; height:6px; flex:none; border-radius:50%; background:var(--studio-danger);
}
html body.reference-ui-shell[data-studio-ui] .failure-summary p { gap:7px; min-width:0; }
html body.reference-ui-shell[data-studio-ui] .failure-summary p span {
  box-sizing:border-box; max-width:min(100%,300px); padding:5px 9px;
  border:1px solid var(--studio-line); border-radius:6px;
  background:var(--studio-soft); color:var(--studio-sub);
  font-family:inherit; font-size:12px; line-height:1.5;
}
html body.reference-ui-shell[data-studio-ui] .failure-summary-controls {
  flex:1 1 490px; min-width:0; gap:8px; justify-content:flex-end;
}
html body.reference-ui-shell[data-studio-ui] .failure-summary-controls :is(button,select) {
  box-sizing:border-box; min-height:36px; height:36px; border:1px solid var(--studio-line);
  border-radius:8px; background:var(--studio-surface); color:var(--studio-text);
  font-size:12px; font-weight:500; line-height:1.4;
}
html body.reference-ui-shell[data-studio-ui] .failure-summary-controls .failure-reason-select {
  flex:1 1 200px; min-width:0; max-width:300px; width:auto; padding:0 32px 0 11px;
  color-scheme:normal;
}
html[data-zq-theme="dark"] body.reference-ui-shell[data-studio-ui] .failure-summary-controls .failure-reason-select { color-scheme:dark; }
html body.reference-ui-shell[data-studio-ui] .failure-summary-controls button { padding:0 12px; white-space:nowrap; }
html body.reference-ui-shell[data-studio-ui] .failure-summary-controls button:hover:not(:disabled) {
  color:var(--studio-accent)!important; background:var(--studio-tint)!important; border-color:var(--studio-accent)!important;
}
html body.reference-ui-shell[data-studio-ui] .failure-summary-controls button.danger:hover:not(:disabled) {
  color:var(--studio-danger)!important; background:color-mix(in srgb,var(--studio-danger) 8%,var(--studio-surface))!important;
  border-color:var(--studio-danger)!important;
}
html body.reference-ui-shell[data-studio-ui] .job-failure-reason {
  color:var(--studio-text)!important;
  background:color-mix(in srgb,var(--studio-danger) 7%,var(--studio-surface))!important;
}
html body.reference-ui-shell[data-studio-ui] .job-failure-reason strong { color:var(--studio-danger); }
html body.reference-ui-shell[data-studio-ui] .job-failure-reason.awaiting-confirmation {
  background:color-mix(in srgb,var(--studio-warning) 8%,var(--studio-surface))!important;
}
html body.reference-ui-shell[data-studio-ui] .job-failure-reason.awaiting-confirmation strong { color:var(--studio-warning); }
@media(max-width:700px) {
  html body.reference-ui-shell[data-studio-ui] .failure-summary { padding:16px; gap:16px; }
  html body.reference-ui-shell[data-studio-ui] .failure-summary-controls { justify-content:flex-start; }
  html body.reference-ui-shell[data-studio-ui] .failure-summary-controls .failure-reason-select { flex-basis:100%; max-width:none; }
}
html body.reference-ui-shell[data-studio-ui] :is(#view-work,#view-projects) :is(.work-media,.project-work-media) :is(img,video) {
  object-fit: contain !important;
  object-position: center !important;
  background: #101114 !important;
  max-width: 100% !important;
  max-height: 100% !important;
}
html body.reference-ui-shell[data-studio-ui] :is(#jobBoard[data-view-mode="list"] .queue-grid,.project-work-grid.is-list) {
  container-name: history-list;
  container-type: inline-size;
  grid-template-columns: minmax(0,1fr) !important;
  gap: 16px !important;
}
html body.reference-ui-shell[data-studio-ui] :is(#jobBoard[data-view-mode="list"],.project-work-grid.is-list) .job-row {
  --history-preview-height: clamp(248px,28cqi,352px);
  display: grid !important;
  grid-template-columns: minmax(0,.95fr) minmax(0,1fr) !important;
  grid-template-rows: minmax(0,1fr) auto !important;
  min-height: calc(var(--history-preview-height) + 32px) !important;
  padding: 16px !important;
  gap: 0 24px !important;
  align-items: stretch !important;
  overflow: visible !important;
}
html body.reference-ui-shell[data-studio-ui] :is(#jobBoard[data-view-mode="list"],.project-work-grid.is-list) .job-row .thumb {
  grid-column: 1 !important;
  grid-row: 1/3 !important;
  align-self: stretch !important;
  width: 100% !important;
  height: 100% !important;
  min-width: 0 !important;
  min-height: 0 !important;
  aspect-ratio: auto !important;
  border-radius: 10px !important;
  overflow: hidden !important;
  background: #101114 !important;
}
/* Do not crop either the result or its poster, regardless of source aspect ratio. */
html body.reference-ui-shell[data-studio-ui] :is(#jobBoard[data-view-mode="list"],.project-work-grid.is-list) .job-row .thumb :is(img,video) {
  position: absolute !important;
  inset: 0 !important;
  display: block !important;
  width: 100% !important;
  height: 100% !important;
  min-width: 0 !important;
  min-height: 0 !important;
  max-width: 100% !important;
  max-height: 100% !important;
  object-fit: contain !important;
  object-position: center !important;
  background: #101114 !important;
}
html body.reference-ui-shell[data-studio-ui] :is(#jobBoard[data-view-mode="list"],.project-work-grid.is-list) .job-row .job-main {
  grid-column: 2 !important;
  grid-row: 1 !important;
  align-self: start !important;
  min-width: 0 !important;
  padding: 4px 0 14px !important;
}
html body.reference-ui-shell[data-studio-ui] :is(#jobBoard[data-view-mode="list"],.project-work-grid.is-list) .job-row .job-main h3 {
  margin: 0 0 14px !important;
  -webkit-line-clamp: 4;
  overflow-wrap: anywhere;
}
html body.reference-ui-shell[data-studio-ui] :is(#jobBoard[data-view-mode="list"],.project-work-grid.is-list) .job-row .job-meta:empty {
  display: none !important;
}
html body.reference-ui-shell[data-studio-ui] :is(#jobBoard[data-view-mode="list"],.project-work-grid.is-list) .job-row .job-actions {
  grid-column: 2 !important;
  grid-row: 2 !important;
  align-self: end !important;
  display: flex !important;
  flex-direction: row !important;
  flex-wrap: wrap !important;
  justify-content: flex-start !important;
  align-items: center !important;
  gap: 8px !important;
  min-width: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
}
html body.reference-ui-shell[data-studio-ui] :is(#jobBoard[data-view-mode="list"],.project-work-grid.is-list) .job-row .job-actions button {
  flex: 0 0 auto !important;
  width: auto !important;
  min-width: 0 !important;
  height: 36px !important;
  min-height: 36px !important;
  padding: 0 13px !important;
  white-space: nowrap !important;
}
html body.reference-ui-shell[data-studio-ui] :is(#jobBoard[data-view-mode="list"],.project-work-grid.is-list) .job-row>.select-hit {
  top: 24px !important;
  left: 24px !important;
}
/* Selection occupies the first 30 px of the preview's top edge. Move only
   the media label when that control is visible; preserve preview dimensions. */
html body.reference-ui-shell[data-studio-ui] :is(#jobBoard[data-view-mode="list"],.project-work-grid.is-list) .job-row>.select-hit.show + .thumb .job-media-pill.type {
  left: 40px;
}
html body.reference-ui-shell[data-studio-ui] :is(#jobBoard[data-view-mode="list"],.project-work-grid.is-list) .job-row.job-type-audio {
  --history-preview-height: 204px;
}
html body.reference-ui-shell[data-studio-ui] :is(#jobBoard[data-view-mode="list"],.project-work-grid.is-list) .job-row .audio-thumb {
  width: 100%;
  min-width: 0;
  padding: 32px 18px 18px;
}
html body.reference-ui-shell[data-studio-ui] :is(#jobBoard[data-view-mode="list"],.project-work-grid.is-list) .job-row .audio-thumb audio {
  max-width: 100%;
}
/* Container width accounts for both the standard dock and the optional left composer. */
@container history-list (max-width: 640px) {
  html body.reference-ui-shell[data-studio-ui] :is(#jobBoard[data-view-mode="list"],.project-work-grid.is-list) .job-row {
    grid-template-columns: minmax(0,1fr) !important;
    grid-template-rows: auto auto auto !important;
    min-height: 0 !important;
    padding: 12px !important;
    gap: 16px 0 !important;
  }
  html body.reference-ui-shell[data-studio-ui] :is(#jobBoard[data-view-mode="list"],.project-work-grid.is-list) .job-row .thumb {
    grid-column: 1 !important;
    grid-row: 1 !important;
    height: clamp(224px,62cqi,360px) !important;
  }
  html body.reference-ui-shell[data-studio-ui] :is(#jobBoard[data-view-mode="list"],.project-work-grid.is-list) .job-row .job-main {
    grid-column: 1 !important;
    grid-row: 2 !important;
    padding: 0 !important;
  }
  html body.reference-ui-shell[data-studio-ui] :is(#jobBoard[data-view-mode="list"],.project-work-grid.is-list) .job-row .job-actions {
    grid-column: 1 !important;
    grid-row: 3 !important;
    gap: 7px !important;
  }
  html body.reference-ui-shell[data-studio-ui] :is(#jobBoard[data-view-mode="list"],.project-work-grid.is-list) .job-row .job-actions button {
    padding-inline: 11px !important;
  }
  html body.reference-ui-shell[data-studio-ui] :is(#jobBoard[data-view-mode="list"],.project-work-grid.is-list) .job-row>.select-hit {
    top: 20px !important;
    left: 20px !important;
  }
  html body.reference-ui-shell[data-studio-ui] :is(#jobBoard[data-view-mode="list"],.project-work-grid.is-list) .job-row.job-type-audio .thumb {
    height: 204px !important;
  }
}
