/* Client app + ops console shell. Depends on tokens.css + ui.css. */

.app-body { background: var(--bg); }
.shell { display: grid; grid-template-columns: 248px minmax(0, 1fr); min-height: 100vh; }

/* sidebar */
.side { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; justify-content: space-between; padding: 22px 16px 26px; border-right: 1px solid var(--border); background: var(--bg-soft); overflow-y: auto; }
.side .brand { height: 48px; margin: 0 0 18px 8px; }
.ws { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 12px; border-radius: 10px; border: 1px solid var(--border-strong); background: var(--surface); font: 600 15px/1.2 var(--font-ui); cursor: pointer; text-align: left; }
.ws:hover { border-color: var(--accent-border); }
.ws-badge { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 7px; background: var(--accent-soft-2); color: var(--accent-text); font-weight: 700; font-size: 14px; }
.ws-ico .i { width: 20px; height: 20px; color: var(--muted); }
.ws-chev { margin-left: auto; color: var(--muted); }
.side-nav { display: grid; gap: 4px; margin-top: 22px; }
.side-nav a { position: relative; display: flex; align-items: center; gap: 14px; padding: 10px 16px; border-radius: 10px; color: var(--text-2); text-decoration: none; font: 500 16px/1.2 var(--font-ui); }
.side-nav a .i { width: 22px; height: 22px; color: var(--muted); stroke-width: 1.6; }
.side-nav a:hover { background: var(--surface-2); color: var(--text); }
.side-nav a[aria-current="page"] { background: var(--accent-soft-2); color: var(--text); font-weight: 600; }
.side-nav a[aria-current="page"] .i { color: var(--text); }
.side-nav a[aria-current="page"]::before { content: ""; position: absolute; left: -16px; top: 6px; bottom: 6px; width: 4px; border-radius: 0 3px 3px 0; background: var(--violet-400); }
.side-foot { display: flex; align-items: center; gap: 14px; padding: 10px 16px; color: var(--text-2); text-decoration: none; font: 500 15.5px/1 var(--font-ui); }
.side-foot .i { width: 22px; height: 22px; color: var(--muted); }

/* topbar */
.main-col { min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 16px; height: 72px; padding: 0 28px; border-bottom: 1px solid var(--border); background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
.topbar-left { flex: 1; min-width: 0; }
.topbar-right { display: flex; align-items: center; gap: 14px; flex: none; }
.side-toggle { display: none; }
.search { display: flex; align-items: center; gap: 12px; max-width: 460px; height: 44px; padding: 0 16px; border-radius: 10px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--muted); }
.search:focus-within { border-color: var(--accent-border); box-shadow: var(--focus); }
.search input { flex: 1; min-width: 0; border: 0; background: transparent; outline: none; font-size: 15.5px; color: var(--text); }
.search input::placeholder { color: var(--muted); }
.search-sm { width: 320px; height: 40px; }
.crumbs { display: flex; align-items: center; gap: 12px; font-size: 15.5px; color: var(--muted); }
.crumbs a { text-decoration: none; }
.crumbs a:hover { color: var(--text); }
.crumbs [aria-current] { color: var(--text); font-weight: 500; }
.user { display: flex; align-items: center; gap: 8px; padding: 2px; border: 0; background: transparent; cursor: pointer; color: var(--muted); border-radius: var(--r-pill); }
.user .avatar { width: 40px; height: 40px; }

/* content */
.content { padding: 24px 28px 48px; }
.app-h1 { display: flex; align-items: center; gap: 12px; font: 800 32px/1.15 var(--font-head); letter-spacing: -0.025em; }
.app-h1 + .muted, .app-h1 + .meta { margin-top: 4px; font-size: 16px; }
.meta { color: var(--text-2); font-size: 16px; }
.page-top { display: flex; justify-content: space-between; align-items: flex-end; gap: 24px; margin-bottom: 20px; }
.usage { width: min(340px, 40%); }
.usage p { font-size: 16px; margin-bottom: 10px; color: var(--text-2); }

/* dashboard */
.dash-grid { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 20px; align-items: start; }
.project-list { display: grid; gap: 10px; }
.project { display: grid; grid-template-columns: 252px minmax(0, 1fr) 96px; gap: 22px; align-items: center; padding: 8px 16px 8px 8px; border-radius: 12px; }
.project.is-hot { border: 1.5px solid var(--accent-border); background: linear-gradient(90deg, var(--accent-soft-2), var(--accent-soft)); box-shadow: 0 0 30px -10px var(--glow-strong); }
.p-thumb .mini { height: 96px; }
.p-thumb .mini-in { min-height: 0; height: 96px; }
.p-body h2 { font: 700 19px/1.2 var(--font-head); letter-spacing: -0.01em; }
.p-body h2 a { text-decoration: none; }
.p-body h2 a:hover { color: var(--accent-text); }
.p-body .muted { font-size: 15px; margin: 2px 0 10px; }
.p-meta { display: grid; justify-items: center; gap: 8px; font-size: 14.5px; text-align: center; }
.p-meta .avatar { background: var(--surface-3); }
.activity { padding: 18px 20px 22px; border-radius: 12px; }
.activity header { display: flex; justify-content: space-between; align-items: center; padding-bottom: 14px; border-bottom: 1px solid var(--border); }
.activity h2 { font: 800 24px/1.1 var(--font-head); }
.act-tools { display: flex; gap: 14px; color: var(--text-2); }
.timeline { position: relative; list-style: none; padding: 18px 0 0 22px; margin: 0; display: grid; gap: 22px; }
.timeline::before { content: ""; position: absolute; left: 4px; top: 30px; bottom: 30px; width: 1.5px; background: var(--border-strong); }
.timeline li { position: relative; display: flex; gap: 14px; }
.timeline li::before { content: ""; position: absolute; left: -22px; top: 12px; width: 9px; height: 9px; border-radius: 50%; background: var(--accent-border); }
.timeline b { display: block; font: 600 16px/1.3 var(--font-ui); }
.timeline .muted { font-size: 14.5px; }
.t-ico { display: grid; place-items: center; flex: none; width: 34px; height: 34px; border-radius: 9px; }
.t-violet { background: var(--accent-soft-2); color: var(--accent-text); }
.t-green { background: var(--success-soft); color: var(--success-text); border: 1px solid var(--success-border); }
.t-ico .i { width: 18px; height: 18px; stroke-width: 2.2; }

