@layer workbench-structure, workbench-interface;

@layer workbench-structure {
:root {
  color-scheme: light;
  font-family: "Segoe UI", "Microsoft YaHei UI", "PingFang SC", "Noto Sans CJK SC", system-ui, sans-serif;
  color: #281a34;
  background: #f9f6fb;
  --text: #281a34;
  --muted: #61556c;
  --surface: #fff;
  --line: #e8e0ee;
  --strong-line: #bdb0ca;
  --accent: #6034d6;
  --accent-deep: #4b25ad;
  --wash: #f2ecfb;
  --sun: #fff3e6;
  --radius: 18px;
  --gutter: clamp(14px, 4vw, 42px);
  --panel-padding: clamp(17px, 3vw, 30px);
  font-synthesis: none;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { min-width: 0; min-height: 100vh; margin: 0; }
body:has(#auth-view:not([hidden])) { background: linear-gradient(138deg, var(--sun) 0, #faf7fd 51%, #eee6fb 100%); }
h1, h2, p, ol, ul, dl { margin: 0; }
h1, h2 { line-height: 1.24; letter-spacing: -.025em; }
h1 { font-size: clamp(1.85rem, 4vw, 2.6rem); }
h2 { font-size: clamp(1.22rem, 3vw, 1.45rem); }
p { line-height: 1.6; }
a { color: inherit; }
button, input, textarea, select { font: inherit; }
button, a { touch-action: manipulation; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: .55; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.skip-link { position: fixed; z-index: 60; left: var(--gutter); top: -100px; }
.skip-link:focus { top: 10px; padding: 12px; color: var(--text); background: var(--surface); }
.frame { width: min(1320px, 100%); margin-inline: auto; padding-inline: var(--gutter); }
.muted { color: var(--muted); }

.site-header { color: var(--text); background: var(--surface); border-bottom: 1px solid var(--line); }
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 14px; min-height: 75px; padding-block: 12px; }
.brand { display: flex; align-items: center; gap: 11px; flex: 0 0 auto; }
.brand strong { display: block; font-size: 1.21rem; letter-spacing: .035em; }
.brand small { display: block; margin-top: 2px; color: var(--muted); font-size: .76rem; letter-spacing: .055em; }
.brand-mark { position: relative; display: block; width: 43px; height: 43px; overflow: hidden; border-radius: 10px; }
.brand-mark img { position: absolute; width: 162.5%; height: 162.5%; top: -13.5%; left: -31%; }
.account { display: flex; min-width: 0; align-items: center; justify-content: end; gap: 12px; }
.account-name { max-width: 28ch; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .93rem; }

main.frame { padding-block: clamp(23px, 4vw, 52px) 52px; }
main > .notice { margin-bottom: 16px; }
.panel { min-width: 0; padding: var(--panel-padding); border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: 0 5px 16px #2a153c08; }
.loading-panel { width: min(100%, 600px); }
.loading-panel p, .loading-panel .button { margin-top: 13px; }

.auth-layout { display: grid; grid-template-areas: "poster login"; grid-template-columns: minmax(0, .94fr) minmax(0, 1fr); align-items: center; gap: clamp(18px, 4vw, 48px); width: min(100%, 1000px); margin-inline: auto; }
.auth-poster { grid-area: poster; margin: 0; overflow: hidden; border: 1px solid #f0dbe6; border-radius: var(--radius); background: var(--sun); box-shadow: 0 17px 40px #321b4a12; }
.auth-poster img { display: block; width: 100%; height: auto; }
.auth-panel { grid-area: login; padding: clamp(22px, 4vw, 47px); box-shadow: 0 12px 32px #321b4a0d; }
.auth-panel h1 { font-size: clamp(1.8rem, 4vw, 2.5rem); }
.auth-panel > p { margin-block: 7px 21px; }
.segmented { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; margin-bottom: 21px; padding: 4px; background: var(--wash); border-radius: 11px; }
.segmented button { padding: 9px 8px; border: 1px solid transparent; border-radius: 8px; color: var(--accent-deep); background: transparent; font-weight: 650; }
.segmented button[aria-pressed="true"] { border-color: var(--line); color: var(--text); background: var(--surface); box-shadow: 0 1px 3px #2a153c1a; }

.page-heading { display: flex; align-items: end; justify-content: space-between; gap: 22px; margin-bottom: 24px; }
.page-heading p { margin-top: 8px; }
#student-view :is(h2, h3)[tabindex="-1"] { scroll-margin-block-start: 16px; }
#workspace-jump-message { margin: 0 0 12px; }
.wallet { display: flex; align-items: stretch; flex: 0 1 auto; min-width: 0; border: 1px solid var(--line); border-radius: 15px; background: var(--wash); }
.wallet > div { min-width: 105px; padding: 10px 16px; }
.wallet > div + div { border-inline-start: 1px solid var(--line); }
.wallet dt { color: var(--muted); font-size: .79rem; white-space: nowrap; }
.wallet dd { margin: 4px 0 0; overflow-wrap: anywhere; color: var(--accent-deep); font-size: clamp(1.08rem, 3vw, 1.5rem); font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.2; }
.workspace-grid { display: grid; align-items: start; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: clamp(13px, 2vw, 24px); }
.admin-grid { grid-template-columns: minmax(0, 1.8fr) minmax(0, 1fr); }
.panel-heading { margin-bottom: 19px; }
.panel-heading p { margin-top: 6px; font-size: .9rem; }
.heading-row { display: flex; align-items: start; justify-content: space-between; gap: 12px; }
.heading-row .button { flex: 0 0 auto; }

.form-stack { display: grid; gap: 16px; }
fieldset { min-inline-size: 0; margin: 0; padding: 0; border: 0; }
.field-grid { display: grid; grid-template-columns: minmax(0, .86fr) minmax(0, .9fr) minmax(0, 1.27fr); gap: 10px; }
.field { display: grid; align-content: start; gap: 7px; min-width: 0; font-size: .92rem; font-weight: 650; }
.field small { font-size: .8rem; font-weight: 400; }
.field :is(input, select, textarea) { width: 100%; min-width: 0; min-height: 44px; padding: 10px 12px; border: 1px solid var(--strong-line); border-radius: 9px; color: var(--text); background: var(--surface); font-size: 1rem; font-weight: 400; }
.field :is(input, textarea)::placeholder { color: var(--muted); }
.field textarea { resize: vertical; line-height: 1.65; }
.field select { padding-right: 6px; }
.field :is(input, select, textarea):disabled { color: var(--muted); background: #f8f5fa; }

.button { display: inline-flex; align-items: center; justify-content: center; min-height: 42px; padding: 8px 14px; border: 1px solid transparent; border-radius: 9px; line-height: 1.25; text-align: center; text-decoration: none; font-weight: 650; }
.button-primary { color: #fff; background: var(--accent); }
.button-primary:hover:not(:disabled) { background: var(--accent-deep); }
.button-secondary { border-color: var(--strong-line); color: var(--accent-deep); background: var(--surface); }
.button-secondary:hover:not(:disabled) { background: var(--wash); }
.button-header { border-color: var(--strong-line); color: var(--accent-deep); background: transparent; }
.button-header:hover:not(:disabled) { background: var(--wash); }
.button-small { min-height: 36px; padding: 6px 11px; white-space: nowrap; font-size: .84rem; }

.notice { padding: 10px 12px; border: 1px solid transparent; border-radius: 9px; overflow-wrap: anywhere; font-size: .9rem; }
.notice-error { border-color: #e8c9c2; color: #842b21; background: #fff2ef; }
.notice-warning { border-color: #e4d4aa; color: #704e14; background: #fff8e7; }
.notice-success { border-color: #cfdfc8; color: #2c5734; background: #f1f8ee; }
#student-provider { margin-bottom: 16px; }
.quote-card { display: grid; gap: 12px; margin-top: 16px; padding: 13px; border: 1px solid var(--line); border-radius: 12px; background: var(--wash); }
.quote-summary { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 5px 12px; }
.quote-summary > div { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 9px; }
.quote-summary strong { color: var(--accent-deep); font-size: 1.45rem; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.quote-summary .muted { font-size: .86rem; }

.empty-state { padding: 22px 12px; border: 1px dashed var(--strong-line); border-radius: 12px; color: var(--muted); background: #faf8fc; text-align: center; font-size: .9rem; }
.jobs-panel > .notice, .roster-panel > .notice, .promoter-panel > .notice { margin-bottom: 10px; }
.jobs-list { display: grid; gap: 12px; padding: 0; list-style: none; }
.job { display: grid; gap: 8px; min-width: 0; padding: 14px; border: 1px solid var(--line); border-radius: 12px; overflow-wrap: anywhere; }
.job-top { display: flex; align-items: center; flex-wrap: wrap; justify-content: space-between; gap: 5px 8px; }
.job-top time, .job-meta, .job-message { font-size: .82rem; }
.job-prompt { max-height: 9em; overflow: auto; white-space: pre-wrap; }
.job-message { color: var(--muted); }
.job-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.badge, .provider-pill { display: inline-block; width: fit-content; padding: 4px 8px; border-radius: 7px; font-size: .8rem; font-weight: 700; line-height: 1.4; }
.badge-active { color: #244c6a; background: #e8f1f7; }
.badge-success, .provider-pill { color: #2c5734; background: #f1f8ee; }
.badge-warning, .provider-unavailable { color: #654a1c; background: #fcf2da; }
.badge-error { color: #832f25; background: #f9e7e3; }
.provider-pill { margin: 0; border: 1px solid currentColor; white-space: nowrap; }

.table-scroll { max-width: 100%; overflow-x: auto; border: 1px solid var(--line); border-radius: 10px; }
table { width: 100%; border-collapse: collapse; text-align: left; font-size: .88rem; }
thead { color: var(--muted); background: #f8f5fa; }
thead th, td { white-space: nowrap; }
th, td { padding: 10px; }
tbody tr + tr { border-top: 1px solid var(--line); }
.student-name { max-width: 24ch; overflow-wrap: anywhere; }
.numeric { font-variant-numeric: tabular-nums; }
#referral-message { margin-top: 8px; }
.roster-filter { max-width: 23rem; margin-bottom: 12px; }
.promoter-name { max-width: 24ch; white-space: normal; overflow-wrap: anywhere; }
.promoter-panel { grid-column: 1 / -1; }
.promoter-form { grid-template-columns: minmax(0, 24rem) auto; align-items: end; justify-content: start; margin-bottom: 16px; }
.promoter-form > .notice { grid-column: 1 / -1; }
.promoter-list { display: grid; gap: 10px; padding: 0; list-style: none; }
.promoter-item { display: grid; grid-template-columns: minmax(9rem, 1fr) minmax(0, 2fr); align-items: center; gap: 12px; padding: 12px; border: 1px solid var(--line); border-radius: 10px; }
.promoter-details { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; overflow-wrap: anywhere; }
.promoter-details .muted { font-size: .85rem; }
.promoter-link { display: flex; align-items: center; gap: 8px; }
.promoter-link .field { flex: 1; }
.promoter-link input { min-height: 36px; padding: 6px 10px; font-size: .88rem; }

.creator-accounts-panel { margin-top: clamp(13px, 2vw, 24px); }
.creator-account-form { display: grid; grid-template-columns: minmax(0, 32rem) auto; align-items: end; justify-content: start; gap: 12px; margin-bottom: 16px; }
.creator-account-fields { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); gap: 12px; }
.creator-account-form > .notice { grid-column: 1 / -1; }
#creator-accounts-list-message { margin-bottom: 10px; }
.creator-accounts-list { display: grid; gap: 8px; padding: 0; list-style: none; }
.creator-account-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 12px; min-width: 0; padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px; overflow-wrap: anywhere; }
.creator-account-platform { color: var(--accent-deep); background: var(--wash); }

.edit-panel { margin-top: clamp(13px, 2vw, 24px); }
.edit-panel > .edit-notice { margin-bottom: 16px; }
.edit-input-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(130px, 190px); gap: 12px; }
.edit-input-row input[type="file"] { padding: 6px; }
.edit-input-row input[type="file"]::file-selector-button { margin-inline-end: 8px; padding: 5px 8px; border: 1px solid var(--line); border-radius: 6px; color: var(--accent-deep); background: var(--wash); font: inherit; cursor: pointer; }
.edit-disclosure { font-size: .86rem; }
.edit-submit { justify-self: start; }
.edit-plan { margin-top: 18px; padding-top: 18px; border-top: 1px solid var(--line); }
.edit-plan-heading { align-items: center; margin-bottom: 12px; }
.edit-plan-heading h3 { margin: 0; }
.edit-segments { display: grid; gap: 8px; margin: 0; padding-inline-start: 30px; }
.edit-segments li { padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; overflow-wrap: anywhere; }
.edit-segments li::marker { color: var(--accent-deep); font-weight: 650; }
.edit-time { display: inline-block; margin-inline-start: 10px; font-size: .83rem; font-variant-numeric: tabular-nums; }
.edit-output { display: grid; justify-items: start; gap: 12px; margin-top: 14px; }
.edit-output video { display: block; width: min(100%, 680px); max-height: 66vh; border-radius: 10px; background: var(--text); }

.story-panel { margin-bottom: clamp(13px, 2vw, 24px); }
.story-project-form { display: grid; grid-template-columns: minmax(0, 28rem) auto; align-items: end; justify-content: start; gap: 10px; }
.story-project-picker { width: min(100%, 28rem); margin-top: 13px; }
.story-panel > .notice { margin-top: 10px; }
.story-workspace { display: grid; gap: 16px; margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); }
.story-stages { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 7px; }
.story-stage-tab { min-height: 48px; padding: 7px; border: 1px solid var(--line); border-radius: 9px; color: var(--text); background: var(--surface); line-height: 1.35; overflow-wrap: anywhere; }
.story-stage-tab[aria-pressed="true"] { border-color: var(--accent); color: var(--accent-deep); background: var(--wash); font-weight: 700; }
.story-stage-version { display: block; margin-top: 3px; color: var(--muted); font-size: .75rem; }
.story-stage-body { display: grid; gap: 12px; min-width: 0; }
.story-stage-body h3, .story-draft h4 { margin: 0; }
.story-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.story-draft { display: grid; gap: 13px; min-width: 0; padding: 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--wash); }
#story-draft-meta { font-size: .82rem; }
.story-draft-sections, .story-draft-section { display: grid; gap: 9px; min-width: 0; }
.story-draft-section { padding: 11px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); }

.studio-workspace { display: grid; gap: 14px; padding-top: 18px; border-top: 1px solid var(--line); }
.studio-workspace h3, .studio-workspace h4, .studio-workspace h5 { margin: 0; }
.studio-workspace > .heading-row { align-items: center; }
.studio-grid, .studio-review-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.studio-card { display: grid; align-content: start; gap: 12px; min-width: 0; padding: 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.studio-grid > .studio-card { background: #fcfafd; }
.studio-submit { justify-self: start; }
.studio-disclosure { font-size: .84rem; }
.studio-file { overflow-wrap: anywhere; }
.studio-file input[type="file"] { padding: 6px; }
.studio-file input[type="file"]::file-selector-button { margin-inline-end: 8px; padding: 5px 8px; border: 1px solid var(--line); border-radius: 6px; color: var(--accent-deep); background: var(--wash); font: inherit; cursor: pointer; }
.studio-preview video, .studio-report video { display: block; width: min(100%, 560px); max-height: 54vh; border-radius: 9px; background: var(--text); }
.studio-records { display: grid; gap: 12px; }
.studio-media-list, .studio-reports, .studio-findings { display: grid; gap: 10px; padding: 0; list-style: none; }
.studio-media-list:empty, .studio-reports:empty { display: none; }
.studio-media-list { grid-template-columns: repeat(auto-fit, minmax(min(100%, 215px), 1fr)); }
.studio-media-card { display: grid; align-content: start; justify-items: start; gap: 7px; min-width: 0; padding: 11px; border: 1px solid var(--line); border-radius: 10px; overflow-wrap: anywhere; }
.studio-media-card audio { width: 100%; max-width: 360px; }
.studio-image { display: block; width: 100%; max-width: 290px; overflow: hidden; border: 1px solid var(--line); border-radius: 8px; background: var(--wash); }
.studio-image img { display: block; width: 100%; max-height: 16rem; aspect-ratio: 4 / 5; object-fit: contain; transition: transform .15s ease; }
.studio-image:hover img { transform: scale(1.025); }
.studio-time { font-size: .82rem; font-variant-numeric: tabular-nums; }
.studio-report { grid-template-columns: minmax(0, 1fr) auto; gap: 15px; overflow-wrap: anywhere; }
.studio-report-detail, .studio-report-heading { display: grid; justify-items: start; gap: 7px; min-width: 0; }
.studio-report-heading h5 { font-size: 1rem; }
.studio-findings { width: 100%; }
.studio-findings li { min-width: 0; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; }
.studio-findings li p { margin-top: 4px; font-size: .86rem; }
.studio-stamp { display: inline-block; margin-inline-end: 7px; padding: 2px 5px; border: 0; border-radius: 5px; color: var(--accent-deep); background: var(--wash); font-size: .79rem; font-variant-numeric: tabular-nums; }
button.studio-stamp { text-decoration: underline; text-underline-offset: .1em; }
.studio-cover { display: grid; align-content: start; justify-items: start; gap: 7px; width: min(27vw, 225px); margin: 0; }

.feishu-fields-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.feishu-code-row { display: flex; align-items: end; flex-wrap: wrap; gap: 10px; }
.feishu-code-row .field { width: min(100%, 23rem); }
.feishu-cover-preview { display: block; max-width: min(100%, 13rem); max-height: 13rem; border: 1px solid var(--line); border-radius: 9px; }
.feishu-auto { display: grid; justify-items: start; gap: 8px; padding-top: 15px; border-top: 1px solid var(--line); }
.feishu-checkbox { display: flex; align-items: start; gap: 8px; font-size: .9rem; font-weight: 650; }
.feishu-checkbox input { width: 17px; height: 17px; margin: 0; accent-color: var(--accent); }
.feishu-versions { display: grid; gap: 8px; padding: 0; list-style: none; }
.feishu-versions:empty { display: none; }
.feishu-version-copy, .feishu-version-feedback { white-space: pre-wrap; }

@media (max-width: 860px) {
  .header-inner { flex-wrap: wrap; }
  .workspace-grid { grid-template-columns: minmax(0, 1fr); }
  .story-stages { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 650px) {
  .header-inner { min-height: 65px; }
  .auth-layout { grid-template-areas: "login" "poster"; grid-template-columns: minmax(0, 1fr); width: min(100%, 480px); }
  .page-heading { align-items: start; flex-direction: column; gap: 14px; }
  .wallet { width: 100%; }
  .wallet > div { flex: 1; }
  .promoter-item { grid-template-columns: minmax(0, 1fr); }
  .creator-account-form { grid-template-columns: minmax(0, 1fr); justify-content: stretch; }
  .edit-input-row { grid-template-columns: minmax(0, 1fr); }
  .story-project-form { grid-template-columns: minmax(0, 1fr); justify-content: stretch; }
  .story-project-form .button { justify-self: start; }
  .studio-grid, .studio-review-grid, .studio-report, .feishu-fields-grid { grid-template-columns: minmax(0, 1fr); }
  .studio-cover { width: min(100%, 225px); }
}

@media (max-width: 340px) {
  .field-grid { grid-template-columns: minmax(0, 1fr); }
  .promoter-form { grid-template-columns: minmax(0, 1fr); justify-content: stretch; }
  .creator-account-fields { grid-template-columns: minmax(0, 1fr); }
  .account { gap: 6px; }
  .account-name { font-size: .79rem; }
  .studio-workspace > .heading-row { align-items: start; flex-direction: column; }
}

/* Shared creation workspace */
:root {
  --workbench-sidebar: #1c152a;
  --workbench-sidebar-edge: #372845;
  --workbench-nav-text: #e1d8ee;
  --workbench-nav-muted: #bdb1cf;
  --workbench-nav-active: #3e2b60;
  --workbench-canvas: #f6f4fa;
  --workbench-ink: #21182f;
  --workbench-violet: #5531c4;
  --workbench-apricot: #ffb571;
  --workbench-menu-width: clamp(207px, 22vw, 248px);
  --workbench-bar-height: 66px;
  --workbench-padding: clamp(20px, 3.15vw, 48px);
}

body:has(.workbench-shell:not([hidden])) {
  background: var(--workbench-canvas);
  color: var(--workbench-ink);
  --accent: var(--workbench-violet);
  --accent-deep: #422496;
  --line: #e8e2ef;
  --radius: 15px;
  --panel-padding: clamp(17px, 2.7vw, 29px);
}

body:has(.workbench-shell:not([hidden])) .site-header {
  position: sticky;
  top: 0;
  z-index: 30;
  border: 0;
  background: linear-gradient(90deg, var(--workbench-sidebar) 0 var(--workbench-menu-width), #fdfcfe var(--workbench-menu-width));
}

body:has(.workbench-shell:not([hidden])) .site-header::after {
  position: absolute;
  inset: auto 0 0 var(--workbench-menu-width);
  height: 1px;
  content: "";
  background: #ebe5f0;
}

body:has(.workbench-shell:not([hidden])) #main {
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 0;
}

.workbench-public { padding-block: clamp(23px, 4vw, 52px) 52px; }
body:has(.workbench-shell:not([hidden])) .workbench-public { display: none; }
.workbench-icon-library { position: absolute; pointer-events: none; }

body:has(.workbench-shell:not([hidden])) #main > .notice {
  position: fixed;
  right: var(--workbench-padding);
  top: calc(var(--workbench-bar-height) + 10px);
  z-index: 35;
  max-width: min(30rem, calc(100vw - 36px));
  box-shadow: 0 6px 20px #2618391a;
}

.workbench-topbar-start { display: flex; min-width: 0; align-items: center; gap: 11px; }
body:has(.workbench-shell:not([hidden])) .workbench-topbar {
  display: grid;
  grid-template-columns: calc(var(--workbench-menu-width) - 20px) minmax(0, 1fr) auto;
  gap: 0;
  align-items: center;
  width: 100%;
  min-height: var(--workbench-bar-height);
  padding: 0 var(--workbench-padding) 0 20px;
}
body:has(.workbench-shell:not([hidden])) .workbench-topbar .brand { color: #fff9ff; gap: 10px; }
body:has(.workbench-shell:not([hidden])) .workbench-topbar .brand small { color: #d3c5df; letter-spacing: .01em; }
body:has(.workbench-shell:not([hidden])) .workbench-topbar .brand strong { letter-spacing: .015em; font-size: 1.08rem; }
body:has(.workbench-shell:not([hidden])) .workbench-topbar .brand-mark { width: 39px; height: 39px; flex: 0 0 39px; }
.workbench-topbar .account { gap: 13px; }
.workbench-topbar .account .button { min-height: 35px; padding: 6px 12px; border-color: #e7e0ee; font-size: .83rem; }
.workbench-topbar-context {
  display: inline-flex;
  align-items: center;
  justify-self: start;
  gap: 8px;
  max-width: min(24rem, calc(100% - var(--workbench-padding) - 10px));
  min-height: 36px;
  margin-inline-start: var(--workbench-padding);
  padding: 6px 10px;
  border: 1px solid #e9e2f1;
  border-radius: 8px;
  color: var(--muted);
  background: #fff;
  font-size: .77rem;
  text-decoration: none;
}
.workbench-topbar-context:hover { border-color: #cbb9eb; color: var(--accent-deep); }
.workbench-topbar-context .workbench-icon { width: 16px; height: 16px; color: var(--workbench-violet); }
.workbench-topbar-context > span { white-space: nowrap; }
.workbench-topbar-context strong { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--workbench-ink); font-weight: 680; }
.account-copy { display: grid; justify-items: end; gap: 2px; min-width: 0; }
.account-copy small { color: var(--muted); font-size: .72rem; }
.account-copy .account-name { color: var(--workbench-ink); font-weight: 650; }
.workbench-menu-toggle { display: none; }

.workbench-shell { display: grid; grid-template-columns: var(--workbench-menu-width) minmax(0, 1fr); align-items: start; }
.workbench-sidebar {
  position: sticky;
  top: var(--workbench-bar-height);
  display: flex;
  flex-direction: column;
  min-width: 0;
  height: calc(100vh - var(--workbench-bar-height));
  height: calc(100dvh - var(--workbench-bar-height));
  padding: 12px 12px 14px;
  color: var(--workbench-nav-text);
  background: linear-gradient(166deg, var(--workbench-sidebar) 35%, #251938);
  border-inline-end: 1px solid var(--workbench-sidebar-edge);
}

.workbench-nav { display: grid; align-content: start; flex: 1 1 auto; min-height: 0; gap: 11px; overflow: auto; scrollbar-width: thin; scrollbar-color: #685575 transparent; }
.workbench-nav-group { display: grid; gap: 2px; min-width: 0; }
.workbench-nav-label { margin: 3px 10px 4px; color: var(--workbench-nav-muted); font-size: .73rem; font-weight: 650; line-height: 1.45; }
.workbench-nav-link {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 34px;
  width: 100%;
  padding: 7px 10px;
  border: 0;
  border-radius: 8px;
  color: inherit;
  background: transparent;
  font-size: .88rem;
  line-height: 1.35;
  text-decoration: none;
  text-align: start;
}
.workbench-nav-link span { min-width: 0; }
.workbench-nav-link:hover { color: #fff; background: #39294d; }
.workbench-nav-link[aria-current="page"] { color: #fff; background: var(--workbench-nav-active); font-weight: 720; box-shadow: inset 0 0 0 1px #76599c73; }
.workbench-nav-link[aria-current="page"]::before { position: absolute; inset: 7px auto 7px 0; width: 2px; border-radius: 999px; background: var(--workbench-apricot); content: ""; }
.workbench-nav-link[aria-current="page"] .workbench-icon { color: #d8c7fa; }
.workbench-nav-link:focus-visible { outline-color: var(--workbench-apricot); outline-offset: -2px; }
.workbench-icon { display: block; width: 18px; height: 18px; flex: 0 0 auto; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.workbench-sidebar-footer { flex: 0 0 auto; margin-top: 12px; padding-top: 9px; border-top: 1px solid #40314f; }
.workbench-sidebar-footer:empty, .workbench-sidebar-footer:has(> a[hidden]) { display: none; }
.workbench-sidebar-footer .workbench-nav-link { color: #f1e9f9; }
.workbench-backdrop { display: none; }

.workbench-content { display: grid; align-content: start; gap: 16px; min-width: 0; width: 100%; max-width: 1480px; min-height: calc(100dvh - var(--workbench-bar-height)); margin-inline: auto; padding: 27px var(--workbench-padding) 52px; }
.workbench-content > .panel, .workbench-content .workspace-grid > .panel { margin-block: 0; }
.workbench-heading { display: grid; gap: 6px; margin-bottom: 6px; }
.workbench-heading h1 { color: var(--workbench-ink); font-size: clamp(1.65rem, 2.9vw, 2.26rem); font-weight: 750; }
.workbench-heading p { color: var(--muted); font-size: .91rem; }
.workbench-content > .panel { box-shadow: 0 4px 18px #30164306; }
.workbench-content .panel-heading { margin-bottom: 18px; }
.workbench-content .panel-heading h2 { font-size: clamp(1.12rem, 2vw, 1.28rem); }
.workbench-content :is(h1, h2, h3)[tabindex="-1"] { scroll-margin-block-start: calc(var(--workbench-bar-height) + 18px); }
.workbench-content .button-secondary { border-color: #ded5e9; }
.workbench-content .button-secondary:hover:not(:disabled) { background: #f2ebfb; }
.workbench-content .field :is(input, select, textarea) { border-color: #ded5e9; }
.workbench-content .field :is(input, select, textarea):focus { border-color: #8b6ce5; }
.workbench-content .field :is(input, select, textarea)::placeholder { color: #7c6e89; }

.workbench-overview { display: grid; gap: 18px; min-width: 0; }
.workbench-hero {
  position: relative;
  isolation: isolate;
  display: grid;
  align-items: center;
  min-height: clamp(246px, 28vw, 326px);
  overflow: hidden;
  padding: clamp(23px, 4vw, 43px);
  border: 1px solid #80650427;
  border-radius: 19px;
  color: #fff9ff;
  background: #27183d;
  box-shadow: 0 13px 34px #2c16341b;
}
.workbench-hero-copy { position: relative; z-index: 1; width: min(100%, 54ch); }
.workbench-hero-copy h2 { max-width: 19ch; font-size: clamp(1.63rem, 3.2vw, 2.65rem); line-height: 1.17; font-weight: 760; }
.workbench-hero-copy p { max-width: 31ch; margin-top: 11px; color: #e7d9f5; font-size: .94rem; }
.workbench-hero-actions { display: flex; gap: 9px; flex-wrap: wrap; margin-top: 22px; }
.workbench-hero-actions .button { min-height: 41px; padding-inline: 15px; font-size: .86rem; }
.workbench-hero-actions .button-primary { border-color: #ffc48b; color: #2f1c23; background: linear-gradient(110deg, #ffc189, #f5a665); }
.workbench-hero-actions .button-primary:hover:not(:disabled) { background: #ffc58e; }
.workbench-hero-actions .button-secondary { border-color: #a99abb; color: #fff6ff; background: #2d1f47b0; }
.workbench-hero-actions .button-secondary:hover:not(:disabled) { background: #4e3668; }
.workbench-hero-art { position: absolute; inset: 0; z-index: 0; margin: 0; overflow: hidden; pointer-events: none; }
.workbench-hero-art img { display: block; width: 100%; height: 100%; object-fit: cover; object-position: center 41%; }
.workbench-hero-art::after { position: absolute; inset: 0; content: ""; background: linear-gradient(90deg, #241233d9 0%, #24123373 34%, transparent 72%), linear-gradient(0deg, #2412335c, transparent 32%); }

.workbench-summary { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(230px, .75fr); gap: 14px; }
.workbench-current-project, .workbench-summary .wallet {
  display: flex;
  align-items: center;
  min-width: 0;
  min-height: 77px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--surface);
  box-shadow: 0 4px 16px #2c163406;
}
.workbench-current-project { gap: 11px; justify-content: space-between; padding: 12px 16px; }
.workbench-current-project .workbench-icon { color: var(--workbench-violet); }
.workbench-current-project :is(p, span) { overflow-wrap: anywhere; }
.workbench-current-project h2 { flex: 0 0 auto; color: #5c4d6a; font-size: .83rem; font-weight: 650; }
.workbench-current-project p { font-size: 1rem; font-weight: 650; text-align: end; }
.workbench-summary .wallet > div { min-width: 0; flex: 1; }
.workbench-summary .wallet dd { font-size: 1.24rem; }

.workbench-shortcuts { display: grid; min-width: 0; gap: 11px; }
.workbench-shortcuts h2 { font-size: 1.16rem; font-weight: 710; }
.workbench-shortcut-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.workbench-shortcut {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  min-height: 77px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  text-align: start;
  text-decoration: none;
  color: var(--workbench-ink);
  background: var(--surface);
}
.workbench-shortcut:hover { border-color: #bfa9ed; background: #fcfaff; box-shadow: 0 5px 16px #5426910f; }
.workbench-shortcut-icon { display: grid; flex: 0 0 34px; width: 34px; height: 34px; align-content: center; justify-items: center; border-radius: 9px; color: var(--workbench-violet); background: #f1eafb; }
.workbench-shortcut-copy { display: grid; gap: 3px; min-width: 0; overflow-wrap: anywhere; }
.workbench-shortcut-copy strong { font-size: .9rem; font-weight: 710; }
.workbench-shortcut-copy small { color: var(--muted); font-size: .75rem; line-height: 1.4; }
.workbench-shortcut-arrow { margin-inline-start: auto; color: var(--workbench-violet); flex: 0 0 auto; }
.workbench-empty { display: grid; justify-items: start; gap: 10px; }
.workbench-admin { display: grid; gap: 14px; min-width: 0; }
.workbench-admin-summary { align-items: center; }

.workbench-content .studio-workspace { padding: var(--panel-padding); border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.workbench-content .studio-workspace .studio-card { border-color: #eae3f2; background: #fcfaff; }
.workbench-content .story-workspace { margin-top: 0; }
.workbench-content .admin-grid { grid-template-columns: minmax(0, 1.45fr) minmax(min(100%, 260px), .85fr); }
.workbench-content :is(#studio-title,#feishu-title,#story-stage-title) { margin: 0; font-size: clamp(1.13rem, 2vw, 1.28rem); }

@media (max-width: 1120px) {
  .workbench-shortcut-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 900px) {
  .workbench-content .admin-grid { grid-template-columns: minmax(0, 1fr); }
  .workbench-hero-art img { object-position: 62% center; }
}

@media (max-width: 760px) {
  :root { --workbench-bar-height: 58px; --workbench-padding: clamp(15px, 4vw, 24px); }
  body:has(.workbench-shell:not([hidden])) .site-header { background: #fcfbfe; }
  body:has(.workbench-shell:not([hidden])) .site-header::after { left: 0; }
  body:has(.workbench-shell:not([hidden])) .workbench-topbar { display: flex; flex-wrap: nowrap; gap: 10px; padding-inline: var(--workbench-padding); }
  body:has(.workbench-shell:not([hidden])) .workbench-topbar .brand { color: var(--workbench-ink); }
  body:has(.workbench-shell:not([hidden])) .workbench-topbar .brand small { color: var(--muted); }
  body:has(.workbench-shell:not([hidden])) .workbench-topbar .brand-mark { width: 33px; height: 33px; flex-basis: 33px; }
  body:has(.workbench-shell:not([hidden])) .workbench-menu-toggle {
    display: inline-grid;
    place-items: center;
    width: 36px;
    height: 36px;
    min-height: 36px;
    padding: 0;
    border: 1px solid #ded5e9;
    border-radius: 8px;
    color: var(--workbench-ink);
    background: var(--surface);
  }
  .workbench-topbar .account { gap: 7px; }
  .workbench-topbar .account-name { max-width: 10ch; font-size: .78rem; }
  .workbench-topbar .account .button { padding-inline: 8px; }
  .workbench-topbar-context { max-width: 35%; margin-inline: auto; }
  .workbench-topbar-context > span { display: none; }
  .workbench-shell { grid-template-columns: minmax(0, 1fr); }
  .workbench-sidebar {
    position: fixed;
    top: var(--workbench-bar-height);
    left: 0;
    z-index: 25;
    width: min(246px, 84vw);
    visibility: hidden;
    transform: translateX(-101%);
    transition: transform .18s ease, visibility 0s linear .18s;
  }
  .workbench-sidebar.is-open { visibility: visible; transform: translateX(0); transition-delay: 0s; }
  .workbench-shell:has(.workbench-sidebar.is-open) .workbench-backdrop {
    position: fixed;
    inset: var(--workbench-bar-height) 0 0;
    z-index: 24;
    display: block;
    padding: 0;
    border: 0;
    background: #1b10266e;
  }
  .workbench-content { padding-top: 20px; }
  .workbench-heading { margin-bottom: 1px; }
  .workbench-heading p { font-size: .85rem; }
  .workbench-hero { min-height: 230px; }
}

@media (max-width: 470px) {
  .workbench-topbar-start { gap: 7px; }
  body:has(.workbench-shell:not([hidden])) .workbench-topbar .brand { gap: 6px; }
  body:has(.workbench-shell:not([hidden])) .workbench-topbar .brand strong { font-size: .92rem; }
  .workbench-topbar-context { display: none; }
  .workbench-summary, .workbench-shortcut-grid, .workbench-content .field-grid { grid-template-columns: minmax(0, 1fr); }
  .workbench-hero { padding: 20px; }
  .workbench-hero-copy h2 { max-width: 14ch; }
  .workbench-hero-copy p { max-width: 23ch; }
  .workbench-hero-art::after { background: linear-gradient(90deg, #241233eb 0%, #241233b3 53%, #2412334d 100%); }
  .workbench-content .promoter-form { grid-template-columns: minmax(0, 1fr); }
  .workbench-content .heading-row { flex-wrap: wrap; }
}

@media (prefers-reduced-motion: reduce) {
  .workbench-sidebar { transition: none; }
}

/* Motion generation workspace */
.video-studio { display: grid; gap: 16px; min-width: 0; }
.video-studio-banner {
  position: relative;
  isolation: isolate;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-width: 0;
  min-height: 132px;
  overflow: hidden;
  padding: clamp(18px, 2.75vw, 32px);
  border: 1px solid #50356d;
  border-radius: 16px;
  color: #fff8ff;
  background: #231530;
  box-shadow: 0 8px 28px #2a16491b;
}
.video-studio-banner-copy { position: relative; z-index: 1; max-width: 39ch; }
.video-studio-banner-copy :is(h2, h3) { margin: 0; font-size: clamp(1.25rem, 2.1vw, 1.67rem); font-weight: 730; line-height: 1.26; }
.video-studio-banner-copy p { margin-top: 6px; color: #eadbf8; font-size: .86rem; }
.video-studio-banner-art { position: absolute; inset: 0; z-index: -1; background: linear-gradient(90deg, #231530f2 0%, #231530c2 42%, #23153024 88%), url('/assets/manman-motion-hero.webp') right 35% / cover no-repeat; pointer-events: none; }
.video-studio-banner-copy .video-studio-model-status { display: inline-flex; align-items: center; gap: 6px; margin-top: 9px; padding: 4px 9px; border: 1px solid #d5bde34f; border-radius: 999px; color: #f3e6fc; background: #241533b8; font-size: .75rem; }
.video-studio-model-status::before { width: 6px; height: 6px; border-radius: 50%; background: #f3bb8a; content: ""; }
.video-studio-model-status.is-ready::before { background: #9fd9ae; }
.video-studio #student-provider { margin-bottom: 0; }

.video-studio-layout { display: grid; align-items: stretch; grid-template-columns: minmax(0, 1.54fr) minmax(255px, .91fr); gap: 15px; min-width: 0; }
.video-studio-editor, .video-studio-settings, .video-studio-history { border-color: #e6e0ef; box-shadow: 0 5px 21px #32174807; }
.video-studio-editor, .video-studio-settings { display: grid; align-content: start; gap: 14px; }
.video-studio-editor .panel-heading, .video-studio-settings .panel-heading, .video-studio-history .panel-heading { margin-bottom: 0; }
.video-studio-settings .panel-heading { align-items: center; }
.video-studio-editor :is(h2, h3), .video-studio-settings :is(h2, h3), .video-studio-history h2 { font-size: 1.15rem; font-weight: 730; }
.video-studio-engine { flex: 0 0 auto; padding: 4px 8px; border: 1px solid #e4d9f4; border-radius: 7px; color: #542fac; background: #f5effe; font-size: .75rem; font-weight: 680; }
.video-studio-editor textarea { min-height: 192px; padding: 14px 15px; border: 1px solid #dfd7ef; border-radius: 12px; background: #fcfaff; font-size: .95rem; line-height: 1.7; }
.video-studio-editor textarea:focus { border-color: #8061d8; background: #fff; }
.video-studio-editor textarea:not(:disabled):hover { border-color: #ae9bd5; }
.video-studio-specs { display: grid; gap: 11px; }
.video-studio-spec-grid { display: grid; align-items: start; grid-template-columns: 1fr 1fr; gap: 9px; }
.video-studio-spec-grid .field { font-size: .84rem; }
.video-studio-spec-grid .field :is(input,select) { min-height: 39px; padding: 7px 9px; background: #fcfaff; font-size: .88rem; }
.video-studio-billing { display: grid; gap: 4px; padding: 10px 12px; border: 1px solid #e9e0f2; border-radius: 10px; background: #f7f2fd; }
.video-studio-balance { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 5px 10px; color: #514261; font-size: .79rem; }
.video-studio-balance dd { margin: 0; color: #4d2d9c; font-size: .91rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.video-studio-billing #student-h3-rate { margin: 0; font-size: .74rem; }
.video-studio-submit { width: 100%; min-height: 43px; border-color: #e3d6f7; border-radius: 9px; color: #49248f; background: #f1eafd; }
.video-studio-submit:hover:not(:disabled) { background: #e9ddfc; }
.video-studio-settings #generate { width: 100%; }
.video-studio-settings .quote-card { margin-top: 0; }
.video-studio-settings .notice { margin: 0; }

.video-studio-history { display: grid; gap: 13px; }
.video-studio-history-heading { align-items: center; }
.video-studio-history .notice, .video-studio-history .jobs-list { margin: 0; }
.video-studio-empty { display: flex; align-items: center; gap: 11px; min-width: 0; padding: 13px; border: 1px solid #ebe5f2; border-radius: 11px; background: #faf8fd; }
.video-studio-empty .workbench-icon { width: 30px; height: 30px; padding: 6px; border-radius: 8px; color: #6e42c2; background: #eee7fb; }
.video-studio-empty #jobs-empty-message { min-width: 0; color: var(--muted); font-size: .86rem; text-align: start; }

@media (max-width: 920px) {
  .video-studio-layout { grid-template-columns: minmax(0,1fr) minmax(min(100%,240px),.85fr); }
}
@media (max-width: 620px) {
  .video-studio-layout { grid-template-columns: minmax(0,1fr); }
  .video-studio-banner { min-height: 110px; }
  .video-studio-editor textarea { min-height: 155px; }
}
@media (max-width: 410px) {
  .video-studio-banner { align-items: start; flex-wrap: wrap; gap: 9px; }
}

/* Shared workbench finishes */
body:has(.workbench-shell:not([hidden])) {
  --workbench-canvas: #f7f5fa;
  --workbench-ink: #241a34;
  --line: #e7e0ef;
  --radius: 16px;
}
.workbench-heading { padding-bottom: 14px; border-bottom: 1px solid #e9e2f0; }
.workbench-heading h1 { font-weight: 770; letter-spacing: -.028em; }
.workbench-heading p { color: #695978; }
.workbench-topbar-context { background: #faf7fe; }
.workbench-sidebar .workbench-nav-group + .workbench-nav-group { margin-top: 1px; }
.workbench-content :is(.panel, .workbench-current-project, .workbench-wallet, .workbench-shortcut) {
  box-shadow: 0 3px 5px #27133805, 0 10px 24px #27133805;
}
.workbench-content .panel-heading { color: var(--workbench-ink); }
.workbench-content .panel-heading h2 { font-weight: 740; }
.workbench-content .button-primary { border-color: transparent; background: linear-gradient(110deg, #6442d5, #5130b5); }
.workbench-content .button-primary:hover:not(:disabled) { background: linear-gradient(110deg, #5836c3, #432399); }
.workbench-content .workbench-hero-actions .button-primary { border-color: #ffc48b; background: linear-gradient(110deg, #ffc189, #f5a665); }
.workbench-content .workbench-hero-actions .button-primary:hover:not(:disabled) { background: #ffc58e; }
.workbench-content .field :is(input, select, textarea):not(:disabled):hover { border-color: #bfaed5; }
.workbench-content .field :is(input, select, textarea):focus { border-color: #8b69de; box-shadow: 0 0 0 3px #6f45c917; }
.workbench-content .field :is(input, select, textarea):focus-visible { outline-offset: 1px; }
.workbench-content :is(.story-draft, .edit-plan, .studio-records) { min-width: 0; }
.workbench-content .story-draft { padding: clamp(15px, 2.2vw, 26px); border-color: #e7ddf2; border-radius: 15px; background: linear-gradient(175deg, #fcfaff, #f7f2fc); }
.workbench-content .story-draft-section { border-color: #eae4f2; border-radius: 11px; }
.workbench-content .story-draft-section:focus-within { border-color: #b7a2df; }
.workbench-content .empty-state { border-radius: 12px; border-color: #ded4eb; background: #faf7fe; }
.workbench-content .studio-workspace .studio-card { background: linear-gradient(155deg, #fff 10%, #fbf8fe); }
.workbench-content .studio-media-card { border-color: #e8e0ef; border-radius: 12px; background: #fff; }
.workbench-content .table-scroll { border-color: #e5ddee; border-radius: 12px; }
.workbench-content .table-scroll tbody tr:hover { background: #fbf8ff; }
.workbench-public .auth-panel { border-color: #eadff2; box-shadow: 0 16px 43px #3d295914; }
.workbench-public .auth-submit { min-height: 46px; background: linear-gradient(110deg, #6644d9, #5232b6); }
.workbench-public .auth-submit:hover:not(:disabled) { background: #4e2ab0; }

/* Guided story planning */
.workbench-content .story-workspace:has(#planning-workflow:not([hidden])) {
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}
#story-instruction-area { display: grid; gap: 13px; }
.planning-workflow, .planning-form { display: grid; gap: 14px; min-width: 0; }
.planning-overview {
  position: relative;
  isolation: isolate;
  display: flex;
  align-items: center;
  min-height: 140px;
  overflow: hidden;
  padding: clamp(19px, 3.4vw, 35px);
  border: 1px solid #604678;
  border-radius: var(--radius);
  color: #fff9ff;
  background: #291b3d;
  box-shadow: 0 8px 22px #2516301f;
}
.planning-overview::before {
  position: absolute;
  inset: 0;
  z-index: -1;
  background: linear-gradient(90deg, #291b3deb 0%, #291b3ddc 40%, #291b3d24 87%), url('/assets/manman-motion-hero.webp') right 41% / cover no-repeat;
  content: "";
}
.planning-overview-copy { max-width: 60ch; }
.planning-overview h2 { font-size: clamp(1.21rem, 2.75vw, 1.85rem); font-weight: 750; line-height: 1.24; }
.planning-overview p { margin-top: 8px; color: #eee4f8; font-size: clamp(.81rem, 1.7vw, .92rem); }

.planning-brief-details { min-width: 0; }
.planning-brief-summary {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  min-width: 0;
  padding: 11px 15px;
  border: 1px solid #e8dff3;
  border-radius: 11px;
  color: #492d77;
  background: #fbf8ff;
  font-size: .87rem;
  font-weight: 700;
  cursor: pointer;
  list-style: none;
}
.planning-brief-summary::-webkit-details-marker { display: none; }
.planning-brief-summary::after { font-size: .8rem; content: "▾"; }
.planning-brief-details[open] > .planning-brief-summary::after { transform: rotate(180deg); }
.planning-brief-summary:hover { border-color: #c4afe8; }
#planning-brief-label { min-width: 0; overflow: hidden; color: #705d81; font-size: .8rem; font-weight: 450; text-overflow: ellipsis; white-space: nowrap; }
.planning-brief-details[open] > .planning-form { margin-top: 13px; }

.planning-step {
  display: grid;
  gap: 12px;
  min-width: 0;
  padding: 8px clamp(16px, 2.6vw, 26px) clamp(16px, 2.6vw, 27px);
  border: 1px solid #e7dfef;
  border-radius: 15px;
  background: #fff;
  box-shadow: 0 7px 18px #33204407;
}
.planning-step-title { padding-inline: 7px; margin-inline-start: -7px; color: var(--workbench-ink); font-size: 1.04rem; font-weight: 740; }
.planning-step-number { display: inline-grid; place-items: center; width: 25px; height: 25px; margin-inline-end: 8px; border-radius: 8px; color: #5532a5; background: #eee6fb; font-size: .78rem; font-weight: 740; font-variant-numeric: tabular-nums; }
.planning-step-description { color: #665473; font-size: .84rem; }
.planning-client-grid { display: grid; grid-template-columns: minmax(185px,.68fr) minmax(0,1.62fr); align-items: start; gap: 14px; }
.planning-industry-fields { display: grid; gap: 11px; min-width: 0; }
.planning-step .field { font-size: .88rem; }
.planning-step .field :is(input, select, textarea) { background: #fdfbff; }
.planning-step .field textarea { min-height: 90px; resize: vertical; }
.planning-form-actions { align-items: center; gap: 13px; padding: 1px 2px 5px; }
.planning-form-actions p { font-size: .82rem; }

.planning-template-grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 11px; }
.planning-template {
  --planning-template-wash: #faf7fe;
  --planning-template-color: #5534ad;
  display: grid;
  grid-template-columns: auto minmax(0,1fr);
  grid-template-rows: auto 1fr;
  align-content: start;
  align-items: start;
  gap: 5px 8px;
  min-width: 0;
  padding: 13px;
  border: 1px solid #e8dfef;
  border-radius: 11px;
  color: var(--workbench-ink);
  background: linear-gradient(155deg, var(--planning-template-wash), #fff 88%);
  cursor: pointer;
}
.planning-template:has(input[value="suspense"]) { --planning-template-wash: #f2edfc; --planning-template-color: #5935a2; }
.planning-template:has(input[value="urban"]) { --planning-template-wash: #fff2f1; --planning-template-color: #964e69; }
.planning-template:has(input[value="growth"]) { --planning-template-wash: #fff5e9; --planning-template-color: #875527; }
.planning-template:has(input[value="fantasy"]) { --planning-template-wash: #eeeffc; --planning-template-color: #494999; }
.planning-template:has(input[value="comedy"]) { --planning-template-wash: #f0f8f2; --planning-template-color: #3f6a53; }
.planning-template:has(input:checked) { border-color: #7c56ce; box-shadow: inset 0 0 0 1px #7c56ce, 0 3px 10px #6d41bb14; }
.planning-template:focus-within { outline: 2px solid #8d64dc; outline-offset: 2px; }
.planning-template:hover { border-color: #bca4e5; }
.planning-template:has(input:disabled) { cursor: default; }
.planning-template input { width: 15px; height: 15px; margin: 2px 0 0; accent-color: #6741bd; }
.planning-template input:focus-visible { outline: 0; }
.planning-template-name { color: var(--planning-template-color); font-size: .9rem; line-height: 1.35; font-weight: 720; }
.planning-template-description { grid-column: 2 / -1; color: #62516c; font-size: .78rem; line-height: 1.55; overflow-wrap: anywhere; }

#story-workspace:has(#planning-workflow:not([hidden])) .story-draft { background: #fff; }
.planning-draft-actions { display: flex; flex-wrap: wrap; justify-content: end; gap: 7px; }
.planning-draft-preview {
  display: grid;
  gap: 13px;
  min-width: 0;
  padding-top: 13px;
  border-top: 1px solid #ede4f5;
}
#planning-draft-title { margin: 0; color: var(--workbench-ink); font-size: clamp(1.19rem, 2.45vw, 1.55rem); font-weight: 730; overflow-wrap: anywhere; }
#planning-draft-blocks { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); align-items: stretch; gap: 10px; }
.planning-draft-block {
  min-width: 0;
  padding: 12px 14px;
  border: 1px solid #ebdfef;
  border-radius: 11px;
  background: #fcf9ff;
}
.planning-draft-block:first-child { grid-column: 1 / -1; border-inline-start: 3px solid #8e6cd3; background: linear-gradient(110deg, #f4edfc, #faf7ff); }
.planning-draft-block :is(h4,h5) { margin: 0 0 5px; color: #503577; font-size: .9rem; font-weight: 730; }
.planning-draft-block p { color: #42334e; font-size: .9rem; line-height: 1.66; overflow-wrap: anywhere; white-space: pre-wrap; }
.planning-review { display: grid; gap: 16px; min-width: 0; padding: clamp(16px, 2.7vw, 27px); border: 1px solid #e4d7ef; border-radius: var(--radius); background: linear-gradient(165deg, #fbf7ff, #fff 78%); box-shadow: 0 7px 20px #2e164907; }
.planning-review-heading { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 13px; }
.planning-review-heading h3 { font-size: 1.12rem; }
#planning-version-state { padding: 3px 7px; border: 1px solid #e9def7; border-radius: 7px; color: #5936a7; background: #f3eafa; font-size: .76rem; }
.planning-feedback-form { gap: 9px; }
.planning-feedback-form textarea { min-height: 88px; }
.planning-review-actions { justify-content: end; }
.planning-adopt-actions { align-items: center; justify-content: space-between; gap: 10px; padding-top: 13px; border-top: 1px solid #eae1f2; }
.planning-adopt-hint { font-size: .82rem; }
.planning-adopt-actions .workbench-icon { margin-inline-start: 6px; }
#story-workspace[aria-busy="true"] :is(#story-stage-message, #planning-feedback-message):not([hidden]) { display: flex; align-items: center; gap: 9px; border-color: #e7d8f6; color: #543a89; background: #f5edfb; }
#story-workspace[aria-busy="true"] :is(#story-stage-message, #planning-feedback-message):not([hidden])::before { width: 12px; height: 12px; border: 2px solid #d9c7ed; border-top-color: #7345bb; border-radius: 50%; animation: planning-progress .8s linear infinite; content: ""; }
@keyframes planning-progress { to { transform: rotate(360deg); } }
@media (max-width: 920px) {
  .planning-template-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
}
@media (max-width: 600px) {
  .planning-client-grid { grid-template-columns: minmax(0,1fr); gap: 11px; }
  .planning-overview { min-height: 115px; }
  #planning-draft-blocks { grid-template-columns: minmax(0,1fr); }
}
@media (max-width: 420px) {
  .planning-template-grid { gap: 8px; }
  .planning-template { gap: 4px 6px; padding: 9px; }
  .planning-template-description { grid-column: 1 / -1; }
  .planning-adopt-actions { align-items: stretch; flex-direction: column; }
}
@media (prefers-reduced-motion: reduce) {
  #story-workspace[aria-busy="true"] :is(#story-stage-message, #planning-feedback-message):not([hidden])::before { animation: none; }
}
}

@layer workbench-interface {
/* Shared interface palette and controls */
:root {
  color-scheme: dark;
  --neo-bg: #070b18;
  --neo-canvas: #0a101f;
  --neo-panel: #101a30;
  --neo-raised: #14213a;
  --neo-control: #0c172d;
  --neo-line: #30476a;
  --neo-muted: #aebcdc;
  --neo-text: #edf4ff;
  --neo-cyan: #78e9ff;
  --neo-violet: #baa6ff;
  --neo-amber: #ffc393;
  --neo-green: #84e4c0;
  --neo-danger: #ffb2bd;
  --neo-mono: "Cascadia Mono", "SFMono-Regular", Consolas, monospace;
  color: var(--neo-text);
  background: var(--neo-bg);
  accent-color: var(--neo-cyan);
}

body, body:has(.workbench-shell:not([hidden])) {
  --text: var(--neo-text);
  --muted: var(--neo-muted);
  --surface: var(--neo-panel);
  --line: var(--neo-line);
  --strong-line: #4a678f;
  --accent: var(--neo-cyan);
  --accent-deep: #a6edff;
  --wash: #142843;
  --sun: #221837;
  --radius: 13px;
  color: var(--neo-text);
}

body { background: var(--neo-canvas); }
::selection { color: #08172a; background: #97eaff; }
:focus-visible { outline: 2px solid var(--neo-cyan); outline-offset: 3px; }
.skip-link:focus { color: #09152a; background: var(--neo-cyan); }
.muted { color: var(--neo-muted); }
a:is(:link,:visited) { color: inherit; }
.numeric, .wallet dd, .quote-summary strong, .studio-time, .studio-stamp, .edit-time {
  font-family: var(--neo-mono);
  font-variant-numeric: tabular-nums;
}

.panel {
  position: relative;
  border-color: #2b4061;
  border-radius: var(--radius);
  color: var(--neo-text);
  background: linear-gradient(145deg, #14213a 0%, #101a30 45%, #0f182c 100%);
  box-shadow: 0 14px 36px #04071540;
}
.panel::before {
  position: absolute;
  inset: 0 12px auto;
  height: 1px;
  pointer-events: none;
  background: linear-gradient(90deg, transparent, #77caff82 15%, #626fc74d 45%, transparent 86%);
  content: "";
}
.panel-heading { color: var(--neo-text); }
.panel-heading p { color: var(--neo-muted); }
.panel > header.panel-heading { padding-bottom: 10px; border-bottom: 1px solid #829ecb24; }
.workbench-content > .panel, .workbench-content .workspace-grid > .panel { box-shadow: 0 14px 32px #03071544; }

.button { border-color: transparent; }
.button-primary, .workbench-content .button-primary, .workbench-public .auth-submit {
  color: #071627;
  border-color: #a6efff;
  background: linear-gradient(106deg, #9df4ff, #6cd5ff 68%, #a8acee);
  box-shadow: 0 4px 14px #32cfff24, inset 0 1px #f0ffff74;
}
.button-primary:hover:not(:disabled), .workbench-content .button-primary:hover:not(:disabled),
.workbench-public .auth-submit:hover:not(:disabled) {
  color: #071627;
  border-color: #cef7ff;
  background: linear-gradient(106deg, #c0faff, #8ce7ff 68%, #c3baff);
  box-shadow: 0 5px 18px #51e0ff3d, inset 0 1px #fff9;
}
.button-secondary, .button-header, .workbench-content .button-secondary {
  border-color: #52739a;
  color: #d4eeff;
  background: #13243c;
  box-shadow: inset 0 1px #bcddff12;
}
.button-secondary:hover:not(:disabled), .button-header:hover:not(:disabled),
.workbench-content .button-secondary:hover:not(:disabled) { border-color: #81ddf4; color: #f0fbff; background: #1a3352; }
.button:active:not(:disabled) { box-shadow: inset 0 1px 6px #050b1c80; }
.button:disabled,
.workbench-content .button-primary:disabled, .workbench-content .button-secondary:disabled {
  opacity: 1;
  color: #acb8d3;
  border-color: #344560;
  background: #172136;
  box-shadow: none;
}

.field { color: #dfeaff; }
.field small, .field .muted { color: var(--neo-muted); }
.field :is(input, select, textarea), .workbench-content .field :is(input, select, textarea) {
  color: #f1f5ff;
  border-color: #52739a;
  border-radius: 9px;
  background: linear-gradient(150deg, #0c162b, #0c1b33 75%);
  box-shadow: inset 0 1px 5px #050a1975;
}
.field :is(input, textarea)::placeholder, .workbench-content .field :is(input, textarea)::placeholder {
  color: #a1b3d3;
  opacity: 1;
}
.field :is(input, select, textarea):not(:disabled):hover, .workbench-content .field :is(input, select, textarea):not(:disabled):hover { border-color: #6294b8; }
.field :is(input, select, textarea):focus, .workbench-content .field :is(input, select, textarea):focus {
  border-color: var(--neo-cyan);
  background: #10233b;
  box-shadow: inset 0 1px 5px #050a1965, 0 0 0 3px #62d7ff26;
}
.field :is(input, select, textarea):disabled, .workbench-content .field :is(input, select, textarea):disabled {
  color: #acb8d3;
  border-color: #354862;
  background: #152137;
  box-shadow: none;
}
select :is(option, optgroup) { color: var(--neo-text); background: var(--neo-control); }
input[type="file"]::file-selector-button,
.edit-input-row input[type="file"]::file-selector-button,
.studio-file input[type="file"]::file-selector-button {
  color: #d1f1ff;
  border-color: #57789e;
  background: #162d49;
}
input:is([type="checkbox"], [type="radio"]) { accent-color: var(--neo-cyan); }

.notice { border: 1px solid #406385; border-inline-start: 3px solid #75d9fa; border-radius: 9px; color: #c4eaff; background: #132743; }
.notice-error { color: #ffd1d8; border-color: #834659; border-inline-start-color: #ff9faf; background: #301d31; }
.notice-warning { color: #ffe2ba; border-color: #77583e; border-inline-start-color: #f3bd86; background: #332738; }
.notice-success { color: #b4f5d5; border-color: #35756e; border-inline-start-color: #7ee3b7; background: #142e35; }
.badge, .provider-pill { border: 1px solid #405879; color: #d4eaff; background: #1b2c47; }
.badge-active { border-color: #3e759b; color: #b5eaff; background: #183751; }
.badge-success, .provider-pill:not(.provider-unavailable) { border-color: #3f776e; color: #aef0cf; background: #17353c; }
.badge-warning, .provider-unavailable { border-color: #786044; color: #ffd8a0; background: #362b36; }
.badge-error { border-color: #864e60; color: #ffd0d9; background: #3c2538; }
.creator-account-platform { border-color: #67558b; color: #e3d6ff; background: #2c2447; }
.empty-state, .workbench-content .empty-state {
  border: 1px dashed #476387;
  color: #b2c6e8;
  background: repeating-linear-gradient(135deg,#7ad8f705 0 1px, transparent 1px 12px), #101e35;
}

.table-scroll, .workbench-content .table-scroll { border-color: #3a5074; background: #0d182d; }
thead { color: #b9d4ee; background: linear-gradient(90deg, #1b324e, #1a2641); }
thead th { border-bottom: 1px solid #4a6487; font-weight: 700; }
tbody tr:nth-child(even) { background: #131f36; }
tbody tr:hover, .workbench-content .table-scroll tbody tr:hover { background: #1a304b; }
tbody tr + tr { border-color: #253b59; }
.promoter-item, .creator-account-row { border-color: #344e71; background: linear-gradient(110deg,#172943,#121e34); }
.promoter-link input { font-family: var(--neo-mono); }
.roster-filter { padding-inline-start: 12px; border-inline-start: 2px solid #63d2f1; }

.edit-output video, .studio-preview video, .studio-report video, video {
  color-scheme: dark;
  background: #060b18;
}
audio { color-scheme: dark; }

/* Workbench frame, sign-in and overview */
:root {
  --workbench-sidebar: #0b1426;
  --workbench-sidebar-edge: #253552;
  --workbench-nav-text: #c2d0e9;
  --workbench-nav-muted: #a0b2d0;
  --workbench-nav-active: #17364e;
  --workbench-violet: var(--neo-violet);
  --workbench-apricot: var(--neo-amber);
  --workbench-grid: #7faff90a;
  --workbench-seam: #88e9ff57;
}

body,
body:has(#auth-view:not([hidden])),
body:has(.workbench-shell:not([hidden])) {
  --workbench-canvas: var(--neo-canvas);
  --workbench-ink: var(--neo-text);
  color: var(--neo-text);
  background:
    radial-gradient(ellipse 56rem 38rem at 23% 2%, #19497533, transparent 77%),
    radial-gradient(ellipse 42rem 38rem at 100% 13%, #4134792d, transparent 79%),
    linear-gradient(var(--workbench-grid) 1px, transparent 1px) 0 0 / 36px 36px,
    linear-gradient(90deg, var(--workbench-grid) 1px, transparent 1px) 0 0 / 36px 36px,
    var(--neo-canvas);
}

.site-header {
  color: var(--neo-text);
  background: #0a1223ed;
  border-color: var(--workbench-sidebar-edge);
}

body:has(.workbench-shell:not([hidden])) .site-header {
  background: linear-gradient(90deg, #0d172b 0 var(--workbench-menu-width), #0b1426ed var(--workbench-menu-width));
  box-shadow: 0 4px 18px #02061463;
  backdrop-filter: blur(16px);
}

body:has(.workbench-shell:not([hidden])) .site-header::after {
  inset-inline-start: 0;
  background: linear-gradient(90deg, var(--workbench-sidebar-edge) 0 var(--workbench-menu-width), #42658c var(--workbench-menu-width), var(--workbench-sidebar-edge) 78%);
}

.workbench-topbar .brand,
body:has(.workbench-shell:not([hidden])) .workbench-topbar .brand {
  color: var(--neo-text);
}

.workbench-topbar .brand small,
body:has(.workbench-shell:not([hidden])) .workbench-topbar .brand small {
  color: #adbcda;
  letter-spacing: .045em;
}

.workbench-topbar .brand-mark {
  border: 1px solid #d4c8f4;
  box-shadow: 0 0 0 3px #9e82fc1a, 0 0 16px #a98bfa22;
}

.workbench-topbar-context {
  border-color: var(--workbench-sidebar-edge);
  color: var(--neo-muted);
  background: linear-gradient(180deg, #172540, #101c32);
  box-shadow: inset 0 1px #b2ceff0d;
  transition: border-color .15s ease, background-color .15s ease, color .15s ease;
}

.workbench-topbar-context::after {
  content: "";
  flex: none;
  width: 6px;
  height: 6px;
  margin-inline: 1px 3px;
  border-block-start: 1px solid currentColor;
  border-inline-end: 1px solid currentColor;
  transform: rotate(45deg);
}

.workbench-topbar-context:hover {
  border-color: #5181a1;
  color: var(--neo-cyan);
  background: #172b46;
}

.workbench-topbar-context .workbench-icon { color: var(--neo-cyan); }
.workbench-topbar-context strong,
.account-copy .account-name { color: var(--neo-text); }
.account-copy .account-role { color: var(--neo-muted); }

.workbench-topbar .account .button {
  border-color: var(--neo-line);
  color: var(--neo-text);
  background: #101b30;
}

.workbench-topbar .account .button:hover:not(:disabled) {
  border-color: #557b9e;
  color: var(--neo-cyan);
  background: #152942;
}

.workbench-sidebar {
  color: var(--workbench-nav-text);
  background:
    radial-gradient(ellipse 235px 350px at 0 0, #20436d4f, transparent 88%),
    linear-gradient(180deg, var(--workbench-sidebar), #0a1122);
  border-color: var(--workbench-sidebar-edge);
  box-shadow: inset -1px 0 #a2c4ff0b;
}

.workbench-nav { scrollbar-color: #3b5278 transparent; }
.workbench-nav-label {
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--workbench-nav-muted);
  letter-spacing: .075em;
}

.workbench-nav-label::after {
  content: "";
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, #58759d58, #58759d00);
}

.workbench-nav-link { transition: color .15s ease, background-color .15s ease, box-shadow .15s ease; }
.workbench-nav-link .workbench-icon { color: #9bb0d7; }
.workbench-nav-link:hover {
  color: var(--neo-text);
  background: #172842;
  box-shadow: inset 0 0 0 1px #75a7da29;
}

.workbench-nav-link[aria-current="page"] {
  color: #e7fbff;
  background: linear-gradient(96deg, var(--workbench-nav-active), #16253f 88%);
  box-shadow: inset 0 0 0 1px #6dd7ff57, 0 0 13px #60d4ff10;
}

.workbench-nav-link[aria-current="page"]::before {
  width: 3px;
  background: var(--neo-cyan);
  box-shadow: 0 0 10px #76eaff92;
}

.workbench-nav-link[aria-current="page"] .workbench-icon { color: var(--neo-cyan); }
.workbench-nav-link:focus-visible { outline-color: var(--neo-cyan); }
.workbench-sidebar-footer { border-color: var(--workbench-sidebar-edge); }
.workbench-sidebar-footer .workbench-nav-link { color: var(--workbench-nav-text); }
.workbench-sidebar-footer .workbench-icon { color: var(--neo-violet); }

.workbench-heading {
  position: relative;
  border-color: var(--workbench-sidebar-edge);
}

.workbench-heading::after {
  position: absolute;
  inset: auto auto -1px 0;
  width: min(10rem, 45%);
  height: 1px;
  content: "";
  background: linear-gradient(90deg, var(--workbench-seam), transparent);
  pointer-events: none;
}

.workbench-heading h1 {
  color: var(--neo-text);
  overflow-wrap: anywhere;
  text-shadow: 0 3px 24px #75b5ff24;
}

.workbench-heading p { color: var(--neo-muted); }
body:has(.workbench-shell:not([hidden])) #main > .notice { box-shadow: 0 8px 28px #0206149c; }

.workbench-public .auth-panel,
.workbench-public .loading-panel {
  position: relative;
  border-color: #375273;
  background:
    radial-gradient(ellipse at 100% 0, #254b734f, transparent 64%),
    linear-gradient(150deg, var(--neo-raised), var(--neo-panel) 55%, #0d172a);
  box-shadow: inset 0 1px #b6d1fd13, 0 24px 70px #0206158c;
}

.workbench-public .auth-panel::before,
.workbench-public .loading-panel::before {
  position: absolute;
  inset: -1px 18% auto 18%;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--workbench-seam) 43%, #baa6ff4d 73%, transparent);
  content: "";
  pointer-events: none;
}

.workbench-public .loading-panel { margin-inline: auto; }
.auth-panel h1, .loading-panel h1 { color: var(--neo-text); }

.auth-poster {
  padding: clamp(4px, .7vw, 8px);
  border-color: #435171;
  background: linear-gradient(145deg, #1d2d47, #12182d 52%, #2a213b);
  box-shadow: 0 22px 58px #0206159c, inset 0 1px #aabfff25;
}

.auth-poster img { border-radius: calc(var(--radius) - 5px); }

.auth-panel .segmented {
  border: 1px solid #30476a;
  background: #0b162a;
}

.auth-panel .segmented button { color: var(--neo-muted); }
.auth-panel .segmented button:hover { color: var(--neo-text); background: #172743; }
.auth-panel .segmented button[aria-pressed="true"] {
  border-color: #52a4bc;
  color: var(--neo-cyan);
  background: linear-gradient(150deg, #1c3d58, #152943);
  box-shadow: inset 0 1px #9cecff23, 0 2px 7px #03071365;
}

.workbench-public .auth-submit,
.workbench-content .workbench-hero-actions .button-primary {
  border-color: #9aefff;
  color: #081a2a;
  background: linear-gradient(108deg, #a9f3ff, #66ddf4 62%, #79b5fa);
  box-shadow: inset 0 1px #ffffff57, 0 3px 17px #67daf335;
}

.workbench-public .auth-submit:hover:not(:disabled),
.workbench-content .workbench-hero-actions .button-primary:hover:not(:disabled) {
  border-color: #c1f7ff;
  color: #061521;
  background: linear-gradient(108deg, #d3fbff, #88ebfc 62%, #a0caff);
}

.workbench-hero {
  border-color: #4b6392;
  color: var(--neo-text);
  background: #101b30;
  box-shadow: 0 14px 35px #02051085;
}

.workbench-hero::after {
  position: absolute;
  z-index: 2;
  inset: 0;
  background:
    linear-gradient(90deg, transparent, #8ce8ff7d 42%, #b0a3f75c 76%, transparent) top / 84% 1px no-repeat,
    linear-gradient(#abc8ff9c, #abc8ff9c) right 13px bottom 13px / 17px 1px no-repeat,
    linear-gradient(#abc8ff9c, #abc8ff9c) right 13px bottom 13px / 1px 17px no-repeat;
  content: "";
  pointer-events: none;
}

.workbench-hero-copy h2 {
  color: #f3f8ff;
  text-shadow: 0 2px 22px #020614cc;
}

.workbench-hero-copy p { color: #d2e0f8; }
.workbench-hero-actions .button-secondary {
  border-color: #7893b3;
  color: #edf6ff;
  background: #152640e8;
  box-shadow: inset 0 1px #b6d1fd18;
}

.workbench-hero-actions .button-secondary:hover:not(:disabled) {
  border-color: var(--neo-cyan);
  color: #f2faff;
  background: #203a56;
}

.workbench-hero-art::after {
  background:
    linear-gradient(90deg, #0b1429fa 0%, #111a32e8 24%, #121a325b 51%, #15152b00 79%),
    linear-gradient(0deg, #0a13296e, transparent 44%);
}

.workbench-content :is(.workbench-current-project, .workbench-wallet, .workbench-shortcut) {
  border-color: var(--neo-line);
  background: linear-gradient(145deg, #162640, var(--neo-panel) 86%);
  box-shadow: inset 0 1px #9bbef110, 0 5px 15px #02061442;
}

.workbench-current-project h2 { color: var(--neo-muted); }
.workbench-current-project p { color: var(--neo-text); }
.workbench-summary .wallet { align-items: stretch; }
.workbench-summary .wallet > div { display: grid; align-content: center; }
.workbench-summary .wallet > div + div { border-color: var(--neo-line); }
.workbench-summary .wallet dd { color: var(--neo-cyan); }
.workbench-summary .wallet #wallet-held { color: var(--neo-violet); }

.workbench-shortcuts h2 { color: var(--neo-text); }
.workbench-shortcut {
  color: var(--neo-text);
  transition: border-color .15s ease, box-shadow .15s ease;
}

.workbench-content .workbench-shortcut:is(:hover, :focus-visible) {
  border-color: #5887ad;
  background: linear-gradient(145deg, #1a3450, #14213a 86%);
  box-shadow: inset 0 1px #a1dcff24, 0 6px 18px #02061470;
}

.workbench-shortcut-icon,
.workbench-empty-icon {
  border: 1px solid #6fcfff53;
  color: var(--neo-cyan);
  background: linear-gradient(150deg, #1b425e, #19304e 76%);
  box-shadow: inset 0 1px #a4e9ff19;
}

.workbench-empty-icon { display: grid; width: 38px; height: 38px; place-items: center; border-radius: 9px; }
.workbench-shortcut-arrow { color: #9ab5da; }
.workbench-shortcut:is(:hover, :focus-visible) .workbench-shortcut-arrow { color: var(--neo-cyan); }

@media (max-width: 760px) {
  body:has(.workbench-shell:not([hidden])) .site-header { background: #0b1426f2; }
  body:has(.workbench-shell:not([hidden])) .site-header::after { background: #304762; }
  body:has(.workbench-shell:not([hidden])) .workbench-menu-toggle {
    border-color: var(--neo-line);
    color: var(--neo-cyan);
    background: #14223a;
  }
  body:has(.workbench-shell:not([hidden])) .workbench-menu-toggle[aria-expanded="true"] { border-color: #5daac0; background: #19364d; }
  .workbench-shell:has(.workbench-sidebar.is-open) .workbench-backdrop { background: #020710ac; }
}

@media (max-width: 470px) {
  .workbench-hero-art::after {
    background:
      linear-gradient(90deg, #0b1429fa 0%, #10182bd6 46%, #13162940 100%),
      linear-gradient(0deg, #080e218c, transparent 57%);
  }
}

@media (prefers-reduced-motion: reduce) {
  .workbench-nav-link, .workbench-topbar-context, .workbench-shortcut { transition: none; }
}

/* Creation tools */
.workbench-content {
  --tool-grid: linear-gradient(90deg, #82b3ed14 1px, transparent 1px),
    linear-gradient(#82b3ed14 1px, transparent 1px);
  --tool-shadow: inset 0 1px #b3d4ff13, 0 12px 30px #02061339;
  --tool-mono: "Cascadia Mono", "SFMono-Regular", Consolas, monospace;
}

.workbench-content :is(.story-panel, .studio-workspace, .edit-panel, .video-studio-editor, .video-studio-settings, .video-studio-history, .story-workspace:has(#story-instruction-area:not([hidden]))) {
  border-color: var(--neo-line);
  background: linear-gradient(150deg, #162440, var(--neo-panel) 38%, #0e172a);
  box-shadow: var(--tool-shadow);
}

.workbench-content :is(.story-panel, .edit-panel) { margin-block: 0; }
.story-panel .story-project-form {
  padding: clamp(12px, 2vw, 19px);
  border: 1px solid var(--neo-line);
  border-radius: 11px;
  background: linear-gradient(115deg, #15233c, var(--neo-control));
}
.story-panel .story-project-picker { margin-top: 19px; }

.workbench-content :is(.studio-workspace, .edit-panel) > .heading-row,
.workbench-content .story-panel > .panel-heading {
  padding-bottom: 13px;
  border-bottom: 1px solid var(--neo-line);
}

.workbench-content :is(.planning-overview, .video-studio-banner) {
  min-height: clamp(136px, 14vw, 186px);
  border-color: #3a527c;
  color: var(--neo-text);
  background: var(--neo-panel);
  box-shadow: var(--tool-shadow);
}
.planning-overview { --tool-banner-glow: #7765eb6b; --tool-banner-ink: #19193b; }
.video-studio-banner { --tool-banner-glow: #257bd38c; --tool-banner-ink: #0d2443; }
.planning-overview::before, .video-studio-banner-art {
  background-image: linear-gradient(90deg, #0c152a 8%, #0d172bf6 32%, #121f43ad 78%),
    radial-gradient(ellipse at 83% 50%, var(--tool-banner-glow), transparent 58%),
    var(--tool-grid), linear-gradient(110deg, var(--neo-panel), transparent),
    url('/assets/manman-motion-hero.webp'), linear-gradient(110deg, var(--neo-panel), var(--tool-banner-ink));
  background-position: 0 0, 0 0, 0 0, 0 0, 0 0, right 40%, 0 0;
  background-repeat: no-repeat, no-repeat, repeat, repeat, no-repeat, no-repeat, no-repeat;
  background-size: auto, auto, 25px 25px, 25px 25px, auto, cover, auto;
}
.planning-overview::after, .video-studio-banner-art::after {
  position: absolute;
  inset-block-start: 50%;
  inset-inline-end: 10%;
  width: clamp(110px, 22vw, 265px);
  aspect-ratio: 1;
  border: 1px solid #9dc8ff80;
  border-radius: 50%;
  background: radial-gradient(circle, #ffffff9c 0 2%, #9af0ff6e 2.5%, #637afb20 11%, transparent 38%),
    radial-gradient(circle, transparent 32%, #b0c6ff85 33% 33.5%, transparent 34% 49%, #b0c6ff54 50% 50.5%, transparent 51%),
    conic-gradient(from 22deg, transparent 0 12%, #96dbff50 13% 13.4%, transparent 14% 37%, #b599ff5a 38% 38.4%, transparent 39% 82%, #96dbff64 83% 83.4%, transparent 84%);
  box-shadow: 0 0 42px var(--tool-banner-glow), inset 0 0 28px var(--tool-banner-glow);
  opacity: .72;
  transform: translateY(-50%) rotate(-14deg) scaleY(.76);
  pointer-events: none;
  content: "";
}
.planning-overview::after { z-index: -1; }
.planning-overview-copy { max-width: min(60ch, 72%); }
.planning-overview p, .video-studio-banner-copy p { color: #c6d6f2; }
.video-studio-banner-copy :is(h2, h3) { font-size: clamp(1.42rem, 2.5vw, 1.94rem); }

/* Guided planning and saved drafts */
.planning-brief-summary {
  border-color: var(--neo-line);
  color: var(--neo-text);
  background: linear-gradient(110deg, var(--neo-raised), var(--neo-panel));
  box-shadow: inset 0 1px #b3d4ff13;
}
.planning-brief-summary::after { color: var(--neo-cyan); }
.planning-brief-summary:hover { border-color: #6396bd; }
#planning-brief-label, .planning-step-description { color: var(--neo-muted); }
.planning-step {
  border-color: var(--neo-line);
  background: linear-gradient(150deg, #17233e, var(--neo-panel) 45%);
  box-shadow: var(--tool-shadow);
}
.planning-step-title, #planning-draft-title { color: var(--neo-text); }
.planning-step-number {
  border: 1px solid #547caa;
  color: var(--neo-cyan);
  background: #182d49;
  box-shadow: 0 0 12px #57b3ee26;
  font-family: var(--tool-mono);
}
.planning-step .field :is(input, select, textarea) { background: var(--neo-control); }
#planning-template-step .planning-step-number {
  border-color: #666298;
  color: var(--neo-violet);
  background: #272348;
  box-shadow: 0 0 12px #9776ee22;
}
.planning-template {
  --planning-template-color: var(--neo-cyan);
  position: relative;
  padding-block-start: 16px;
  border-color: var(--neo-line);
  color: var(--neo-text);
  background: radial-gradient(ellipse at 85% 0%, color-mix(in srgb, var(--planning-template-color) 14%, transparent), transparent 70%),
    linear-gradient(150deg, #16243f, var(--neo-control));
  transition: border-color .15s ease, box-shadow .15s ease, background-color .15s ease;
}
.planning-template::before {
  position: absolute;
  inset-block-start: 0;
  inset-inline-start: 15px;
  width: 30px;
  height: 1px;
  background: var(--planning-template-color);
  box-shadow: 0 0 9px var(--planning-template-color);
  opacity: .65;
  content: "";
}
.planning-template:has(input[value="suspense"]) { --planning-template-color: #c8afff; }
.planning-template:has(input[value="urban"]) { --planning-template-color: #ffb6d8; }
.planning-template:has(input[value="growth"]) { --planning-template-color: var(--neo-amber); }
.planning-template:has(input[value="fantasy"]) { --planning-template-color: #b0c0ff; }
.planning-template:has(input[value="comedy"]) { --planning-template-color: #a2eccf; }
.planning-template:hover { border-color: #6580ab; }
.planning-template:has(input:checked) {
  border-color: var(--planning-template-color);
  box-shadow: inset 0 0 17px color-mix(in srgb, var(--planning-template-color) 13%, transparent),
    0 0 14px color-mix(in srgb, var(--planning-template-color) 14%, transparent);
}
.planning-template:focus-within { outline: 0; }
.planning-template:has(input:focus-visible) { outline: 2px solid var(--neo-cyan); outline-offset: 3px; }
.planning-template input { accent-color: var(--planning-template-color); }
.planning-template-description { color: var(--neo-muted); }

#story-instruction-area { gap: 15px; }
#story-instruction-area > h2 {
  padding: 4px 0 5px 11px;
  border-inline-start: 2px solid var(--neo-cyan);
}
#story-instruction { min-height: 128px; }
.story-stage-tab { color: var(--neo-muted); background: var(--neo-control); }
.story-stage-tab[aria-pressed="true"] { border-color: #72a8cf; color: var(--neo-cyan); background: #173452; }
.workbench-content .story-draft,
#story-workspace:has(#planning-workflow:not([hidden])) .story-draft {
  border-color: var(--neo-line);
  background: linear-gradient(155deg, var(--neo-raised), var(--neo-panel) 62%);
  box-shadow: var(--tool-shadow);
}
.workbench-content .story-draft-section {
  border-color: var(--neo-line);
  background: #0d172b;
}
.workbench-content .story-draft-section:focus-within { border-color: #6399c6; }
#story-draft-meta { margin-top: 4px; font-size: .83rem; }
.planning-draft-preview, .planning-adopt-actions { border-color: var(--neo-line); }
.planning-draft-block {
  border-color: var(--neo-line);
  background: var(--neo-control);
}
.planning-draft-block:first-child {
  border-inline-start-color: var(--neo-violet);
  background: linear-gradient(110deg, #26264e, #0d172b 76%);
}
.planning-draft-block :is(h4, h5) { color: var(--neo-violet); }
.planning-draft-block p { color: #d8e4fc; }
.planning-review {
  border-color: var(--neo-line);
  background: linear-gradient(145deg, #22264a, var(--neo-panel) 57%);
  box-shadow: var(--tool-shadow);
}
#planning-version-state {
  border-color: #625482;
  color: var(--neo-violet);
  background: #272246;
}
#story-workspace[aria-busy="true"] :is(#story-stage-message, #planning-feedback-message):not([hidden]) {
  border-color: #4874a8;
  color: #b9e9ff;
  background: #142b48;
}
#story-workspace[aria-busy="true"] :is(#story-stage-message, #planning-feedback-message):not([hidden])::before {
  flex: 0 0 12px;
  border-color: #5279a7;
  border-top-color: var(--neo-cyan);
}

/* Video generation and history */
.video-studio-banner-copy .video-studio-model-status {
  border-color: #47668d;
  color: #d6e6ff;
  background: #0d192de8;
}
.video-studio-model-status::before { background: var(--neo-amber); box-shadow: 0 0 9px #ffc39377; }
.video-studio-model-status.is-ready::before { background: #93efd0; box-shadow: 0 0 9px #93efd077; }
.video-studio-editor {
  grid-template-rows: auto minmax(0, 1fr);
  align-content: stretch;
}
.video-studio-editor #quote-fields { align-content: stretch; }
.video-studio-editor #prompt {
  min-height: min(260px, 46vh);
  border-color: #365377;
  background: linear-gradient(110deg, #10203b, var(--neo-control));
}
.video-studio-editor #prompt:focus { border-color: var(--neo-cyan); background: #111f38; }
.video-studio-editor #prompt:not(:disabled):hover { border-color: #69a3c7; }
.video-studio-engine {
  border-color: #4c5883;
  color: #d3c8ff;
  background: #1e2546;
  font-family: var(--tool-mono);
}
.video-studio-spec-grid .field :is(input, select) { background: var(--neo-control); }
.video-studio-billing {
  padding: 12px 13px;
  border-color: #3f6c91;
  background: linear-gradient(110deg, #15324a, #10203b);
}
.video-studio-balance { color: var(--neo-muted); }
.video-studio-balance dd {
  color: var(--neo-cyan);
  font: 700 1.02rem/1.3 var(--tool-mono);
  overflow-wrap: anywhere;
}
.video-studio-settings .video-studio-submit {
  border-color: #5086a9;
  color: var(--neo-cyan);
  background: #183550;
}
.video-studio-settings .video-studio-submit:hover:not(:disabled) { background: #214a68; }
.video-studio-settings .quote-card {
  border-color: #4b7495;
  background: #122843;
}
.video-studio-settings .quote-summary strong { color: var(--neo-cyan); }
.video-studio-empty {
  border-color: var(--neo-line);
  background: linear-gradient(110deg, #152942, var(--neo-control));
}
.video-studio-empty .workbench-icon {
  flex: 0 0 30px;
  border: 1px solid #42658a;
  color: var(--neo-cyan);
  background: #193c56;
}
.workbench-content :is(.video-studio-history, #feishu-panel) .job {
  border-color: var(--neo-line);
  background: linear-gradient(114deg, #162842, var(--neo-control) 72%);
}
.workbench-content :is(.video-studio-history, #feishu-panel) .job-top time { font-variant-numeric: tabular-nums; }
.video-studio-history .job-prompt { color: #dce8fb; }

/* Pictures, audio and approvals */
.workbench-content .studio-workspace { gap: 17px; }
.workbench-content .studio-workspace .studio-card {
  border-color: var(--neo-line);
  background: radial-gradient(ellipse at top right, var(--studio-wash, #5985d327), transparent 65%),
    linear-gradient(135deg, #15233d, var(--neo-control));
  box-shadow: inset 0 1px #b3d4ff13;
}
#studio-image-form { --studio-wash: #4ab5eb2c; --studio-accent: var(--neo-cyan); }
#studio-voice-form { --studio-wash: #a17de63b; --studio-accent: var(--neo-violet); }
#studio-view [data-workspace="publish"].studio-card { --studio-accent: var(--neo-cyan); }
.studio-workspace .studio-card > h3 {
  padding-inline-start: 10px;
  border-inline-start: 2px solid var(--studio-accent, var(--neo-violet));
  font-size: clamp(1rem, 2vw, 1.14rem);
}
.studio-records { padding-top: 15px; border-top: 1px solid var(--neo-line); }
.workbench-content .studio-media-card, .studio-findings li {
  border-color: var(--neo-line);
  background: #0e1a30;
}
.studio-image, .feishu-cover-preview {
  border-color: #3a587c;
  background: #081121;
}
.studio-preview video, .studio-report video, .edit-output video {
  border: 1px solid var(--neo-line);
  background: #070c17;
}
.studio-media-card audio { color-scheme: dark; }
.studio-stamp {
  color: var(--neo-cyan);
  background: #193b55;
  font-family: var(--tool-mono);
}
#feishu-pair-details { --studio-wash: #a17de646; }
#feishu-code {
  color: var(--neo-cyan);
  font-family: var(--tool-mono);
  font-weight: 700;
}
.feishu-auto { border-color: var(--neo-line); }
.feishu-checkbox input { accent-color: var(--neo-cyan); }
.feishu-version-feedback {
  padding: 8px 10px;
  border-inline-start: 2px solid #7768a9;
  background: #1c2543;
}

/* Editing and the generated shot sequence */
.workbench-content :is(.edit-input-row, .studio-file) input[type="file"] {
  padding: 7px;
  border-color: #45698c;
  border-style: dashed;
  background: #10243b;
}
.workbench-content :is(.edit-input-row, .studio-file) input[type="file"]::file-selector-button {
  max-width: 65%;
  border-color: #507da5;
  color: var(--neo-cyan);
  background: #1a3c56;
}
.workbench-content :is(.edit-input-row, .studio-file) input[type="file"]:disabled::file-selector-button {
  border-color: var(--neo-line);
  color: var(--neo-muted);
  background: var(--neo-panel);
  cursor: default;
}
.edit-panel .edit-plan {
  padding: clamp(12px, 2.1vw, 21px);
  border: 1px solid var(--neo-line);
  border-radius: 13px;
  background: linear-gradient(90deg, #42628620 1px, transparent 1px) 0 0 / 27px 100%, #0c172b;
}
.edit-segments { padding-inline-start: 26px; }
.edit-segments li {
  padding: 10px 12px;
  border-color: var(--neo-line);
  border-inline-start-color: #71d2f1;
  background: linear-gradient(90deg, #173450, #111d35 76%);
}
.edit-segments li::marker { color: var(--neo-cyan); font-family: var(--tool-mono); }
.edit-time {
  margin-inline-start: 9px;
  color: #bdd9f1;
  font-family: var(--tool-mono);
}
.edit-output { padding-top: 15px; border-top: 1px solid var(--neo-line); }

@media (max-width: 620px) {
  .planning-overview-copy { max-width: min(58ch, 82%); }
  .planning-overview::after, .video-studio-banner-art::after { inset-inline-end: -4%; opacity: .48; }
  .video-studio-editor #prompt { min-height: 175px; }
}
@media (max-width: 420px) {
  .planning-template { padding-block-start: 12px; }
  .planning-template::before { inset-inline-start: 9px; width: 25px; }
  .planning-overview-copy { max-width: 91%; }
  .planning-overview::after, .video-studio-banner-art::after { inset-inline-end: -10%; opacity: .31; }
  .edit-time { display: block; margin: 4px 0 0; }
}
@media (prefers-reduced-motion: reduce) {
  .planning-template, .studio-image img { transition: none; }
}

.recharge-workspace, .recharge-summary { display: grid; min-width: 0; gap: clamp(13px, 2vw, 21px); }
.recharge-summary { grid-template-columns: repeat(auto-fit, minmax(min(100%, 19rem), 1fr)); }
.recharge-workspace .heading-row { flex-wrap: wrap; align-items: center; }
.recharge-workspace :is(button, input, textarea, select, [tabindex]) { scroll-margin-block: calc(var(--workbench-bar-height) + 12px) 12px; }
.recharge-workspace .form-stack > .button { justify-self: start; }
.recharge-balance-panel {
  background: radial-gradient(ellipse at 100% 0, #244d7844, transparent 75%), linear-gradient(145deg, var(--neo-raised), var(--neo-panel) 67%);
}
.recharge-metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 7.5rem), 1fr));
  gap: 8px;
  margin-block: 2px 12px;
}
.recharge-metrics > div {
  min-width: 0;
  padding: 9px 11px;
  border: 1px solid var(--neo-line);
  border-radius: 8px;
  background: var(--neo-control);
}
.recharge-metrics dt, .recharge-record-fields dt { color: var(--neo-muted); font-size: .8rem; }
.recharge-metrics dd {
  margin: 4px 0 0;
  overflow-wrap: anywhere;
  color: var(--neo-cyan);
  font-family: var(--neo-mono);
  font-size: clamp(.94rem, 2vw, 1.25rem);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.recharge-balance-panel > .notice { margin-top: 12px; }
.recharge-instructions { margin-top: 14px; padding-top: 13px; border-top: 1px solid var(--neo-line); }
.recharge-instructions h3 { margin: 0 0 6px; font-size: 1rem; }
.recharge-instructions #recharge-payment-instructions { margin-bottom: 7px; overflow-wrap: anywhere; white-space: pre-wrap; }
.recharge-workspace :is(.recharge-help, #recharge-rate) { font-size: .88rem; }
.recharge-workspace > section > .recharge-help,
.recharge-summary .panel > .recharge-help { margin-bottom: 13px; }
#recharge-supplier-balances dd { color: var(--neo-violet); }
.recharge-workspace .recharge-filter {
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  font-size: .82rem;
}
.recharge-workspace .recharge-filter select { min-height: 36px; padding: 4px 7px; font-size: .88rem; }
.recharge-records { display: grid; gap: 9px; padding: 0; list-style: none; }
.recharge-records > li {
  display: grid;
  justify-items: start;
  gap: 9px;
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--neo-line);
  border-radius: 9px;
  background: linear-gradient(110deg, #172943, #121e34);
}
.recharge-record-heading { display: flex; flex-wrap: wrap; align-items: center; gap: 7px 13px; }
.recharge-record-heading strong { color: var(--neo-text); font-size: 1.18rem; overflow-wrap: anywhere; }
.recharge-record-fields {
  display: grid;
  width: 100%;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 10rem), 1fr));
  gap: 9px 13px;
}
.recharge-record-fields dd { margin: 3px 0 0; overflow-wrap: anywhere; font-size: .86rem; }
.recharge-more { margin-top: 12px; }
#recharge-list-message:not([hidden]) { margin-bottom: 10px; }
.recharge-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.recharge-checkout {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: center;
  gap: clamp(14px, 3vw, 24px);
}
.recharge-checkout-qr {
  flex: 0 1 224px;
  width: min(100%, 224px);
  min-width: 0;
  margin: 0;
  text-align: center;
}
.recharge-checkout-qr img {
  display: block;
  width: 100%;
  height: auto;
  border: 8px solid #fff;
  border-radius: 8px;
  background: #fff;
  image-rendering: pixelated;
}
.recharge-checkout-qr figcaption { margin-top: 6px; font-size: .85rem; }
.recharge-checkout-details {
  display: grid;
  flex: 1 1 260px;
  min-width: 0;
  gap: 12px;
}
.recharge-checkout-details :is(.recharge-help, .recharge-metrics) { margin: 0; }
.recharge-confirm-fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 14rem), 1fr)); gap: 12px; }
.workbench-content .recharge-text-link:is(:link, :visited) { width: fit-content; color: var(--neo-cyan); font-size: .86rem; text-underline-offset: .2em; }
}
