/* Styling only: task controls keep their original queue and recovery behavior. */
/* Shared unsaved-change prompt: deliberately in-window, never a native confirm. */
.dialog-discard{position:sticky;bottom:0;z-index:20;margin:16px 0 0;padding:16px;border:1px solid #ead3a0;border-radius:14px;background:#fffaf0;color:#725019;box-shadow:0 -4px 18px #14243f0a;box-sizing:border-box;max-width:100%;overflow-wrap:anywhere}
.dialog-discard p{margin:0 0 12px;font-size:14px;line-height:1.65}
.dialog-discard>div,.role-settings-card-actions{display:flex;flex-wrap:wrap;gap:8px}
.dialog-discard button{font:inherit;min-height:44px;padding:10px 14px;border:1px solid #dbcbaa;border-radius:10px;background:#fff;color:#4a4030;cursor:pointer;white-space:normal;max-width:100%}
.role-settings-card-actions>button{min-height:44px;white-space:normal}
.role-settings-card-actions .role-delete{color:#b42318;border-color:#e6c6c2}
.role-presets-settings .role-settings-card small.role-incomplete{color:#986315}
@media(max-width:520px){.dialog-discard>div{display:grid;grid-template-columns:1fr}.dialog-discard button{width:100%}.role-presets-settings .role-settings-card>.role-settings-card-actions{grid-column:1/-1;width:100%;display:grid;grid-template-columns:1fr 1fr}.role-presets-settings .role-settings-card-actions>button{min-width:0;width:100%;padding:10px}}
html[data-ui=next] .background-tasks-dialog {box-sizing:border-box;overflow-y:auto;overscroll-behavior:contain;font:inherit;box-shadow:0 24px 80px #14243f30}
html[data-ui=next] .background-tasks-dialog::backdrop {background:#14243f66}
html[data-ui=next] .background-tasks-dialog h2 {margin:0 0 20px;font-size:24px;line-height:1.35}
html[data-ui=next] .background-tasks-dialog h3 {font-size:17px;line-height:1.5;overflow-wrap:anywhere}
html[data-ui=next] .background-tasks-dialog p {font-size:14px;line-height:1.7;overflow-wrap:anywhere}
html[data-ui=next] .background-tasks-dialog button {font:inherit;min-height:44px;max-width:100%;white-space:normal;overflow-wrap:anywhere}
html[data-ui=next] .background-tasks-dialog>button {min-width:88px;margin:0 8px 12px 0;padding:10px 18px;border:1px solid #dce3ee;background:#f5f7fb;color:#315ee8}
html[data-ui=next] .background-tasks-dialog section>button {padding:10px 16px;border:1px solid #dce3ee;border-radius:12px;background:#f5f7fb;color:#315ee8}
html[data-ui=next] .background-tasks-dialog {color:#1d1d1f!important;border-radius:24px!important}
html[data-ui=next] .background-tasks-dialog>button {border-radius:999px}
@media(max-width:760px){
 html body .toast-stack {left:12px;right:12px;max-width:calc(100% - 24px)}
 html body .toast {min-width:0;max-width:100%;overflow-wrap:anywhere}
 .background-tasks-dialog {box-sizing:border-box;overflow-y:auto;overscroll-behavior:contain;font:inherit;width:calc(100% - 24px)!important;max-width:560px;max-height:calc(100dvh - 32px)!important;padding:20px 16px!important;margin:auto}
 .background-tasks-dialog :is(h3,p,button) {overflow-wrap:anywhere}
 .background-tasks-dialog button {font:inherit;min-height:44px;max-width:100%;white-space:normal;padding:10px 16px;border:1px solid #dce3ee;border-radius:12px;background:#f5f7fb;color:#315ee8}
 .background-tasks-dialog>button {width:calc(50% - 6px);min-width:0;margin-right:0}
 .background-tasks-dialog>button+button {margin-left:8px}
 .background-tasks-dialog section>button {width:100%}
 .background-tasks-dialog h2 {font-size:22px}
}
@media(min-width:761px) and (max-width:900px){
 html body :is(.principle-card-actions,.seed-script-toolbar,.seed-script-actions,.seed-asset-actions,.pv-firstframe-actions,.design-asset-title,.next-choice-chips,#view-agent) button {min-height:44px;height:auto}
}
/* One card per submitted task; percentages are archived output counts, not time estimates. */
:root .background-tasks-dialog{box-sizing:border-box;width:min(850px,calc(100vw - 32px));max-height:88vh;overflow:auto;padding:26px;border:1px solid #dce3ee;border-radius:22px;background:#f7f8fb;color:#23324a;font:14px/1.6 inherit;box-shadow:0 24px 80px #14243f30}
:root .background-tasks-dialog::backdrop{background:#14243f66}
:root .background-tasks-dialog header{display:flex;align-items:center;justify-content:space-between;gap:18px}
:root .background-tasks-dialog header h2{margin:0;font-size:24px}
.background-task-toolbar,.background-task-actions{display:flex;gap:8px;flex-wrap:wrap}
:root .background-tasks-dialog button{min-height:40px;border:1px solid #d5dce8;border-radius:10px;padding:8px 14px;background:white;color:#2852b8;cursor:pointer;font:inherit}
:root .background-tasks-dialog button:disabled{cursor:wait;opacity:.55}
:root .background-tasks-dialog button:focus-visible,.background-tasks-dialog summary:focus-visible{outline:3px solid #8caaff;outline-offset:3px}
:root .background-tasks-dialog .background-task-help{color:#69778b;margin:14px 0 20px;font-size:13px}
.background-task-notice:empty{display:none}
.background-task-notice{color:#9a541e;background:#fff5e6;padding:12px;border-radius:10px}
.background-task-list{display:grid;gap:14px}
.background-task-card{background:#fff;border:1px solid #e1e6ef;border-radius:16px;padding:19px;min-width:0}
.background-task-card-heading{display:flex;align-items:flex-start;justify-content:space-between;gap:12px}
:root .background-tasks-dialog .background-task-card h3{font-size:17px;line-height:1.45;margin:0;overflow-wrap:anywhere}
.background-task-badge{flex:none;padding:3px 10px;border-radius:20px;background:#eaf0ff;color:#315bcc;font-size:12px;font-weight:600}
[data-state=done] .background-task-badge{background:#e6f5ed;color:#26754c}
[data-state=partial] .background-task-badge,[data-state=needs-review] .background-task-badge,[data-state=waiting-provider] .background-task-badge{background:#fff2dc;color:#965d12}
[data-state=cancelled] .background-task-badge{background:#eef0f4;color:#697385}
:root .background-tasks-dialog .background-task-project{font-size:13px;color:#758092;margin:5px 0 14px}
:root .background-tasks-dialog .background-task-stage{margin:0 0 9px;font-size:14px;color:#384d6c}
.background-task-progress{height:10px;border-radius:20px;background:#edf1f7;overflow:hidden}
.background-task-progress>span{display:block;height:100%;border-radius:inherit;background:#3865ef;transition:width .25s ease}
.background-task-progress.is-indeterminate>span{width:35%;background:#8ba9f4;animation:backgroundTaskWaiting 1.8s ease-in-out infinite alternate}
[data-state=done] .background-task-progress>span{background:#2e9766}
[data-state=needs-review] .background-task-progress>span,[data-state=partial] .background-task-progress>span,[data-state=waiting-provider] .background-task-progress>span{background:#d5a14a;animation:none}
:root .background-tasks-dialog .background-task-count{display:flex;justify-content:space-between;gap:12px;margin:7px 0 0;font-size:12px;color:#6c7890}
:root .background-tasks-dialog .background-task-guidance{margin:12px 0 0;font-size:13px;color:#876121}
:root .background-tasks-dialog .background-task-retry-time{margin:8px 0 0;font-size:12px;line-height:1.6;color:#69778b;overflow-wrap:anywhere}
.background-task-actions{margin-top:15px}
.background-task-card details{margin-top:13px;border-top:1px solid #edf0f5;padding-top:10px;color:#67768b}
.background-task-card summary{cursor:pointer;font-size:13px}
.background-task-card details p,.background-task-card pre{white-space:pre-wrap;overflow-wrap:anywhere;font-size:12px}
@keyframes backgroundTaskWaiting{from{transform:translateX(-70%)}to{transform:translateX(280%)}}
@media(prefers-reduced-motion:reduce){.background-task-progress.is-indeterminate>span{animation:none}.background-task-progress>span{transition:none}}
@media(max-width:560px){:root .background-tasks-dialog{padding:18px 14px!important}:root .background-tasks-dialog header{align-items:flex-start;gap:10px}:root .background-tasks-dialog header h2{font-size:21px}.background-task-toolbar{gap:5px}:root .background-task-toolbar button{padding:6px 9px;font-size:12px}.background-task-card{padding:15px}.background-task-card-heading{gap:8px}.background-task-actions{display:grid;grid-template-columns:1fr;width:100%}}