/* wizard */
.wizard { max-width: 1120px; }
.wiz-steps { list-style: none; padding: 0; margin: 22px 0 20px; max-width: 820px; padding-left: 56px; }
.wiz-grid { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 20px; }
.wiz-card { padding: 18px 20px 20px; border-radius: 12px; display: grid; gap: 14px; align-content: start; }
.wiz-card h2 { font: 800 25px/1.1 var(--font-head); letter-spacing: -0.02em; }
.wiz-card > .muted { margin-top: -10px; }
.toggle-row { display: flex; align-items: center; gap: 16px; font-size: 16px; cursor: pointer; }
.agent-card h2 { display: flex; align-items: center; gap: 14px; font-size: 21px; }
.check-list { display: grid; gap: 14px; padding-bottom: 20px; border-bottom: 1px solid var(--border-strong); }
.check-list li { display: flex; align-items: center; gap: 14px; font-size: 16px; }
.check-list .i { flex: none; width: 24px; height: 24px; padding: 4px; border-radius: 50%; background: var(--accent-soft-2); color: var(--accent-text); stroke-width: 3; }
.agent-note { font-size: 16px; }
.wiz-summary { grid-column: 1 / -1; display: grid; grid-template-columns: 1fr 1.2fr 1fr; gap: 18px; }
.sum { padding: 16px 18px; border-radius: 12px; }
.sum h3 { display: flex; align-items: center; gap: 10px; font: 600 16.5px/1 var(--font-ui); margin-bottom: 14px; color: var(--text-2); }
.sum .dot { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; border: 1.5px solid var(--border-strong); font: 600 12.5px/1 var(--font-ui); color: var(--muted); }
.sum.done .dot { background: var(--accent-soft-2); border-color: transparent; color: var(--accent-text); }
.sum .dot .i { width: 14px; height: 14px; stroke-width: 3; }
.sum p { display: flex; justify-content: space-between; font-size: 15.5px; margin-top: 4px; }
.sum .ok { color: var(--success-text); }
.sum dl { display: grid; grid-template-columns: auto 1fr; gap: 10px 16px; margin: 0; font-size: 13.5px; color: var(--muted); align-items: center; }
.sum dd { margin: 0; height: 24px; border: 1px solid var(--border-strong); border-radius: 6px; }
.wiz-foot { grid-column: 1 / -1; display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; padding-top: 16px; border-top: 1px solid var(--border); }
.wiz-foot .form-status { flex-basis: 100%; text-align: right; font-size: 14px; color: var(--accent-text); min-height: 1.2em; margin-top: 8px; }

