/* Complete the non-buyer workspaces after next-ui.css and mobile-actions.css.
   Classic desktop remains unchanged; mobile rules apply to both themes.
   Only presentation is changed here: task state, confirmations and costs stay intact. */

/* Dynamically mounted replication, store-visit and administration surfaces. */
html[data-ui=next] :is(.ca-workspace,.account-panel,.ca-role-add-dialog,.account-password-dialog){color:var(--ink);font-family:inherit}
html[data-ui=next] :is(.ca-eyebrow,.ca-heading p,.ca-hint,.ca-card-title>span,.ca-card label>small,.ca-model-hint,.ca-role-title small,.ca-role-choice>small,.sv-intro p,.sv-workspace label>small,.ca-delivery-summary,.ca-process-info>summary,.account-panel p,.account-panel label,.account-route-card small){color:var(--muted)}
html[data-ui=next] :is(.ca-source,.ca-role-choice,.ca-voice,.ca-history-timing,.ca-run>.pq-panel,.pq-item,.pq-detail-meta>p,.ca-details pre,.sv-photos img){background:var(--paper);border-color:var(--line);color:var(--ink-2)}
html[data-ui=next] :is(.ca-advanced,.ca-voice,.ca-config-card .ca-options,.ca-history-item+.ca-history-item,.pq-inspect,.pq-detail-meta,.pq-detail-footer){border-color:var(--line)}
html[data-ui=next] :is(.ca-workspace .secondary-button,.ca-role-trigger,.ca-role-option,.ca-add,.pq-controls button,.pq-detail-actions button,.account-panel button,.ca-role-add-dialog button,.account-password-dialog button){border-color:var(--line-dark);background:#fff;color:var(--ink);border-radius:12px}
html[data-ui=next] :is(.ca-role-option[aria-pressed=true],.pq-item.is-selected,.account-route-card.is-default,.account-panel [data-account-filter][aria-pressed=true]){background:#eaf3ff;border-color:#b8d7f7;color:#24528e}
html[data-ui=next] :is(.ca-role-check,.sv-workspace label em,.sv-role-badge){color:#24528e}
html[data-ui=next] .sv-role-badge{background:#eaf3ff}
html[data-ui=next] :is(.ca-card input,.ca-card select,.ca-card textarea,.ca-role-trigger,.ca-role-option,.pq-select,.pq-detail-fields textarea,.account-panel input,.account-panel select,.account-panel textarea,.ca-role-add-dialog input,.account-password-dialog input){color:var(--ink);border-color:var(--line-dark)}
html[data-ui=next] :is(.account-panel button.primary,.ca-role-add-dialog .ca-dialog-submit,.account-password-dialog button.primary){background:var(--blue);border-color:var(--blue);color:#fff}
html[data-ui=next] :is(.ca-workspace,.account-panel,.ca-role-add-dialog,.account-password-dialog) :is(button,input,select,textarea,summary):focus-visible{outline:2px solid var(--blue);outline-offset:3px}
html[data-ui=next] :is(.pq-controls .pq-delete,.pq-detail-actions .pq-delete){color:#b42318}
html[data-ui=next] .pq-status.running{background:#e9f7ee;color:#216640}
html[data-ui=next] .pq-status.error{background:#fff0ed;color:#993c2d}
html[data-ui=next] .pq-stage-track{background:#e8e8ed}
html[data-ui=next] .pq-stage-track>span{background:var(--blue)}
html[data-ui=next] .account-overlay>.account-panel{background:var(--paper)}
html[data-ui=next] .account-overlay>.account-panel.login{background:#fff}
html[data-ui=next] :is(.account-panel section,.ca-role-add-dialog,.account-password-dialog){border-color:var(--line);border-radius:20px}

/* Filled image/video cards previously kept the original green, tiny controls. */
html[data-ui=next] :is(.simple-module-card,.module-image-input,.design-asset-card,.design-result-card,.seed-asset-card,.seed-script-card,.pv-firstframe-card,.seed-video-card,.result-card){border-color:var(--line);border-radius:14px}
html[data-ui=next] :is(.simple-module-card,.design-asset-card,.seed-asset-card,.seed-script-card,.seed-output-settings,.pv-direction-grid>button,.pv-scene-control,.pv-scene-preview,.seed-confirm-grid>div,.seed-shot-edit-card){background:var(--paper);border-color:var(--line)}
html[data-ui=next] :is(.simple-module-number,.model-managed-note,.design-result-actions .keep-on,.pv-firstframe-actions button.confirmed,.seed-script-actions .review,.seed-script-meta .reviewed,.seed-video-actions .keep-on,.pv-direction-grid>button.active){background:#eaf3ff;border-color:#b8d7f7;color:#24528e;box-shadow:none}
html[data-ui=next] :is(.design-result-actions button,.pv-firstframe-actions button,.simple-style-library button,.seed-asset-actions button,.seed-script-actions button,.seed-video-actions button){min-height:40px;border-radius:10px;font-size:13px}
html[data-ui=next] :is(.design-result-body h4,.pv-firstframe-body h4,.seed-video-body h4,.result-info strong,.module-image-heading strong,.seed-confirm-grid strong){font-size:14px}
html[data-ui=next] :is(.design-result-body small,.pv-firstframe-body small,.seed-video-body small,.result-info small,.module-image-heading small,.seed-confirm-grid span,.seed-script-body>p){font-size:12px;line-height:1.65}
html[data-ui=next] :is(.simple-style-library select,.simple-style-library input,.simple-module-card input,.simple-module-card textarea,.seed-asset-controls select,.seed-asset-controls input,.seed-shot-edit-grid input,.seed-shot-edit-grid textarea){font:inherit;font-size:14px;min-height:40px;border-color:var(--line-dark);border-radius:10px}

/* Phone/tablet touch controls, including dynamically filled media and queue rows.
   The 900px boundary deliberately leaves full-size Classic desktop unchanged. */
@media (max-width:900px){
  html body :is(#view-clonevideo,#view-storevisit) :is(button[data-ca-remove],button[data-sv-remove]){display:inline-flex;align-items:center;justify-content:center;width:44px;height:44px;min-width:44px;min-height:44px;padding:0;font-size:22px;line-height:1}
  html body :is(#view-clonevideo,#view-storevisit) :is(.pq-controls,.pq-detail-actions)>button{min-height:44px;height:auto;min-width:0;padding:10px 12px;white-space:normal}
  html body #view-library .library-card-grid{grid-template-columns:repeat(auto-fit,minmax(min(100%,220px),1fr));gap:12px}
  html body #view-library .result-card{min-width:0}
  html body #view-library .result-info{display:grid;grid-template-columns:minmax(0,1fr) 44px;gap:8px}
  html body #view-library .result-info>div{grid-column:1/-1;min-width:0}
  html body #view-library .result-info :is(strong,small){white-space:normal;overflow-wrap:anywhere;line-height:1.5}
  html body #view-library .result-info>button{margin:0;justify-self:end}
  html body #view-library .filter-tabs>button{min-height:44px;height:auto;padding:10px 12px;white-space:normal}
  html body #view-library :is(.library-select-toggle,.result-info>button){width:44px;height:44px;min-width:44px;min-height:44px;display:inline-flex;align-items:center;justify-content:center;padding:0}
  html body #view-library .library-project-filter select{min-height:44px;height:auto}
  html body #view-library .library-batch-bar button{min-height:44px;height:auto;white-space:normal}
}

@media (max-width:760px){
  /* Main image and detail page: filled references, saved styles and results. */
  html body :is(#view-mainimage,#view-detailpage) :is(.simple-style-library,.design-result-grid){grid-template-columns:minmax(0,1fr)}
  html body :is(#view-mainimage,#view-detailpage) .simple-style-library{gap:8px}
  html body :is(#view-mainimage,#view-detailpage) .simple-style-library>:is(input,select,button){min-width:0;width:100%;min-height:44px;height:auto;font-size:16px}
  html body :is(#view-mainimage,#view-detailpage,#view-productvideo,#view-functionalvideo) :is(.design-asset-grid,.design-asset-grid.compact){grid-template-columns:repeat(2,minmax(0,1fr));gap:10px}
  html body :is(#view-mainimage,#view-detailpage) .module-image-grid{grid-template-columns:repeat(auto-fit,minmax(min(100%,130px),1fr))}
  html body :is(#view-mainimage,#view-detailpage) .module-image-card>div{grid-template-columns:minmax(0,1fr) 44px}
  html body :is(#view-mainimage,#view-detailpage) .module-image-card>div button{width:44px;height:44px}
  html body :is(#view-mainimage,#view-detailpage) .simple-module-card label{font-size:13px}
  html body :is(#view-mainimage,#view-detailpage) .simple-module-card :is(input,textarea){min-width:0;max-width:100%;font-size:16px;min-height:44px}
  html body :is(#view-mainimage,#view-detailpage) .simple-module-card>.module-delete-button{grid-column:1/-1;min-height:44px}
  html body :is(#view-mainimage,#view-detailpage) .design-failure-report>div{grid-template-columns:30px minmax(0,1fr)}
  html body :is(#view-mainimage,#view-detailpage) .design-failure-report>div>button{grid-column:1/-1;white-space:normal;min-height:44px}
  html body :is(#view-mainimage,#view-detailpage) .design-failure-report ol{margin-left:0}
  html body :is(#view-mainimage,#view-detailpage,#view-productvideo,#view-functionalvideo) .design-asset-title{grid-template-columns:minmax(0,1fr) 44px}
  html body :is(#view-mainimage,#view-detailpage,#view-productvideo,#view-functionalvideo) .design-asset-title button{width:44px;height:44px}
  html body :is(#view-mainimage,#view-detailpage,#view-productvideo,#view-functionalvideo) :is(.design-asset-empty,.design-asset-empty.compact){grid-template-columns:40px minmax(0,1fr)}
  html body :is(#view-mainimage,#view-detailpage,#view-productvideo,#view-functionalvideo) .design-asset-empty>button{grid-column:1/-1;white-space:normal;min-height:44px}

  /* Product/functional/Seed video: sources, scripts, scene boards and first frames. */
  html body :is(#view-productvideo,#view-functionalvideo,#view-seedvideo) :is(.pv-direction-grid,.pv-firstframe-grid,.seed-asset-grid,.pv-scene-preview){grid-template-columns:minmax(0,1fr)}
  html body :is(#view-productvideo,#view-functionalvideo,#view-seedvideo) :is(.seed-script-list,.seed-script-card,.seed-asset-card,.pv-scene-preview,.pv-direction-grid>button){min-width:0}
  html body .pv-direction-grid>button{grid-template-columns:37px minmax(0,1fr)}
  html body .pv-scene-control input{flex:0 0 18px}
  html body .pv-scene-control>label>span{min-width:0}
  html body .pv-scene-preview>div{min-width:0;overflow-wrap:anywhere}
  html body .seed-asset-card{grid-template-columns:100px minmax(0,1fr)}
  html body .seed-asset-controls{grid-template-columns:minmax(0,1fr)}
  html body .seed-asset-controls label{min-width:0}
  html body .view .seed-asset-controls :is(select,input){min-width:0;max-width:100%;font-size:16px;min-height:44px}
  html body .seed-bulk-reference-control>:is(div,label,button){flex:1 0 100%;width:100%;min-width:0}
  html body .seed-bulk-reference-control :is(select,button){min-height:44px;font-size:16px;white-space:normal}
  html body .seed-asset-empty{grid-template-columns:42px minmax(0,1fr)}
  html body .seed-asset-empty>button{grid-column:1/-1;width:100%;white-space:normal;min-height:44px}
  html body .view :is(.design-result-actions,.pv-firstframe-actions,.seed-asset-actions,.seed-video-actions)>button{min-width:0;min-height:44px;height:auto;padding:10px 8px;white-space:normal;font-size:13px;overflow-wrap:anywhere}
  html body :is(.design-result-body,.pv-firstframe-body,.seed-script-body,.seed-video-body){overflow-wrap:anywhere}
  html body .functional-flow{grid-template-columns:repeat(2,minmax(0,1fr));align-items:stretch}
  html body .functional-flow i{display:none}
  html body .functional-example{flex-wrap:wrap}
  html body :is(.seed-shot-editor-head,.seed-confirm-grid){gap:10px}
  html body .seed-shot-editor-head{flex-wrap:wrap;align-items:flex-start}
  html body .seed-shot-edit-grid{grid-template-columns:repeat(2,minmax(0,1fr))}
  html body .seed-shot-edit-grid label{min-width:0;font-size:13px}
  html body .seed-shot-edit-grid label.wide{grid-column:1/-1}
  html body .modal-card .seed-shot-edit-grid :is(input,textarea){min-width:0;max-width:100%;font-size:16px;min-height:44px}
  html body .seed-confirm-grid>div{min-width:0;overflow-wrap:anywhere}

  /* Replication and store visit use nested cards, so reserve the width for content. */
  html body .ca-workspace{padding:0!important;min-width:0;max-width:100%}
  html body .ca-heading{gap:12px;flex-wrap:wrap}
  html body .ca-heading>div{min-width:0;flex:1 1 100%}
  html body .ca-heading>.secondary-button{flex:1;min-width:0;white-space:normal}
  html body .ca-workspace .ca-card{padding:16px}
  html body .ca-layout,.ca-layout>div,.ca-result,.ca-result>div{min-width:0}
  html body .ca-layout,.ca-result,.ca-config-card .ca-brief-grid{grid-template-columns:minmax(0,1fr)}
  html body .ca-upload-card{position:static}
  html body .ca-role-trigger,.ca-role-preview,.ca-role-preview>span{min-width:0;overflow-wrap:anywhere}
  html body .ca-role-trigger>span:last-child{flex-shrink:0}
  html body .ca-role-list{grid-template-columns:minmax(0,1fr)}
  html body .ca-role-title small{display:block;margin-left:0}
  html body .ca-run>.pq-panel{padding:12px}
  html body .pq-item{min-width:0}
  html body .pq-select{min-width:0;flex-basis:calc(100% - 44px);padding-right:10px;column-gap:8px}
  html body .pq-select .pq-task-id{flex-wrap:wrap;gap:2px 8px;max-height:none;white-space:normal;overflow:visible}
  html body .pq-controls{padding:0 10px 10px 36px;flex-wrap:wrap;width:100%;min-width:0}
  html body .pq-controls:empty{display:none}
  html body .pq-controls button{min-height:44px;min-width:0;white-space:normal}
  html body .pq-inspect,.pq-detail-fields{grid-template-columns:minmax(0,1fr)}
  html body .pq-detail-media{grid-template-columns:minmax(0,1fr)}
  html body .pq-detail-images{min-width:0}
  html body .pq-inspect textarea{font-size:16px}
  html body .ca-actions-left{grid-template-columns:minmax(0,1fr)}
  html body .ca-actions-left button{white-space:normal}
  html body .ca-actions-right{width:100%;margin-left:0}
  html body .ca-actions-right button{width:100%;min-width:0;white-space:normal}
  html body .sv-field-label{flex-wrap:wrap}
  html body :is(.ca-role-add-dialog,.account-password-dialog){width:calc(100vw - 16px);max-width:calc(100vw - 16px);max-height:calc(100dvh - 16px);padding:16px}

  /* Agent tasks may have long user text, many state actions and selected images. */
  html body #view-agent :is(.agent-task,.agent-plan,.agent-result,.agent-progress,.agent-thread-more){min-width:0}
  html body #view-agent .agent-task{padding:14px}
  html body #view-agent .agent-task>header{flex-wrap:wrap;gap:10px}
  html body #view-agent .agent-task>header>strong{min-width:0;flex:1 1 100%}
  html body #view-agent .agent-task>header>span{max-width:100%;white-space:normal}
  html body #view-agent .agent-starters{grid-template-columns:minmax(0,1fr)}
  html body #view-agent .agent-starters button{text-align:left;min-height:44px;padding:12px}
  html body #view-agent .agent-progress-title{flex-wrap:wrap}
  html body #view-agent .agent-project-controls label{min-width:0;width:100%;flex:1 1 100%}
  html body #view-agent .agent-thread-head [data-agent-history]{width:100%;min-width:0;min-height:44px;font-size:16px}
  html body #view-agent .agent-thread-more summary{min-height:44px;display:flex;align-items:center;justify-content:center}
  html body #view-agent .agent-results{grid-template-columns:minmax(0,1fr)}
  html body .agent-asset-grid{grid-template-columns:repeat(auto-fit,minmax(min(100%,130px),1fr));gap:10px}
  html body .agent-asset-grid select{min-height:44px;font-size:16px}
  html body .agent-asset-grid>label{min-width:0}
  html body .agent-results>figure{min-width:0;margin:0}

  /* Library filled state: four desktop columns are not usable on phones. */
  html body #view-library .library-result-group-head{flex-wrap:wrap;gap:8px}
  html body #view-library .library-result-group-head strong{min-width:0;overflow-wrap:anywhere}
  html body #view-library .library-result-group-head small{flex-basis:100%;margin-left:0}
  html body #view-library .library-project-filter{flex-wrap:wrap;gap:8px}
  html body #view-library .library-project-filter select{min-height:44px;font-size:16px;max-width:100%}
  html body #view-library .library-select-toggle{width:44px;height:44px}

  /* Administration forms stack; data tables keep their own horizontal scroll. */
  html body .account-overlay{padding:8px}
  html body .account-overlay>.account-panel{padding:16px;max-height:calc(100dvh - 16px);max-width:100%;min-width:0}
  html body .account-panel section{padding:14px;min-width:0}
  html body .account-panel :is(header,.account-model-save,.account-actions){flex-wrap:wrap;min-width:0}
  html body .account-panel header>div{min-width:0;overflow-wrap:anywhere}
  html body .account-panel :is(.account-grid,.account-grid.two,.settings-form,.account-route-cards){grid-template-columns:minmax(0,1fr)}
  html body .account-panel :is(label,fieldset,.account-model,.account-inline-pricing,.account-model-settings){min-width:0;max-width:100%}
  html body .account-panel .account-scroll{width:100%;min-width:0;max-width:100%;overflow-x:auto;overscroll-behavior-x:contain}
  html body .account-panel :is(input,select,textarea){min-width:0;max-width:100%;font-size:16px;min-height:44px}
  html body .account-panel input[type=checkbox]{min-height:0}
  html body .account-panel :is(button,.account-actions>button){max-width:100%;min-height:44px;white-space:normal;overflow-wrap:anywhere}
  html body .account-inline-pricing{padding:16px}
  html body :is(.ca-role-add-dialog,.account-password-dialog) :is(input,select,textarea){min-width:0;font-size:16px;min-height:44px}
  html body .account-password-dialog :is(header,footer){flex-wrap:wrap}
  html body :is(#view-settings,#view-diagnostics,#view-statistics) .panel-heading{flex-wrap:wrap;gap:10px}
  html body :is(#view-settings,.account-model-settings) .config-heading{flex-wrap:wrap;gap:10px}
  html body :is(#view-settings,.account-model-settings) .config-heading>div{min-width:0;flex:1}
  html body :is(#view-settings,.account-model-settings) .config-heading>.test-button{flex:1 0 100%;min-height:44px;margin-left:0;white-space:normal}
  html body #view-statistics :is(.statistics-pricing-footer,.statistics-legend){flex-wrap:wrap}
  html body #view-statistics .statistics-pricing-grid{grid-template-columns:minmax(0,1fr)}
  html body #view-statistics .statistics-range-tabs{width:100%}
  html body #view-statistics .statistics-range-tabs button{flex:1;min-height:44px;padding:8px}
  html body #view-statistics .statistics-legend{gap:10px}
  html body :is(.diagnostic-grid,.diagnostic-hero){grid-template-columns:minmax(0,1fr)}
  html body .check-row{grid-template-columns:30px minmax(0,1fr);min-width:0}
  html body .check-row em{grid-column:2;overflow-wrap:anywhere}
  html body .check-row small{overflow-wrap:anywhere}
  html body #view-diagnostics .proxy-options{grid-template-columns:minmax(0,1fr)}
  html body #view-diagnostics .proxy-options label{min-width:0;min-height:44px}
  html body #view-diagnostics .proxy-options label>span{min-width:0;overflow-wrap:anywhere}
  html body #view-diagnostics .proxy-options small{font-size:12px}
  html body #view-diagnostics .manual-proxy{flex-wrap:wrap}
  html body #view-diagnostics .manual-proxy>:is(input,button){flex:1 1 100%;min-width:0;max-width:100%;min-height:44px;font-size:16px}
  html body #view-diagnostics .env-row{flex-wrap:wrap;gap:8px}
  html body #view-diagnostics .env-row>strong{min-width:0;overflow-wrap:anywhere}
  html body #view-diagnostics .env-row>button{min-height:44px;font-size:13px}
}

@media (max-width:520px){
  html body :is(#view-productvideo,#view-functionalvideo,#view-seedvideo) :is(.seed-asset-card,.seed-script-card){grid-template-columns:minmax(0,1fr)}
  html body .seed-asset-preview{width:100%;max-height:260px;aspect-ratio:4/3}
  html body .seed-asset-preview img{object-fit:contain}
  html body .seed-script-thumb{height:180px;min-height:0;object-fit:contain}
  html body .seed-confirm-grid{grid-template-columns:minmax(0,1fr)}
}
