/* Home layout: bounded references, a writing pane and a full-height results pane. */
html #studioRoot:not(.auth-locked) .app-shell>#studioGenerateView {
  grid-template-columns:minmax(360px, .9fr) minmax(360px, 1.1fr)!important;
  grid-template-rows:minmax(0,1fr) auto!important;
  grid-template-areas:"workspace tasks" "controls tasks"!important;
  gap:0 14px!important;
}
html #studioRoot:not(.auth-locked) .app-shell>main.grid>.panel {
  border-radius:14px!important;box-shadow:none!important;
}
html #studioRoot:not(.auth-locked) .app-shell>main.grid>.prompt-panel {
  padding:18px 18px 8px!important;border-radius:14px 14px 0 0!important;
  border-bottom:0!important;overflow:auto!important;
}
html #studioRoot .prompt-section-title {display:flex;align-items:flex-start;flex-direction:column;justify-content:space-between;flex-wrap:nowrap;gap:8px!important;margin-bottom:8px!important}
html #studioRoot .prompt-section-title h2 {font-size:22px!important;margin:0!important}
html #studioRoot .prompt-upload-actions {width:auto;display:flex;gap:5px!important;flex-wrap:wrap;margin:0!important}
html #studioRoot .prompt-upload-actions button.small {font-size:15px!important;font-weight:650!important;padding:6px 9px!important;min-height:36px!important}
html #studioRoot .prompt-panel #dropZone {
  --reference-card-height:104px;
  height:auto!important;min-height:148px!important;max-height:none!important;
  flex:0 0 auto!important;padding:8px!important;margin:0 0 8px!important;
  border-radius:10px!important;overflow:hidden!important;
}
html #studioRoot .prompt-panel #dropZone:has(.image-list.empty) {height:72px!important;min-height:72px!important}
html #studioRoot #imageList:not(.empty) {
  display:flex!important;flex-flow:row nowrap!important;gap:7px!important;
  width:100%!important;min-height:0!important;height:calc(var(--reference-card-height) + 10px)!important;max-height:calc(var(--reference-card-height) + 10px)!important;
  flex:0 0 auto!important;overflow-x:auto!important;overflow-y:hidden!important;
  padding:0 0 5px!important;scrollbar-gutter:auto!important;overscroll-behavior-x:contain;
}
html #studioRoot #imageList .image-card {
  flex:0 0 88px!important;width:88px!important;height:var(--reference-card-height)!important;
  padding:4px!important;gap:3px!important;overflow:hidden!important;border-radius:7px!important;
}
html #studioRoot #imageList .image-card img {
  width:78px!important;height:48px!important;aspect-ratio:auto!important;object-fit:contain!important;
}
html #studioRoot #imageList .image-card .name {font-size:10px!important;min-height:14px!important;line-height:14px!important}
html #studioRoot #imageList .image-card .row {gap:3px!important;flex-wrap:nowrap!important;margin-top:auto!important}
html #studioRoot #imageList .image-card .row button {min-width:0!important;flex:1!important;height:22px!important;min-height:22px!important;font-size:10px!important;padding:2px!important}
html #studioRoot #imageList .upload-ok .upload-state {display:none}
html #studioRoot #imageList .upload-state {font-size:9px;left:3px;top:3px;padding:2px 3px}
html #studioRoot #imageList .image-error {display:none}
html #studioRoot #studioUploadPrompt {flex-direction:row;gap:8px!important;padding:4px!important}
html #studioRoot #studioUploadPrompt .si {width:18px;height:18px;margin:0}
html #studioRoot #studioUploadPrompt strong {font-size:11px}
html #studioRoot .reference-media-row:has(#referenceMediaList:empty) {display:none!important}
html #studioRoot .reference-media-row {flex-shrink:0;max-height:82px;overflow:auto;margin-bottom:8px}
html #studioRoot .studio-prompt-label {display:flex;align-items:center;justify-content:space-between;margin:0 0 6px!important;flex-shrink:0}
html #studioRoot #clearAllBtn {min-height:32px!important;padding:5px 10px!important;font-size:14px!important;font-weight:700!important;background:var(--studio-control)!important;color:var(--studio-text)!important;border:1px solid var(--studio-line-strong)!important;opacity:1!important}
html #studioRoot:not(.auth-locked) .app-shell>main.grid>.prompt-panel>.editor {
  flex:1 0 100px!important;min-height:100px!important;height:auto!important;
  padding:12px!important;font-size:13px!important;line-height:1.8!important;border-radius:10px!important;
}
html #studioRoot:not(.auth-locked) .app-shell>main.grid>.prompt-panel .fixed-prompt-wrap {margin-top:8px!important;flex-shrink:0}
html #studioRoot .fixed-prompt-head {cursor:pointer;display:list-item!important;list-style:disclosure-closed inside;font-size:11px;padding:4px 0;margin:0!important}
html #studioRoot details[open]>.fixed-prompt-head {list-style-type:disclosure-open}
html #studioRoot .fixed-prompt-head em {font-size:10px;margin-left:12px}
html #studioRoot:not(.auth-locked) .fixed-prompt-input {width:100%;margin-top:6px;height:60px!important;min-height:60px!important}
html #studioRoot:not(.auth-locked) .app-shell>main.grid>.option-panel {
  display:grid!important;grid-template-columns:minmax(0,1fr) minmax(0,1fr)!important;
  gap:8px 12px!important;padding:10px 18px 12px!important;height:auto!important;
  border-top:0!important;border-radius:0 0 14px 14px!important;overflow:visible!important;
}
html #studioRoot:not(.auth-locked) .option-panel>h2 {display:none!important}
html #studioRoot:not(.auth-locked) .app-shell>main.grid>.option-panel>.source-row {
  grid-column:1/-1!important;display:grid!important;grid-template-columns:minmax(0,2fr) repeat(3,minmax(0,1fr))!important;gap:8px!important;
}
html #studioRoot:not(.auth-locked) .app-shell>main.grid>.option-panel>.source-row>label {grid-column:auto!important;min-width:0;font-size:11px!important;gap:5px!important}
html #studioRoot:not(.auth-locked) .app-shell>main.grid>.option-panel>.option-row {display:grid!important;grid-template-columns:1fr 1fr!important;gap:8px!important;margin:0!important}
html #studioRoot:not(.auth-locked) .app-shell>main.grid>.option-panel>.option-row>label {grid-column:auto!important;font-size:11px!important;gap:5px!important}
html #studioRoot .option-panel select {width:100%!important;min-width:0!important;height:32px!important;font-size:12px!important;padding:0 7px!important}
html #studioRoot #selectedModelPrice {box-sizing:border-box;display:flex;align-items:center;width:100%;min-height:32px;padding:0 8px;border:1px solid var(--studio-line-strong);border-radius:8px;background:var(--studio-control);color:var(--studio-text);font-size:12px;line-height:1.4;overflow-wrap:anywhere}
html #studioRoot .option-panel .model-resolution {display:none!important}
html #studioRoot #refreshMeaiccModelsBtn {font-size:10px!important;padding:4px!important;min-height:32px!important}
html #studioRoot #generationCost {grid-column:2!important;grid-row:2!important;align-self:center;margin:0!important;padding:0!important;border:0!important;font-size:11px!important;line-height:1.6}
html #studioRoot #generateBtn {grid-column:1/-1;width:100%;height:38px!important;min-height:38px!important;margin:0!important;border-radius:8px!important}
html #studioRoot #statusLine {grid-column:1/-1;min-height:0!important;font-size:10px!important;line-height:14px;margin:0!important}
@media(min-width:960px) and (max-height:740px) {
  html #studioRoot:not(.auth-locked) .app-shell>main.grid>.prompt-panel {padding-top:12px!important}
  html #studioRoot .prompt-panel #dropZone {--reference-card-height:88px;min-height:130px!important}
  html #studioRoot .image-shelf-head {margin-bottom:5px!important}
  html #studioRoot #imageList .image-card {gap:1px!important}
  html #studioRoot #imageList .image-card img {height:38px!important}
}
/* Task card surfaces: keep base and hover below the selected-card specificity. */
html #studioRoot .app-shell>main.grid>.task-panel .task-card {
  background:var(--studio-field)!important;border:1px solid var(--studio-line)!important;
  box-shadow:none!important;transition:border-color .2s,box-shadow .2s;
}
html #studioRoot .app-shell>main.grid>.task-panel .task-card:hover {
  border-color:var(--studio-line-strong)!important;box-shadow:0 6px 22px #0001!important;
}