/* storyboard */
.sb-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; }
.sb-actions { display: grid; justify-items: end; gap: 8px; }
.sb-btns { display: flex; gap: 16px; align-items: center; }
.saved { display: flex; align-items: center; gap: 6px; font-size: 14px; color: var(--text-2); margin-right: 8px; }
.saved .i { width: 16px; height: 16px; }
.scene-nav { display: flex; align-items: center; gap: 12px; margin: 14px 0 18px; }
.scene-nav .label { margin-right: 8px; }
.scene-nav a { display: grid; place-items: center; width: 38px; height: 30px; border-radius: var(--r-pill); border: 1px solid var(--border-strong); text-decoration: none; font: 500 15px/1 var(--font-ui); }
.scene-nav a[aria-current] { background: var(--violet); border-color: var(--violet); color: #fff; }
.sb-grid { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 24px; align-items: start; }
.scenes { display: grid; gap: 16px; }
.scene { padding: 14px 16px 16px; border-radius: 12px; }
.scene header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.scene h2 { font: 700 22px/1.2 var(--font-head); letter-spacing: -0.015em; }
.dur { display: inline-flex; align-items: center; gap: 8px; padding: 5px 12px; border-radius: 8px; border: 1px solid var(--border-strong); font: 500 15px/1 var(--font-ui); }
.dur .i { width: 18px; height: 18px; }
.scene-body { display: grid; grid-template-columns: minmax(0, 1fr) 210px; gap: 14px; align-items: start; }
.shot { position: relative; margin: 0 0 40px; container-type: inline-size; }
.shot .acme-in { min-height: 0; }
.shot .zoom-tag { font-size: max(11px, 1.6cqw); }
.arrow-cursor { position: absolute; width: 5%; height: auto; transform: rotate(80deg); }
.note { position: absolute; left: 0; bottom: -40px; display: flex; align-items: center; gap: 12px; padding: 6px 16px 6px 6px; border-radius: 10px; background: var(--accent-soft); border: 1px solid var(--accent-border); font-size: 15px; }
.note::before { content: ""; position: absolute; left: 40px; top: -7px; width: 12px; height: 12px; background: inherit; border-left: 1px solid var(--accent-border); border-top: 1px solid var(--accent-border); transform: rotate(45deg); background: var(--surface-2); }
.note .avatar { width: 28px; height: 28px; font-size: 12px; }
.narr h3 { font: 700 17px/1 var(--font-ui); margin: 6px 0 12px; }
.narr-box { position: relative; padding: 14px 14px 14px 12px; border-radius: 10px; border: 1px solid var(--border-strong); font-size: 14.5px; line-height: 1.5; color: var(--text-2); }
.narr-box .edit { position: absolute; right: 8px; top: 8px; border: 0; background: transparent; color: var(--muted); cursor: pointer; padding: 4px; border-radius: 6px; }
.narr-box .edit:hover { color: var(--text); }
.narr-box .edit .i { width: 16px; height: 16px; }
.sb-panel { position: sticky; top: 90px; padding: 18px; border-radius: 12px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; }
.sb-panel > *, .sb-panel .field, .opt-row > * { min-width: 0; }
.input select.native { width: 100%; min-width: 0; padding-right: 4px; }
.sb-panel h2 { font: 800 20px/1.1 var(--font-head); display: flex; align-items: center; gap: 10px; }
.sb-panel .label { font-size: 14.5px; }
.voice-row { display: flex; gap: 10px; }
.voice-row .input { flex: 1; min-width: 0; padding-left: 6px; padding-right: 10px; gap: 6px; }
.voice-row .btn { flex: none; padding: 0 10px; }
.voice-row .avatar { width: 32px; height: 32px; }
.voice { cursor: pointer; text-align: left; font: 500 13px/1.25 var(--font-ui); }
.voice-name { flex: 1; min-width: 0; }
.input select.native { height: 40px; }
.sb-panel .input { min-height: 42px; }
.opt-row { display: grid; grid-template-columns: 92px minmax(0, 1fr); align-items: center; gap: 10px; }
.fmt { display: grid; gap: 10px; }
.fmt .check { gap: 12px; font-size: 15px; }
.fmt .check .i { width: 18px; height: 18px; color: var(--text-2); }
.sub-preview { container-type: inline-size; display: grid; place-items: center; height: 110px; border-radius: 10px; border: 1px solid var(--border-strong); background: radial-gradient(70% 90% at 50% 30%, rgba(111,45,227,.35), transparent 70%), var(--player-chrome); }
.sub-preview .caption { font-size: 15px; }
.cm-title { margin-top: 8px; padding-top: 16px; border-top: 1px solid var(--border); }
.comments { display: grid; }
.comments li { display: flex; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--border); font-size: 14.5px; }
.comments li:first-child { padding-top: 0; }
.comments b { display: block; font-size: 15px; }
.comments .muted { font-size: 13px; }
.comments p { margin-top: 6px; }
.sys-ico { flex: none; display: grid; place-items: center; width: 36px; height: 36px; color: var(--violet-400); }
.sys-ico .i { width: 30px; height: 30px; }
.comment-form .input { padding-right: 6px; }
.comment-form .send { display: grid; place-items: center; border: 0; background: transparent; color: var(--violet-400); cursor: pointer; padding: 6px; border-radius: 8px; }
.comment-form .form-status { font-size: 13px; color: var(--accent-text); margin-top: 6px; min-height: 1em; }