/* Selected task cards keep the base card background at each breakpoint.
   Preserve the existing highlight colors until a separate palette change. */
#studioRoot .app-shell>main.grid>.task-panel #taskList .task-card.task-selected {
  outline:2px solid #11182722;
  border-color:#b376f4!important;box-shadow:inset 0 0 0 1px #b376f425!important;
}

/* Task selection: the label owns pointer input; the native checkbox shows state.
   Keep the legacy hidden span's appearance here until its markup is retired. */
#studioRoot #taskList .task-select {
  position:static!important;left:4px!important;top:4px!important;z-index:3;
  display:flex;align-items:center;justify-content:center;cursor:pointer;
  width:17px!important;height:22px!important;padding:0!important;margin:0!important;transform:none!important;
}
#studioRoot #taskList .task-select input {
  position:static!important;width:14px!important;height:14px!important;margin:0!important;
  appearance:auto!important;opacity:1!important;pointer-events:none;accent-color:var(--studio-violet);
}
#studioRoot #taskList .task-select>span {
  display:none!important;width:17px!important;height:17px!important;border-radius:50%;
  border:2px solid #cbd5e1;background:#fff;box-shadow:0 2px 8px rgba(15,23,42,.10);
}
#studioRoot #taskList .task-select input:checked + span {
  background:#111827;border-color:#111827;box-shadow:inset 0 0 0 4px #fff,0 2px 8px rgba(15,23,42,.16);
}
@media(min-width:960px) {
  /* Desktop card sizing formerly lived in console.css; the compact geometry
     below owns padding, columns and gap for every width. */
  html #studioRoot:not(.auth-locked) .app-shell>main.grid>.task-panel #taskList .task-card {background:var(--studio-card)!important;flex:0 0 auto!important;width:100%!important;max-width:none!important;overflow:visible!important}
  html #studioRoot:not(.auth-locked) .app-shell>main.grid>.task-panel #taskList .task-card:has(.empty-video) {grid-template-columns:minmax(0,1fr)!important}
  html #studioRoot:not(.auth-locked) #taskList .task-select {float:left;margin:3px 8px 0 0!important}
}