/* delivered video */
.vid-head .muted { margin-top: 10px; }
.vid-grid { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 20px; margin-top: 18px; align-items: start; }
.player-card { padding: 16px 16px 12px; border-radius: 14px; }
.stage { border-radius: 12px; overflow: hidden; }
.stage .acme { border-color: var(--border); }
.stage .acme-in { min-height: 0; }
.vp-controls { display: flex; align-items: center; gap: 12px; padding: 14px 4px 10px; color: var(--text); }
.vp-controls .t { font: 500 14px/1 var(--font-ui); white-space: nowrap; color: var(--text-2); display: inline-flex; align-items: center; gap: 4px; }
.ctl { display: grid; place-items: center; width: 34px; height: 34px; border: 0; border-radius: 8px; background: transparent; color: var(--text); cursor: pointer; }
.ctl:hover { background: var(--surface-2); }
.ctl.boxed .i { border-radius: 4px; }
.chapters-track { position: relative; flex: 1; height: 3px; margin: 0 12px; background: var(--violet-400); border-radius: 2px; opacity: 1; }
.chapters-track > b { position: absolute; inset: 0 auto 0 0; background: var(--violet-400); }
.chapters-track > i { position: absolute; top: 50%; width: 10px; height: 10px; border-radius: 50%; background: #fff; transform: translate(-50%, -50%); }
.chapters-track > i.now { width: 18px; height: 18px; background: var(--violet); border: 3px solid #fff; box-shadow: 0 0 0 4px var(--accent-soft-2); }
.chapters-track .tip { position: absolute; bottom: 16px; transform: translateX(-50%); padding: 5px 10px; border-radius: 6px; background: var(--violet); color: #fff; font: 600 13px/1 var(--font-ui); white-space: nowrap; }
.chapters { display: flex; align-items: center; gap: 8px 20px; flex-wrap: wrap; padding: 10px 6px 4px; border-top: 1px solid var(--border); font-size: 13.5px; }
.chapters .label { font-weight: 600; font-size: 14px; }
.chapters a { text-decoration: none; color: var(--text-2); padding: 5px 10px; border-radius: var(--r-pill); }
.chapters a[aria-current] { background: var(--accent-soft-2); border: 1px solid var(--accent-border); color: var(--text); font-weight: 600; }
.versions { margin-top: 24px; }
.ver-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 12px; }
.ver-head h2 { font: 800 24px/1.1 var(--font-head); }
.ver-head a { color: var(--accent-text); font-weight: 500; }
.ver-table { position: relative; overflow-x: auto; border-radius: 12px; }
.ver-table .table td, .ver-table .table th { padding: 10px 16px; font-size: 15px; white-space: nowrap; }
.ver-table tr:first-child > * { border-top: 0; }
.ver-table th[scope="row"] { font-weight: 500; border-top: 1px solid var(--border); }
.vtag { display: inline-grid; place-items: center; padding: 4px 10px; border-radius: 6px; background: var(--accent-soft-2); font-weight: 600; }
.ok { display: inline-flex; align-items: center; gap: 8px; }
.ok .i { color: var(--success-text); stroke-width: 2.6; width: 18px; height: 18px; }
.acts { text-align: right; }
.acts .icon-btn { width: 34px; height: 34px; margin-left: 6px; display: inline-grid; }
.deliver { padding: 10px 12px 16px; border-radius: 14px; display: grid; gap: 10px; }
.deliver h2 { font: 800 19px/1.1 var(--font-head); margin-top: 8px; }
.delivered-banner { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 10px; background: var(--success-soft); border: 1.5px solid var(--success-border); }
.delivered-banner b { display: block; font: 800 20px/1.1 var(--font-head); }
.delivered-banner span { font-size: 14px; color: var(--text-2); }
.ok-dot { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: var(--green); color: #fff; flex: none; }
.ok-dot .i { width: 18px; height: 18px; stroke-width: 3; }
.dl-list li a { display: flex; align-items: center; gap: 14px; padding: 9px 8px; border-top: 1px solid var(--border); text-decoration: none; font-size: 14.5px; }
.dl-list li a:hover { background: var(--surface-2); }
.dl-list li a span { flex: 1; }
.dl-list .i { width: 22px; height: 22px; stroke-width: 1.6; }
.dl-list .dl { color: var(--text-2); }
.code { position: relative; border: 1px solid var(--border-strong); border-radius: 10px; background: var(--player-chrome); padding: 44px 14px 12px; }
.code .copy { position: absolute; right: 8px; top: 8px; --btn-h: 28px; padding: 0 10px; font-size: 13px; }
.code pre { margin: 0; white-space: pre-wrap; word-break: break-all; font: 13.5px/1.45 var(--font-mono); }
.code .tk, .code .at { color: #d85fd0; }
.code .st { color: var(--accent-text); }
.share { min-height: 42px; font-size: 13.5px; gap: 10px; }
.share .url { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.auto-rr { display: flex; align-items: center; gap: 12px; padding: 14px; margin-top: 8px; border-radius: 10px; border: 1.5px solid var(--accent-border); background: var(--accent-soft); cursor: pointer; }
.auto-rr .rr { width: 26px; height: 26px; color: var(--text-2); }
.auto-rr > span:nth-child(2) { flex: 1; }
.auto-rr b { display: block; font-size: 15.5px; }
.auto-rr small { font-size: 13px; color: var(--text-2); }

/* QA console */
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin: 16px 0 18px; }
.kpi { display: flex; align-items: center; gap: 20px; padding: 16px 22px; border-radius: 12px; }
.kpi .i { width: 34px; height: 34px; color: var(--accent-text); stroke-width: 1.5; }
.kpi span { font-size: 14.5px; color: var(--text-2); }
.kpi b { display: block; font: 800 24px/1.15 var(--font-head); }
.qa-grid { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 16px; align-items: start; }
.queue { border-radius: 12px; overflow: hidden; min-height: 540px; }
.queue header { display: flex; justify-content: space-between; align-items: center; padding: 14px 16px; }
.queue h2 { display: flex; align-items: center; gap: 12px; font: 800 22px/1 var(--font-head); }
.q-tools { display: flex; gap: 10px; }
.input-sm { min-height: 40px; padding: 0 12px; }
.input-sm select.native { height: 38px; font-size: 14px; min-width: 120px; }
.q-scroll { overflow-x: auto; position: relative; }
.q-table { min-width: 640px; font-size: 14.5px; }
.q-table th { font-size: 14px; font-weight: 500; color: var(--text-2); padding: 10px 14px; border-top: 1px solid var(--border); background: var(--surface-2); }
.q-table td { padding: 12px 14px; }
.q-table tr.sel td { background: var(--accent-soft); }
.q-table tr.sel td:first-child { box-shadow: inset 4px 0 0 var(--violet-400); }
.q-table .avatar { width: 32px; height: 32px; font-size: 12px; }
.dot-live { width: 8px; height: 8px; border-radius: 50%; background: #a78bfa; }
.qa-panel { padding: 14px 14px 16px; border-radius: 12px; display: grid; gap: 10px; }
.qa-panel header { display: flex; justify-content: space-between; align-items: center; }
.qa-panel h2 { font: 800 22px/1 var(--font-head); }
.qa-client { font: 700 17px/1.2 var(--font-ui); margin-top: 2px; }
.qa-panel > .muted { margin-top: -8px; }
.qa-player { border: 1px solid var(--border-strong); border-radius: 10px; overflow: hidden; }
.qa-player .acme { border: 0; border-radius: 0; }
.qa-player .acme-in { min-height: 0; }
.qa-player .acme .caption { font-size: 3.4cqw; bottom: .8em; }
.vp-controls.small { padding: 10px 12px; gap: 12px; border-top: 1px solid var(--border); }
.vp-controls.small .i { width: 18px; height: 18px; }
.vp-controls.small .scrub { height: 4px; border-radius: 3px; background: var(--surface-3); position: relative; flex: 1; }
.vp-controls.small .scrub b { position: absolute; inset: 0 auto 0 0; border-radius: inherit; background: var(--violet-400); }
.vp-controls.small .scrub i { position: absolute; top: 50%; width: 12px; height: 12px; border-radius: 50%; background: #fff; transform: translate(-50%, -50%); }
.qa-panel h3 { font: 800 18px/1 var(--font-head); margin-top: 6px; }
.qa-checks { display: grid; gap: 10px; }
.qa-checks .check { font-size: 15px; }
.qa-panel .small { font-size: 14px; margin-bottom: 4px; }

/* responsive */
@media (max-width: 1280px) {
  .shell { grid-template-columns: 220px minmax(0, 1fr); }
  .dash-grid, .sb-grid, .vid-grid, .qa-grid { grid-template-columns: minmax(0, 1fr) 300px; }
  .project { grid-template-columns: 200px minmax(0, 1fr) 84px; gap: 16px; }
  .scene-body { grid-template-columns: 1fr; }
  .shot { margin-bottom: 44px; }
}
@media (max-width: 1024px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; z-index: 50; left: 0; top: 0; width: 280px; transform: translateX(-100%); transition: transform .2s var(--ease); box-shadow: var(--shadow-lg); }
  .side.open { transform: none; }
  .side-toggle { display: inline-grid; }
  .dash-grid, .sb-grid, .vid-grid, .qa-grid, .wiz-grid { grid-template-columns: minmax(0, 1fr); }
  .vid-main, .scenes, .queue { min-width: 0; }
  .sb-panel { position: static; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .wiz-steps { padding-left: 0; }
}
@media (max-width: 640px) {
  .topbar { padding: 0 16px; gap: 10px; height: 64px; }
  .content { padding: 18px 16px 72px; }
  .topbar .btn-primary { padding: 0 12px; font-size: 0; gap: 0; }
  .topbar .btn-primary .i { width: 20px; height: 20px; }
  .search-sm, .topbar .search { width: auto; }
  .topbar-right .search-sm, .topbar-left .search { display: none; }
  .page-top { flex-direction: column; align-items: stretch; }
  .usage { width: 100%; }
  .project { grid-template-columns: 1fr auto; padding: 10px; }
  .p-thumb { grid-column: 1 / -1; }
  .p-thumb .mini, .p-thumb .mini-in { height: 120px; }
  .p-meta { justify-items: end; text-align: right; }
  .app-h1 { font-size: 26px; }
  .wiz-steps .s { font-size: 0; gap: 0; }
  .wiz-steps .s .dot { font-size: 13px; }
  .wiz-steps .current { font-size: 14px; gap: 8px; }
  .wiz-summary { grid-template-columns: 1fr; }
  .sb-head { flex-direction: column; }
  .sb-actions { justify-items: stretch; width: 100%; }
  .sb-btns { flex-direction: column-reverse; align-items: stretch; }
  .scene-nav { flex-wrap: wrap; }
  .scene h2 { font-size: 18px; }
  .vp-controls .q, .vp-controls .ctl:nth-of-type(2) { display: none; }
  .kpis { grid-template-columns: 1fr; }
  .user .i { display: none; }
  .crumbs { white-space: nowrap; overflow: hidden; }
  .crumbs > :not([aria-current]) { display: none; }
  .crumbs [aria-current] { overflow: hidden; text-overflow: ellipsis; }
  .topbar-right { gap: 8px; }
  .ver-head { flex-wrap: wrap; gap: 6px 16px; }
  .chapters-track .tip { display: none; }
}

/* ---------------------------------------------------------------- live cabinet (Phase 4) */
p.ws { cursor: default; }
.logout { margin: 0; }
.flash { display: flex; align-items: center; gap: 10px; padding: 12px 16px; margin-bottom: 18px; border-color: var(--success-border); background: var(--success-soft); color: var(--success-text); font-weight: 600; }
.flash-error { border-color: var(--coral-border); background: var(--coral-soft); color: var(--coral-text); }
.flash .i { width: 18px; height: 18px; flex: none; }
.textarea { width: 100%; min-height: 92px; padding: 12px 14px; border-radius: 9px; border: 1px solid var(--border-strong); background: var(--surface-2); color: var(--text); font-size: 16px; line-height: 1.5; resize: vertical; }
.textarea:focus { outline: none; border-color: var(--accent-border); box-shadow: var(--focus); }
.inline-form { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 0; }
.stack { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; }
/* Grid and flex children default to min-width:auto, so one long unbroken string (a URL, a
   technical error) widened the card past a 390px screen. Let them shrink and wrap instead. */
.stack > *, .wiz-card > *, .sb-grid > *, .wiz-grid > *, .dash-grid > *, .vid-grid > * { min-width: 0; }
.card { max-width: 100%; }
.wiz-card { grid-template-columns: minmax(0, 1fr); }
.notice { display: flex; align-items: flex-start; gap: 10px; margin: 0; padding: 12px 14px; border-radius: 10px; border: 1px solid var(--accent-border); background: var(--accent-soft); color: var(--text); font-size: 14.5px; line-height: 1.45; overflow-wrap: anywhere; }
.notice > span { min-width: 0; }
.notice .i { width: 18px; height: 18px; flex: none; margin-top: 1px; color: var(--accent-text); }
.sb-head + .notice { margin: 14px 0 0; }
.empty { padding: 36px 28px; text-align: center; display: grid; gap: 12px; justify-items: center; }
.empty .i { width: 34px; height: 34px; color: var(--accent-text); }
.shot img { display: block; width: 100%; height: auto; border-radius: 10px; border: 1px solid var(--border); }
.shot-empty { display: grid; place-items: center; min-height: 180px; border-radius: 10px; border: 1px dashed var(--border-strong); color: var(--muted); font-size: 14px; text-align: center; padding: 16px; }
.scene-comments { display: grid; gap: 8px; margin-top: 12px; }
.scene-comments p { margin: 0; font-size: 14px; }
.jobs-list { display: grid; gap: 10px; margin: 0; padding: 0; list-style: none; }
.jobs-list li { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border); font-size: 14.5px; }
.jobs-list li:last-child { border-bottom: 0; }
.jobs-list li > * { min-width: 0; overflow-wrap: anywhere; }
.jobs-list li > .muted:last-child { flex: none; text-align: right; }
.jobs-list li.job-error { padding-top: 0; color: var(--coral-text); }
.jobs-list li.job-error > span { display: flex; gap: 8px; align-items: flex-start; line-height: 1.45; }
.jobs-list li.job-error .i { width: 16px; height: 16px; flex: none; margin-top: 2px; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 8px 18px; margin: 0; font-size: 15px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; overflow-wrap: anywhere; }
.check-row { display: flex; flex-wrap: wrap; gap: 10px 18px; }
.player-card video { display: block; width: 100%; border-radius: 12px; background: #000; }
.danger-zone { margin-top: 28px; }
.btn-danger { color: var(--coral-text); border-color: var(--coral-border); }

/* ---------------------------------------------------------------- UX pass (2026-11-15) */
/* Icon scale: 20px in navigation, 18px inline with body text, 16px inside pills and buttons-sm. */
.side .brand { margin-bottom: 20px; }
.side-new { margin: 0 0 18px; }
.side-new[aria-current] { box-shadow: 0 0 0 3px var(--accent-soft-2); }
.side-nav { margin-top: 0; }
.side-nav a { gap: 12px; padding: 10px 14px; font-size: 15.5px; }
.side-nav a .i { width: 20px; height: 20px; }
.side-more { margin-top: 22px; padding-top: 16px; border-top: 1px solid var(--border); }
.side-label { padding: 0 14px 6px; font: 600 12.5px/1 var(--font-ui); letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.side-nav a .ext { width: 14px; height: 14px; margin-left: auto; color: var(--subtle, var(--muted)); }
.side-bottom { padding-top: 14px; border-top: 1px solid var(--border); }
.account { display: flex; align-items: center; gap: 10px; min-width: 0; }
.account .avatar { flex: none; width: 36px; height: 36px; font-size: 13px; }
.acc-text { display: grid; min-width: 0; flex: 1; line-height: 1.3; }
.acc-text b { font-size: 14.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acc-text span { font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account .icon-btn { flex: none; width: 36px; height: 36px; }
.side-scrim { position: fixed; inset: 0; z-index: 45; background: rgba(12, 10, 24, .45); }
.side-scrim[hidden] { display: none; }
.topbar-title { font: 600 16px/1 var(--font-ui); }
.topbar { height: 64px; }
.sb-panel { top: 82px; }

/* forms */
.opt { margin-left: 6px; font: 500 12.5px/1 var(--font-ui); color: var(--muted); }
.link-btn { display: inline-flex; align-items: center; gap: 6px; padding: 0; border: 0; background: none; color: var(--accent-text); font: inherit; font-weight: 600; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.link-btn.danger { color: var(--coral-text); }
.link-btn .i { width: 16px; height: 16px; }
.hint .i-inline { width: 15px; height: 15px; vertical-align: -2px; margin-right: 6px; color: var(--success-text); }
.two-col { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.more { border: 1px solid var(--border); border-radius: 10px; background: var(--surface); }
.more > summary { display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 8px 14px; cursor: pointer; list-style: none; font: 600 15px/1.3 var(--font-ui); border-radius: 10px; }
.more > summary::-webkit-details-marker { display: none; }
.more > summary:hover { background: var(--surface-2); }
.more > summary:focus-visible { outline: none; box-shadow: var(--focus); }
.more > summary .i { width: 18px; height: 18px; flex: none; color: var(--muted); }
.more > summary .chev { margin-left: auto; transition: transform .15s var(--ease); }
.more[open] > summary .chev { transform: rotate(180deg); }
.more-sum { margin-left: auto; font-weight: 500; font-size: 13.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.more-sum + .chev { margin-left: 8px; }
.more-body { display: grid; gap: 14px; padding: 4px 14px 16px; }
.more .jobs-list.more-body { gap: 0; padding-top: 0; }
button[aria-busy="true"] { opacity: .7; cursor: progress; }
/* the wrapper already draws the focus ring; a second ring on the inner field looked broken */
.input input:focus-visible, .input select:focus-visible { box-shadow: none; }
.hint .i-inline { display: inline-block; }
.sb-panel .more-sum { display: none; }
.p-body { min-width: 0; }
.p-body .pill { white-space: normal; max-width: 100%; }
@media (min-width: 1025px) { .topbar .dash-new { display: none; } }
/* the sticky sidebar is one viewport tall; paint its column so long pages keep the rail */
@media (min-width: 1025px) {
  .shell { background: linear-gradient(to right, var(--bg-soft) 247px, var(--border) 247px 248px, transparent 248px); }
}
@media (min-width: 1025px) and (max-width: 1280px) {
  .shell { background: linear-gradient(to right, var(--bg-soft) 219px, var(--border) 219px 220px, transparent 220px); }
}

/* wizard */
.wiz-steps { padding-left: 0; max-width: 520px; margin: 18px 0 20px; }
.wiz-card h2 { font-size: 23px; }
.wiz-card > .muted { margin-top: -6px; }
.wiz-card .flash { margin: 0; }
.wiz-recap { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-radius: 10px; background: var(--surface-2); font-size: 14.5px; min-width: 0; }
.wiz-recap .i { width: 18px; height: 18px; flex: none; color: var(--muted); }
.wiz-recap > span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wiz-recap a { flex: none; font-weight: 600; color: var(--accent-text); }
.agent-card h2 { font-size: 19px; }
.next-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 16px; }
.next-list li { display: flex; gap: 12px; }
.next-list .n, .onboard-steps .n, .auth-steps .n { display: grid; place-items: center; flex: none; width: 28px; height: 28px; border-radius: 50%; background: var(--accent-soft-2); color: var(--accent-text); font: 700 13.5px/1 var(--font-ui); }
.next-list b { display: block; font-size: 15.5px; }
.next-list span:not(.n) { font-size: 14px; color: var(--muted); }
.step-of { font-size: 14.5px; }

/* project page */
.sb-head { margin-bottom: 18px; }
.head-text { display: grid; gap: 8px; justify-items: start; min-width: 0; }
.head-text .meta a { text-decoration: none; }
.head-text .meta a:hover { text-decoration: underline; }
.pill-approval { background: var(--accent-soft-2); color: var(--accent-text); border-color: var(--accent-border); font-weight: 600; white-space: nowrap; max-width: none; padding: 4px 12px; }
.phases { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.ph { position: relative; display: grid; justify-items: center; gap: 8px; text-align: center; font: 500 14.5px/1.2 var(--font-ui); color: var(--muted); }
.ph::before { content: ""; position: absolute; top: 16px; left: calc(-50% + 22px); right: calc(50% + 22px); height: 2px; border-radius: 2px; background: var(--border-strong); }
.ph:first-child::before { display: none; }
.ph-done::before, .ph-active::before, .ph-action::before, .ph-failed::before { background: var(--violet-400); }
.ph-dot { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; border: 1.5px solid var(--border-strong); background: var(--surface); font: 600 14px/1 var(--font-ui); }
.ph-dot .i { width: 18px; height: 18px; stroke-width: 2.4; }
.ph-done { color: var(--text); }
.ph-done .ph-dot { background: var(--accent-soft-2); border-color: transparent; color: var(--accent-text); }
.ph-active, .ph-action, .ph-failed { color: var(--text); font-weight: 600; }
.ph-active .ph-dot { border-color: var(--violet-400); color: var(--accent-text); }
.ph-active .ph-dot .i { animation: spin 1.6s linear infinite; }
.ph-action .ph-dot { background: var(--violet); border-color: var(--violet); color: #fff; box-shadow: 0 0 0 4px var(--accent-soft); }
.ph-failed .ph-dot { background: var(--coral-soft); border-color: var(--coral-border); color: var(--coral-text); }
.headline { font-size: 16px; line-height: 1.5; padding-top: 4px; }
.notice-warn { border-color: var(--warn-border); background: var(--warn-soft); }
.notice-warn .i { color: var(--warn-text); }
.notice-error { border-color: var(--coral-border); background: var(--coral-soft); }
.notice-error .i { color: var(--coral-text); }
.notice a { font-weight: 600; color: var(--accent-text); }
.sb-panel .more > summary { font-size: 14.5px; }
.danger-zone { margin-top: 6px; padding-top: 14px; border-top: 1px solid var(--border); }

/* dashboard */
.project { grid-template-columns: 168px minmax(0, 1fr) auto; gap: 18px; padding: 10px 18px 10px 10px; }
.p-thumb { position: relative; display: block; aspect-ratio: 16 / 9; border-radius: 8px; overflow: hidden; border: 1px solid var(--border); background: var(--surface-2); }
.p-thumb img { display: block; width: 100%; height: 100%; object-fit: cover; object-position: top; }
.p-thumb-empty { display: grid; place-items: center; width: 100%; height: 100%; color: var(--muted); }
.p-thumb-empty .i { width: 28px; height: 28px; stroke-width: 1.5; }
.p-play { position: absolute; inset: 0; display: grid; place-items: center; }
.p-play .i { width: 34px; height: 34px; padding: 9px; border-radius: 50%; background: rgba(12, 10, 24, .6); color: #fff; }
.p-body h2 { font-size: 18px; }
.p-body .muted { font-size: 14px; margin: 2px 0 8px; }
.p-cta { white-space: nowrap; }
.p-cta .i { width: 16px; height: 16px; }
.activity h2 { font-size: 20px; }
.t-red { background: var(--coral-soft); color: var(--coral-text); border: 1px solid var(--coral-border); }
.timeline b { font-size: 15px; }
.empty .i { width: auto; height: auto; color: inherit; }
.empty .btn .i { width: 1.15em; height: 1.15em; }
.onboard { max-width: 760px; margin: 24px auto 0; padding: 40px 32px; gap: 16px; }
.onboard .app-h1 { justify-content: center; }
.empty-ico { display: grid; place-items: center; width: 60px; height: 60px; border-radius: 16px; background: var(--accent-soft-2); color: var(--accent-text); }
.empty-ico .i { width: 30px; height: 30px; }
.onboard-steps { list-style: none; margin: 8px 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; width: 100%; text-align: left; }
.onboard-steps li { display: grid; gap: 6px; align-content: start; padding: 14px; border-radius: 12px; background: var(--surface-2); }
.onboard-steps b { font-size: 15px; }
.onboard-steps span:not(.n) { font-size: 14px; color: var(--muted); }

/* storyboard */
.scene-body { grid-template-columns: minmax(0, 1.5fr) minmax(240px, 1fr); }
.shot { margin-bottom: 0; }
.sb-actions .hint { max-width: 300px; text-align: right; }

@media (max-width: 1280px) {
  .project { grid-template-columns: 140px minmax(0, 1fr) auto; }
  .scene-body { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .topbar { height: 60px; }
  .topbar .btn-primary .btn-text { display: none; }
  .two-col, .onboard-steps { grid-template-columns: 1fr; }
  .project { grid-template-columns: 96px minmax(0, 1fr); padding: 10px; gap: 12px; align-items: start; }
  .p-thumb { grid-column: auto; }
  .p-cta { grid-column: 1 / -1; justify-content: center; }
  .sb-btns { flex-direction: column-reverse; align-items: stretch; gap: 10px; }
  .sb-btns .inline-form .btn { width: 100%; }
  .sb-actions .hint { text-align: left; max-width: none; }
  .phases { gap: 2px; }
  .ph { font-size: 12.5px; }
  .ph::before { left: calc(-50% + 20px); right: calc(50% + 20px); }
  .wiz-foot { gap: 10px; }
  .wiz-foot .step-of { display: none; }
  .wiz-steps .s, .wiz-steps .current { font-size: 14px; gap: 8px; }
  .wiz-foot .btn-primary { flex: 1; }
  .onboard { padding: 28px 18px; margin-top: 8px; }
  .more-sum { display: none; }
}

/* ---------------------------------------------------------------- phone pass (iPhone review, 2026-11-15) */
/* dvh: on iOS Safari 100vh is taller than the visible area, which pushed the account row and
   the bottom of the menu under the browser toolbar */
.shell { min-height: 100vh; min-height: 100dvh; }
.side { height: 100vh; height: 100dvh; }
.side-brand { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 20px; }
.side-brand .brand { margin: 0 0 0 8px; }
.side-close { display: none; }
:root.nav-locked, :root.nav-locked body { overflow: hidden; }
/* phones show the whole email in the menu; the desktop rail keeps one line + tooltip */
@media (max-width: 1024px) { .acc-text span { white-space: normal; overflow-wrap: anywhere; } }

/* Delivery column: a grid item defaults to min-width:auto, so the one-line share URL stretched
   the card past its column and the page grew to ~500px on a phone (1550px on desktop). */
.deliver { grid-template-columns: minmax(0, 1fr); }
.deliver > * { min-width: 0; }
.dl-list li a { min-height: 44px; }
.dl-list li a span { min-width: 0; overflow-wrap: anywhere; }

/* version history as a list that wraps instead of a four-column nowrap table */
.ver-list { list-style: none; margin: 0; padding: 0; overflow: hidden; }
.ver-list li { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; padding: 12px 16px; border-top: 1px solid var(--border); font-size: 15px; }
.ver-list li:first-child { border-top: 0; }
.ver-list .vtag { flex: none; min-width: 44px; }
/* show the whole share link (wrapped) instead of cutting it with an ellipsis */
.share { padding-top: 8px; padding-bottom: 8px; }
.share .url { white-space: normal; overflow: visible; overflow-wrap: anywhere; line-height: 1.4; }
.ver-text { flex: 1; min-width: 0; display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 18px; }
.ver-text b { font-weight: 500; color: var(--text); min-width: 9em; }
.ver-text .muted { font-size: 14.5px; }
.ver-list .ok { margin-left: auto; color: var(--success-text); font-weight: 500; }
.ver-head h2 { min-width: 0; }

/* storyboard: the comment field sat flush against the Save button */
.narr .comment-form { margin-top: 12px; }
.scene header { gap: 12px; }
.scene header h2 { min-width: 0; overflow-wrap: anywhere; }
.scene .dur { flex: none; }
.shot figcaption { margin-top: 8px; font-size: 14px; overflow-wrap: anywhere; }

@media (pointer: coarse), (max-width: 640px) {
  .account .icon-btn { width: 44px; height: 44px; }
  .scene-nav a { width: 44px; height: 44px; }
  .comment-form .send { min-width: 44px; min-height: 44px; margin-right: -8px; }
  .link-btn { min-height: 44px; }
  .wiz-recap a, .wiz-steps .s a { display: inline-flex; align-items: center; min-height: 44px; }
  .code { padding-top: 60px; }
  .code .copy { --btn-h: 44px; }
}

@media (max-width: 1024px) {
  /* off-canvas menu: hidden from taps and the keyboard while closed, inside the safe area when open */
  .side {
    visibility: hidden;
    transition: transform .2s var(--ease), visibility 0s linear .2s;
    padding-top: calc(16px + env(safe-area-inset-top));
    padding-bottom: calc(20px + env(safe-area-inset-bottom));
    padding-left: calc(16px + env(safe-area-inset-left));
    overscroll-behavior: contain;
  }
  .side.open { visibility: visible; transition: transform .2s var(--ease); }
  .side-close { display: inline-grid; }
  .side .brand { height: 44px; }
  /* the main action goes right under the form, the explainer card after it */
  .wiz-foot { order: 1; }
  .agent-card { order: 2; }
}

@media (max-width: 640px) {
  .ver-list li { padding: 12px 14px; }
  .ver-text { flex-direction: column; gap: 2px; }
  .vid-head .meta, .head-text .meta { overflow-wrap: anywhere; }
}