html #studioRoot:not(.auth-locked) .app-shell>main.grid>.task-panel {border-radius:14px!important;padding:12px!important;gap:6px!important}
html #studioRoot:not(.auth-locked) .app-shell>main.grid>.task-panel #taskList .task-card {min-height:0!important;padding:8px!important;border-radius:8px!important;gap:3px 8px!important;grid-template-columns:minmax(0,1fr) 88px!important}
html #studioRoot:not(.auth-locked) #taskList .task-video-area {width:88px!important}
html #studioRoot:not(.auth-locked) #taskList :is(.task-video-box,.task-preview-button,.task-video-box button.small) {width:88px!important}
html #studioRoot:not(.auth-locked) #taskList .task-preview-button {height:88px!important;max-height:88px!important;flex:0 0 88px!important;aspect-ratio:1 / 1;border-radius:8px!important}
html #studioRoot:not(.auth-locked) #taskList .task-video-box {flex-direction:column!important}
html #studioRoot:not(.auth-locked) #taskList .task-prompt {font-size:12px!important;line-height:1.5!important;margin:0!important;-webkit-line-clamp:1}
html #studioRoot:not(.auth-locked) #taskList .task-head strong {font-size:13px!important}
html #studioRoot:not(.auth-locked) #taskList .task-actions {justify-content:flex-start!important}
html #studioRoot:not(.auth-locked) #taskList .task-actions button {width:auto!important;min-height:24px!important;padding:2px 6px!important;font-size:11px!important}

/* Tight rows preserve errors, billing and actions without empty card space. */
html #studioRoot:not(.auth-locked) .app-shell>main.grid>.task-panel #taskList {gap:8px!important}
html #studioRoot:not(.auth-locked) #taskList .task-main {gap:3px!important}
html #studioRoot:not(.auth-locked) #taskList .task-bottom {gap:4px!important}
html #studioRoot:not(.auth-locked) #taskList .task-actions {margin-top:4px!important;gap:5px!important}
html #studioRoot:not(.auth-locked) #taskList .task-head {gap:4px 6px!important;line-height:1.4!important}
html #studioRoot:not(.auth-locked) #taskList .badge {padding:2px 6px!important;font-size:10px!important}
html #studioRoot:not(.auth-locked) #taskList .task-info,
html #studioRoot:not(.auth-locked) #taskList .task-info :is(span,em) {font-size:10px!important;line-height:1.4!important;gap:2px 8px!important}
html #studioRoot:not(.auth-locked) #taskList .task-video-area {padding:0!important;border:0!important}
html #studioRoot:not(.auth-locked) #taskList .task-video-box {gap:4px!important}
html #studioRoot:not(.auth-locked) #taskList :is(.task-actions button.use,.task-video-box button.download-video) {
  box-sizing:border-box;width:88px!important;min-width:88px!important;height:32px!important;min-height:32px!important;
  flex-shrink:0;padding:5px 8px!important;font-size:12px!important;line-height:20px!important;border-radius:8px!important;
}
html #studioRoot:not(.auth-locked) #taskList :is(.recorded-billing,.recorded-expiry) {border:0!important;padding:0!important;font-size:10px!important;line-height:1.4!important}
html #studioRoot:not(.auth-locked) #taskList .task-preview-play {width:24px!important;height:24px!important;font-size:11px!important}

@media(max-width:959px) {
  html #studioRoot:not(.auth-locked) .app-shell>#studioGenerateView {height:auto!important;grid-template-columns:minmax(0,1fr)!important;grid-template-rows:auto auto auto!important;grid-template-areas:"workspace" "controls" "tasks"!important;overflow:visible!important;gap:0!important}
  html #studioRoot:not(.auth-locked) .app-shell>main.grid>.prompt-panel>.editor {min-height:180px!important}
  html #studioRoot:not(.auth-locked) .app-shell>main.grid>.task-panel {position:relative!important;top:auto!important;height:650px!important;max-height:none!important;margin-top:14px!important}
}
@media(max-width:480px) {
  html #studioRoot:not(.auth-locked) .app-shell>main.grid>.option-panel>.source-row {grid-template-columns:1fr 1fr!important}
  html #studioRoot:not(.auth-locked) .app-shell>main.grid>.option-panel>.source-row>.model-picker {grid-column:1/-1!important}
  html #studioRoot .prompt-upload-actions {width:100%}
  html #studioRoot .prompt-upload-actions button.small {width:auto!important;flex:1;padding:6px 3px!important;font-size:14px!important;gap:4px!important}
  html #studioRoot:not(.auth-locked) .app-shell>main.grid>.task-panel #taskList .task-card {grid-template-columns:minmax(0,1fr)!important}
  html #studioRoot:not(.auth-locked) #taskList .task-video-area {width:100%!important;padding:0!important}
  html #studioRoot:not(.auth-locked) #taskList .task-video-box {flex-direction:row!important;width:100%!important}
  html #studioRoot:not(.auth-locked) #taskList .task-preview-button {flex-basis:88px!important}
}

html #studioRoot:not(.auth-locked) #taskList .task-preview-button .task-cover {object-fit:contain!important}
html #studioRoot:not(.auth-locked) #taskList .task-preview-button .task-cover {background:var(--studio-inset)!important}

/* Compact queue controls match the smaller square previews. */
html #studioRoot:not(.auth-locked) .task-section-title {margin:0!important;gap:6px!important}
html #studioRoot:not(.auth-locked) .task-section-title h2 {font-size:15px!important}
html #studioRoot:not(.auth-locked) .studio-task-note {font-size:11px!important;line-height:1.4!important;margin:0!important}
html #studioRoot:not(.auth-locked) :is(.studio-task-filters,.studio-task-toolbar) button {min-height:26px!important;padding:3px 8px!important;font-size:11px!important}
html #studioRoot:not(.auth-locked) #taskList .task-video-box.empty-video {min-height:64px!important}

/* Failed tasks have no preview: keep all recovery actions in one compact row. */
html #studioRoot:not(.auth-locked) .app-shell>main.grid>.task-panel #taskList .task-card:is(.status-failed,.status-submit_failed) {
  grid-template-columns:minmax(0,1fr)!important;grid-auto-rows:auto!important;
  height:auto!important;min-height:0!important;align-content:start!important;
}
html #studioRoot:not(.auth-locked) #taskList .task-card:is(.status-failed,.status-submit_failed) .task-video-area {display:none!important}
html #studioRoot:not(.auth-locked) #taskList .task-card:is(.status-failed,.status-submit_failed) .task-actions button {
  box-sizing:border-box;width:90px!important;min-width:90px!important;height:32px!important;min-height:32px!important;
  flex:0 0 90px!important;padding:5px 8px!important;font-size:12px!important;line-height:20px!important;border-radius:8px!important;
}

/* Both content frames start below an equally sized, readable toolbar. */
html #studioRoot .studio-task-header {display:flex;flex-direction:column;justify-content:space-between;gap:4px;flex-shrink:0;min-width:0}
html #studioRoot:not(.auth-locked) .studio-task-header .task-section-title {flex-wrap:wrap;flex-shrink:0;align-items:center}
html #studioRoot:not(.auth-locked) .studio-task-header .task-section-title h2 {font-size:20px!important;white-space:nowrap}
html #studioRoot:not(.auth-locked) .studio-task-header .studio-task-toolbar {margin:0!important}
html #studioRoot .image-shelf-head {font-size:15px!important;font-weight:650!important;min-height:21px!important;height:auto!important;color:var(--studio-text)!important}
html #studioRoot .image-shelf-head>span {font-size:15px!important;color:var(--studio-text)!important}
html #studioRoot #studioUploadPrompt strong {font-size:13px}
html #studioRoot .prompt-upload-actions button:disabled {opacity:1!important;color:var(--studio-muted)!important;border-style:dashed!important;cursor:not-allowed}
@media(min-width:960px) {
  html #studioRoot:not(.auth-locked) .app-shell>main.grid>.prompt-panel {padding-top:12px!important}
  html #studioRoot .prompt-section-title,
  html #studioRoot .studio-task-header {box-sizing:border-box;height:112px!important;min-height:112px!important;flex:0 0 112px!important}
  html #studioRoot:not(.auth-locked) .app-shell>main.grid>.task-panel {gap:8px!important}
}
@media(max-width:480px) {
  html #studioRoot .prompt-upload-actions .si {display:none}
}
/* Compact model tiles keep their square size even when only one model exists. */
html #studioRoot .studio-model-grid{grid-template-columns:repeat(auto-fill,240px)!important;gap:12px!important;justify-content:start;align-items:start}
html #studioRoot .studio-model-card{box-sizing:border-box;display:grid!important;grid-template-rows:24px 20px 12px 22px minmax(0,1fr) 30px 32px;gap:3px;width:240px;height:240px;min-height:0;padding:10px!important;border-radius:12px!important;overflow:visible}
html #studioRoot .studio-model-top{margin:0;gap:6px;min-width:0;justify-content:flex-end}
html #studioRoot .studio-model-badge{padding:2px 6px;font-size:10px;line-height:16px;color:var(--studio-text);border-color:var(--studio-line-strong)}
html #studioRoot .studio-model-card h3{font-size:15px!important;line-height:20px;margin:0;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
html #studioRoot .studio-model-id{font-size:10px;line-height:12px;margin:0;min-height:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
html #studioRoot .studio-model-capabilities{gap:4px;margin:0;flex-wrap:nowrap;align-items:center;min-width:0}
html #studioRoot .studio-model-capabilities span{font-size:10px;line-height:16px;padding:1px 4px;white-space:nowrap;border-radius:4px}
html #studioRoot .studio-model-specs{font-size:11px;line-height:16px;gap:2px;margin:0;align-self:center;min-width:0}
html #studioRoot .studio-model-specs>div{grid-template-columns:28px minmax(0,1fr);gap:6px;min-width:0}
html #studioRoot .studio-model-specs dd{white-space:nowrap;overflow-x:auto;scrollbar-width:none;overflow-wrap:normal}
html #studioRoot .studio-model-price{margin:0;padding:3px 0;gap:5px;font-size:10px;align-items:center;min-width:0}
html #studioRoot .studio-model-price>span{white-space:nowrap}
html #studioRoot .studio-model-price>span>strong{font-size:20px!important;line-height:22px}
html #studioRoot .studio-model-price-details{font-size:10px;position:relative}
html #studioRoot .studio-model-price-details[open]>.studio-model-price-popover{position:absolute;right:0;bottom:calc(100% + 8px);display:block;box-sizing:border-box;width:216px;min-width:0;max-height:180px;overflow:auto;padding:10px;border:1px solid var(--studio-line-strong);border-radius:8px;background:var(--studio-panel);box-shadow:0 6px 20px #0004;z-index:5}
html #studioRoot .studio-model-price-popover>div{display:flex;justify-content:space-between;gap:8px;padding:4px 0;font-size:11px}
html #studioRoot .studio-model-price-popover strong{font-size:11px!important;white-space:nowrap}
html #studioRoot .studio-model-card:has(.studio-model-price-details[open]){z-index:3}
html #studioRoot .studio-model-select{height:32px!important;min-height:32px!important;padding:4px 9px!important;font-size:12px!important;border-radius:7px!important}
html #studioRoot .studio-model-toolbar{padding:12px}
html #studioRoot .studio-model-filter-row{margin-top:10px}
@media(max-width:360px){html #studioRoot .studio-model-grid{grid-template-columns:minmax(0,240px)!important}html #studioRoot .studio-model-card{width:100%;height:auto;aspect-ratio:1}}
