/* A / 紫雾. Content styling is gated off on the homepage; navigation is shared.
   Media pixels, subtitle settings, task progress values and provider state are not themed. */
.wb-icon, .wb-page-heading { display:none; }

html:not(.home-workspace) {
  --ink:#25183d; --text:#25183d; --muted:#746782;
  --paper:#f6f3fc; --surface:#faf8fd; --card:#fff;
  --line:#eae3f3; --line-strong:#dcd2ea;
  --green:#7939df; --green-strong:#6326c0; --green-soft:#f1e9fc;
  --lime:#7939df; --cyan:#d9c8f8; --danger:#b7405b;
  --shadow-sm:0 2px 3px rgba(53,26,85,.018),0 8px 28px rgba(65,34,105,.055);
  --shadow-md:0 20px 48px rgba(65,34,105,.1);
  --wb-hover:0 7px 15px rgba(96,48,160,.15),0 2px 3px rgba(63,27,114,.09),inset 0 1px rgba(255,255,255,.6);

  body { background:radial-gradient(ellipse at 89% 7%,#ede3fd 0,transparent 38%),radial-gradient(ellipse at 25% 85%,#f1ebfa 0,transparent 44%),var(--paper); }
  main { padding:26px 30px 112px; max-width:1600px; }
  .panel, .dark-panel { color:var(--ink); background:transparent; border:0; box-shadow:none; }
  .card { border-radius:20px; border-color:var(--line); background:#fff; box-shadow:var(--shadow-sm); }
  h2,h3,h4 { color:var(--ink); }
  label,.dark-panel label { color:#574665; font-weight:600; }
  p, small { line-height:1.6; }
  input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="color"]), textarea, select,
  .dark-panel :is(input,textarea,select) { color:var(--ink); background:#fff; border:1px solid var(--line-strong); border-radius:11px; font-size:14px; font-weight:500; }
  input::placeholder,textarea::placeholder { color:#918499; font-weight:400; }
  input:focus,textarea:focus,select:focus { border-color:#a17ad8; box-shadow:0 0 0 3px #7939df12; }
  :is(button,a,input,textarea,select,summary):focus-visible { outline:3px solid #a478e7; outline-offset:3px; }
  :is(input[type="checkbox"],input[type="radio"],input[type="range"]) { accent-color:var(--green); }
  .required-mark { color:#a44260; background:#fbedf2; font-size:10px; font-weight:600; }
  .optional-mark { color:var(--muted); background:var(--surface); }
  button { transform:none; transition:transform .2s ease,box-shadow .2s ease,background-color .2s ease,border-color .2s ease; }
  :is(.primary,.accent) { color:#fff; border:1px solid #7939df; background:linear-gradient(160deg,#8d50e4,#7939df); box-shadow:0 4px 10px #7939df1c,inset 0 1px #ffffff38; }
  :is(.secondary,.ghost) { color:var(--green-strong); border:1px solid #e7dbf6; background:#f4eefd; box-shadow:inset 0 1px #fff; }
  .ghost { background:#fff; }
  :is(.primary,.secondary,.accent,.ghost) { border-radius:11px; font-size:13px; font-weight:600; }
  :is(button,.primary,.accent,.secondary,.ghost):disabled { opacity:.52; cursor:not-allowed; transform:none!important; box-shadow:none!important; }
  :is(.danger,.history-delete) { color:#b7405b; background:#fff7f8; border:1px solid #f0d9e1; }
  .status.neutral { color:#73617f; background:#f4effa; border-color:var(--line); }
  .status.success { color:#6326c0; background:#f1e9fc; }
  .status.error { color:#a03951; background:#fff0f3; border-color:#f3d2dc; }
  .empty { color:var(--muted); border-color:var(--line); background:linear-gradient(135deg,#fcfbfe,#f8f4fd); border-radius:16px; }
  .empty:not(input):not(textarea) { min-height:112px; align-content:center; }
  #toast { color:#fff; background:#352044; box-shadow:0 14px 40px #2c114330; border:1px solid #ffffff20; }
  .section-heading h2 { font-size:26px; font-weight:700; letter-spacing:-.035em; }
  .section-heading p,.card-title p { color:var(--muted); font-size:13px; }
  .section-kicker { color:var(--green); background:#f0e7fc; border:1px solid #e6d8f9; }

  /* Small sculpted icon tiles; no filter or overlay is applied to customer media. */
  .wb-icon { display:inline-flex; align-items:center; justify-content:center; flex:0 0 auto; width:44px; height:44px; color:var(--green); background:linear-gradient(145deg,#faf6ff,#eadefa); border:1px solid #ffffffc0; border-radius:14px; box-shadow:0 5px 12px #713bad12,inset 0 1px #fff; }
  .wb-icon svg { width:22px; height:22px; display:block; }
  .wb-icon-heading { position:relative; padding-left:58px; min-height:44px; }
  .wb-icon-heading > .wb-icon { position:absolute; left:0; top:50%; margin-top:-22px; }
  .wb-page-heading { display:flex; align-items:center; gap:14px; margin:0 0 18px; min-height:52px; position:relative; }
  .wb-page-heading h2 { margin:0; font-size:26px; font-weight:700; letter-spacing:-.04em; }
  .wb-page-heading p { margin:3px 0 0; color:var(--muted); font-size:13px; }
  .wb-page-heading::after { content:""; position:absolute; right:20px; top:0; width:82px; height:42px; border:1px solid #ad7ded2b; border-radius:50%; transform:rotate(-24deg); box-shadow:16px 8px 0 -1px #f6f2fc,16px 8px 0 #ad7ded22; pointer-events:none; }
  [data-wb-icon]::before { content:""; display:inline-block; vertical-align:-3px; width:16px; height:16px; margin-right:6px; background:currentColor; mask:var(--wb-symbol) center/contain no-repeat; flex:0 0 auto; }
  [data-wb-icon] :is(.script-ai-indicator,.script-choice-icon,.script-action-icon),
  :is(#open-avatar-create,#open-voice-create,#open-visual-template-dialog)[data-wb-icon] > span[aria-hidden] { display:none; }

  /* 01: calm form rhythm and a distinct, scannable saved-file panel. */
  .entity-layout { gap:22px; grid-template-columns:minmax(0,1fr) 320px; }
  .entity-form { padding:24px; gap:19px 18px; }
  .entity-form-heading { padding-bottom:20px; gap:14px; }
  .entity-form-heading h3 { font-size:20px; font-weight:700; }
  .entity-form-heading p { font-size:12px; line-height:1.65; }
  .entity-form-heading > span { color:var(--green-strong); background:var(--green-soft); }
  .entity-form :is(input,select) { min-height:46px; }
  .entity-optional-section { background:#faf7fd; border-radius:14px; }
  .entity-optional-heading { background:linear-gradient(110deg,#f7f1fd,#fbf9fd); border-color:var(--line); }
  .entity-optional-heading strong { color:#503960; }
  .entity-optional-heading small { color:var(--muted); }
  .entity-optional-content { background:#fff; }
  .entity-custom-industry-context { background:#faf7fe; border-color:var(--line); }
  .history-card { padding:18px; top:94px; background:linear-gradient(165deg,#fff,#fcfaff); }
  .history-card .card-title h3 { font-size:18px; margin-bottom:4px; }
  .history-card .card-title p { font-size:11px; line-height:1.6; }
  .history-card .product-list { gap:10px; background:#faf7fd; scrollbar-color:#c9b4e1 #f8f4fc; }
  #knowledge .history-row { box-sizing:border-box; width:100%; min-width:0; min-height:102px; height:auto; padding:12px; border-radius:13px; border-color:var(--line); grid-template-columns:minmax(0,1fr); grid-template-rows:auto 42px; align-content:start; gap:11px; background:#fff; overflow:visible; }
  .history-row.active { border-color:#c5a6f1; background:#faf6ff; box-shadow:inset 3px 0 #9763e2; }
  .history-entity { min-width:0; }
  .history-entity strong { font-size:13px; }
  .history-entity::before,.history-index { background:#ede2fa; color:var(--green); box-shadow:none; }
  #knowledge .history-actions { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:6px; width:100%; min-width:0; }
  #knowledge .history-action { box-sizing:border-box; width:100%; min-width:0; max-width:100%; height:42px; min-height:42px; padding:6px 4px; border-radius:9px; font-size:10px; overflow:hidden; }
  .history-use { color:#fff; background:var(--green); border:1px solid var(--green); }
  .history-edit { color:var(--green-strong); background:#f1e9fc; border:1px solid #e8dcf6; }

  /* 02: the editor remains scrollable; no added banner above customer copy. */
  #scripts .script-template-picker { border-radius:18px; border-color:var(--line); box-shadow:var(--shadow-sm); background:#fff; padding:18px; }
  #scripts .script-library-content { gap:12px; }
  #scripts .script-picker-heading h3 { color:var(--ink); font-size:19px; }
  #scripts .script-picker-heading p { color:var(--muted); font-size:12px; }
  #scripts .script-picker-heading.wb-icon-heading { padding-left:48px; }
  #scripts .script-picker-heading .wb-icon { width:36px; height:38px; margin-top:-19px; border-radius:12px; }
  #scripts .script-category-tabs { gap:8px; padding:7px; border:1px solid #dbc6f5; border-radius:15px; background:#f2eafa; }
  #scripts .script-category-tabs:has(> button:nth-child(2):last-child) { grid-template-columns:repeat(2,minmax(0,1fr)); }
  #scripts .script-category-tabs:has(> button:nth-child(2):last-child) button { grid-column:auto; }
  #scripts .script-category-tabs button:only-child { grid-column:1/-1; }
  #scripts .script-category-tabs button {
    border:1px solid #e2d2f3; border-radius:10px; color:#593382; background:#f9f5ff;
    font-size:18px; font-weight:800; line-height:1.35; letter-spacing:.3px;
    min-height:54px; padding:10px 4px; text-decoration:none;
  }
  #scripts .script-category-tabs button.active {
    color:#fff; border-color:#7130c9; background:linear-gradient(150deg,#8541dc,#6d2bd0);
    box-shadow:0 5px 12px #7939df36,inset 0 1px #ffffff38;
  }
  #scripts .script-category-tabs button:focus-visible { outline:3px solid #ae82e9; outline-offset:2px; }
  @media (hover:hover) and (pointer:fine) {
    #scripts .script-category-tabs button:hover:not(.active):not(:disabled) { color:#54208a; background:#e9d9fb; border-color:#ba95e6; }
    #scripts .script-category-tabs button.active:hover { background:linear-gradient(150deg,#7938d0,#6022bd); }
  }
  #scripts .script-industry-type { border-radius:11px; color:#71607e; border:1px solid #eee7f5; background:#fcfafe; font-size:13px; padding:12px; }
  #scripts .script-industry-type.active { color:var(--green-strong); background:#f0e7fc; border-color:#d4bbee; box-shadow:inset 3px 0 #9d71da; }
  #scripts .script-quick-actions { border:1px solid var(--line); background:#fff; border-radius:16px; box-shadow:var(--shadow-sm); padding:16px 20px; }
  #scripts .script-quick-actions strong { color:var(--ink); font-size:17px; }
  #scripts .script-quick-actions span { color:var(--muted); }
  #scripts .script-quick-actions button span { color:inherit; }
  #scripts .script-quick-actions.is-generating { padding:24px clamp(18px,4vw,42px); }
  #scripts .script-quick-actions.is-generating .script-ai-generate:disabled {
    color:#fff;
    border-color:#7939df;
    background:linear-gradient(160deg,#8d50e4,#7939df);
    box-shadow:0 10px 24px #7939df2d,inset 0 1px #ffffff38!important;
    opacity:1;
  }
  #scripts .topic-card { border:1px solid var(--line); border-radius:18px; background:#fff; box-shadow:var(--shadow-sm); }
  #scripts .script-topic-actions button { min-height:43px; font-size:13px; border-radius:11px; }
  #scripts .script-topic-actions .accent { color:#fff; background:linear-gradient(150deg,#9456e8,#7939df); }
  #scripts .script-scene-row { border-color:var(--line); border-radius:13px; background:#faf8fe; padding:12px 14px; }
  #scripts .script-scene-number { color:var(--green-strong); font-weight:700; }
  #scripts .script-scene-function { color:var(--muted); font-weight:500; }
  #scripts .script-scene-row textarea { background:#fff; border-color:#e6ddee; font-weight:500; }
  #scripts :is(.script-structure-fields,.script-industry-types) { scrollbar-color:#c9b4e1 #f8f4fc; }

  /* 03: matched voice columns, purple selections, and truthful unavailable states. */
  #voices .voice-workspace-stack { padding:18px; border-radius:20px; }
  #voices .voice-library-group { border:1px solid var(--line); background:linear-gradient(140deg,#fdfbff,#f9f6fd); border-radius:15px; padding:12px; }
  #voices .voice-library-group-heading { height:auto; min-height:60px; margin-bottom:14px; flex-direction:row; flex-wrap:wrap; gap:12px; }
  #voices .voice-library-group-heading h4 { color:var(--ink); font-size:1.25rem; font-weight:800; line-height:1.3; min-height:44px; padding-left:56px; display:flex; align-items:center; white-space:nowrap; }
  #voices .voice-library-group-heading h4 > .wb-icon { width:44px; height:44px; margin-top:-22px; padding:0; border-radius:12px; }
  #voices .voice-library-group-heading .wb-icon svg { width:28px; height:28px; stroke-width:2.4; }
  #voices .voice-group-heading-actions { margin-left:auto; gap:10px; max-width:100%; flex-wrap:wrap; }
  #voices .voice-group-heading-actions > span { color:var(--muted); background:#ede5f6; border:0; font-size:.875rem; font-weight:800; white-space:nowrap; }
  #voices .voice-library-group-heading .voice-heading-create { display:inline-flex; align-items:center; justify-content:center; gap:8px; min-width:160px; max-width:100%; min-height:52px; height:auto; padding:10px 16px; border-radius:12px; font-size:1.125rem; font-weight:800; line-height:1.3; white-space:normal; }
  #voices #open-voice-create[data-wb-icon]::before { width:26px; height:26px; margin:0; mask:none; background:linear-gradient(currentColor,currentColor) center/3px 22px no-repeat,linear-gradient(currentColor,currentColor) center/22px 3px no-repeat; }
  #voices .voice-library-row { border:1px solid #e8e0f1; border-radius:12px; box-shadow:none; background:#fff; padding:9px 11px; gap:7px; min-width:0; }
  #voices .voice-library-row.selected { border-color:#ad80e5; box-shadow:inset 3px 0 #9862df,0 3px 8px #7939df09; background:#f5efff; }
  #voices .library-row-details { min-width:0; }
  #voices .library-row-details strong { color:var(--ink); font-size:14px; font-weight:650; }
  #voices .voice-card-actions { gap:6px; }
  #voices .voice-card-actions button { font-size:12px; min-height:36px; border-radius:9px; padding:7px 9px; }
  #voices .voice-select-choice { color:var(--green-strong); background:#f0e7fc; border-color:#e3d6f5; }
  #voices .selected .voice-select-choice { color:#fff; border-color:var(--green); background:var(--green); }
  #voices .voice-sample-play { color:var(--green-strong); border-color:#e6dcf1; background:#faf7fd; box-shadow:none; }
  /* With the redundant page banner removed, use the reclaimed space for more voices.
     The taller library also places live generation progress close to the bottom action dock. */
  #voices .voice-library-list { height:clamp(20rem,calc(100dvh - 18rem),36rem); grid-auto-rows:max-content; scrollbar-color:#ccb8e2 #f8f4fc; padding-right:7px; }
  /* 配音结果出现后仍多展示约两行音色，利用播放器下方的可用首屏空间。 */
  #voices:has(#voice-task-status:not([hidden]), #voice-preview-panel:not([hidden])) .voice-library-list { height:clamp(16.5rem,calc(100dvh - 25.5rem),34rem); }
  #voices .voice-library-card { gap:8px; }
  #voices .voice-library-group-heading { min-height:52px; margin-bottom:8px; }
  #voices .voice-generation-action-bar .status { margin:0; padding:10px 14px; }
  #voices .voice-preview-panel { padding:10px 14px; }
  #voices .voice-expression-unavailable { color:#8c6b78; font-size:10px; white-space:normal; }
  #voices .voice-preview-panel { border:1px solid #e2d4f3; background:linear-gradient(105deg,#f3eafb,#fcfaff); box-shadow:inset 0 1px #fff; }
  #voices .voice-preview-heading strong { color:var(--green-strong); }
  .voice-heading-create { background:var(--green); }

  /* 04: mode choice uses depth and spacing rather than saturated green slabs. */
  #editing .edit-mode-card { background:radial-gradient(ellipse at 95% 0,#f2e9fe,transparent 40%),#fff; border-color:var(--line); box-shadow:var(--shadow-sm); }
  #editing .edit-mode-card > div:first-child { column-gap:26px; }
  #editing .edit-mode-card > div:first-child h3 { font-size:25px; }
  #editing .edit-mode-card > div:first-child p { color:var(--muted); font-size:14px; }
  #editing .edit-mode-picker { background:#f6f1fc; border:1px solid var(--line); }
  #editing .edit-mode-option { border:1px solid transparent; background:transparent; color:var(--ink); border-radius:14px; }
  #editing .edit-mode-option.selected { color:#fff; background:linear-gradient(120deg,#8c4fe1,#7939df); border-color:#7939df; box-shadow:0 7px 16px #7939df26,inset 0 1px #ffffff44; }
  #editing .edit-mode-index { color:var(--green); background:#eadef9; border:1px solid #ddcdf1; box-shadow:inset 0 1px #fff; }
  #editing .selected .edit-mode-index { color:#fff; background:#ffffff21; border-color:#ffffff38; box-shadow:inset 0 1px #ffffff28; }
  #editing .edit-mode-copy small { color:var(--muted); }
  #editing .selected .edit-mode-copy small { color:#f0e2ff; }
  #editing :is(.auto-mix-action,.avatar-talk-action) { background:radial-gradient(ellipse at 0 0,#eee3fc,transparent 55%),#fbf9fe; border-color:#e6daf5; }
  #editing :is(.auto-mix-mark,.avatar-talk-mark) { color:var(--green); background:linear-gradient(145deg,#fff,#e3d3f6); border:1px solid #fff; border-radius:15px; box-shadow:0 7px 14px #7939df17,inset 0 1px #fff; }
  #editing :is(.auto-mix-copy,.avatar-talk-copy) p { color:var(--muted); }
  #editing .avatar-talk-current { background:transparent; border:0; box-shadow:none; }
  #editing .avatar-talk-current > strong { color:var(--muted); }
  #editing .avatar-talk-frame { background:#291b3d; border-color:#eee4fa; box-shadow:0 9px 24px #4c276425; }
  #editing #choose-full-avatar { color:var(--green-strong); background:#eee3fc; border:1px solid #dac4f3; }
  #editing #generate-avatar-composition { box-shadow:0 6px 15px #7939df20; }
  #editing .visual-preview-stage { background:linear-gradient(140deg,#f2eafa,#faf8fe); border-color:var(--line); }
  #editing :is(.visual-headline-card,.visual-preview-controls,.visual-preview-music) { background:#fff; border-color:var(--line); }
  #editing .visual-preview-phone { border-color:#d6c2ee; box-shadow:0 16px 36px #57308224; }
  #editing .presentation-option-icon { color:var(--green); background:#f1e8fb; }
  /* Selected output templates keep their own artwork and preview colours. */
  :is(.visual-template-card,.avatar-library-card,.material-asset-card).selected { border-color:#a675e4; box-shadow:0 0 0 3px #7939df15; }
  .visual-template-card { border-color:var(--line); border-radius:18px; background:#fff; }
  .visual-template-card-copy { background:#fff; color:var(--ink); }
  .visual-template-card-copy small { color:var(--muted); }
  .visual-template-view { background:rgba(255,255,255,.96); color:var(--green-strong); border:1px solid #e6d4f6; box-shadow:0 3px 12px #42225c20; }
  .visual-template-use { color:#fff; background:#7939df; border:1px solid #a379e5; box-shadow:0 3px 12px #44225930; }
  .visual-template-use:hover:not(:disabled) { background:#8a4be0; }
  .visual-template-view:hover:not(:disabled) { background:#f3eaff; }

  /* 05 + asset pages: one consistent card system; platform logos keep their identity. */
  .publishing-platform-card { background:#fcfaff; border-color:var(--line); border-radius:12px; }
  .publishing-platform-card:has(input:checked) { border-color:#b48ade; background:#f5edfe; }
  :is(.publishing-account-card,.publishing-result-card,.portfolio-card,.material-asset-card,.avatar-library-card) { border-color:var(--line); border-radius:16px; background:#fff; box-shadow:var(--shadow-sm); }
  :is(.publishing-platforms,.publishing-preview-card,.publishing-results,.material-selection-toolbar,.material-library-toolbar) { border-color:var(--line); }
  :is(.material-folder-button,.material-folder-chip).active { color:var(--green); background:#f0e6fc; border-color:#cdb4ec; }
  .material-library-toolbar .status { color:var(--muted); background:#f8f4fc; }
  .material-library-section { min-width:0; }
  .material-selection-toolbar { flex-wrap:wrap; }
  .material-selection-toolbar > span { min-width:0; }
  .portfolio-created-at,.portfolio-tags { color:var(--muted); }
  :is(#avatar-list,#material-asset-list,#portfolio-list).empty { display:grid; justify-items:center; align-content:center; gap:14px; min-height:220px; padding:36px 20px; text-align:center; border:1px dashed #ddceed; background:radial-gradient(ellipse at 50% 45%,#f1e9fc,transparent 60%),#fdfbff; }
  :is(#avatar-list,#material-asset-list,#portfolio-list).empty::before { content:""; width:46px; height:46px; border:1px solid #d8c3f1; border-radius:14px; transform:rotate(-7deg); background:linear-gradient(145deg,#fff,#e7d8f8); box-shadow:7px 7px 0 -1px #f6f0fd,7px 7px 0 #e5d7f5; }
  .publishing-compose { gap:20px; }
  .publishing-settings { display:grid; align-content:start; gap:14px; }
  .publishing-preview-card > h3,.publishing-settings > h3 { margin:0 0 8px; font-size:20px; align-content:center; }
  .publishing-results { margin-top:22px; }
  :is(.live-task-progress-track,.publishing-progress,.task-progress) { background:#e7ddf2; }
  .live-task-progress-fill { background:linear-gradient(90deg,#a775eb,#7939df); }
  #avatars .avatar-library-section { border-radius:20px; }
  #avatars .avatar-library-toolbar .avatar-pane-heading { padding-left:58px; }
  #avatars .avatar-library-toolbar h2 { font-size:26px; }
  #avatars .avatar-manager-panel .media-library-grid:not(.empty),
  .material-asset-grid:not(.empty),.portfolio-grid:not(.empty) { display:grid; grid-template-columns:repeat(auto-fill,minmax(min(200px,100%),1fr)); justify-content:start; justify-items:stretch; align-content:start; gap:18px; }
  #avatars .avatar-manager-panel .media-library-grid:not(.empty) { margin-top:22px; }
  .avatar-library-card { padding:10px; gap:10px; max-width:none; }
  .avatar-library-card > strong { font-size:13px; }
  .avatar-card-actions button { height:auto; min-height:36px; border-radius:9px; font-size:12px; padding:7px 4px; }
  .material-asset-card > div { padding:10px; gap:7px; }
  .material-asset-card strong { font-size:13px; line-height:1.5; }
  .material-asset-card small { color:var(--muted); font-size:11px; line-height:1.5; }
  .material-card-actions { gap:5px; }
  .material-card-actions button { height:auto; min-height:32px; font-size:11px; padding:6px 3px; border-radius:8px; }
  .material-card-select { color:#fff; background:rgba(50,28,71,.78); border-color:#ffffff75; }
  #avatar-talk-empty { color:#d4c2e9; }

  .creation-progress-dock { background:rgba(255,255,255,.96); border-top:1px solid #e5dcef; box-shadow:0 -6px 25px #55277707; }
  .creation-progress-copy > span { color:var(--muted); }
  .creation-progress-track { background:#eae0f5; }
  .creation-progress-track i { background:linear-gradient(90deg,#ad7cf1,#7939df); }
  .creation-progress-action { border-radius:12px; box-shadow:0 4px 12px #7939df24,inset 0 1px #ffffff30; }
  dialog { background:#fff; border-color:#e5d9f3; border-radius:22px; box-shadow:0 24px 90px #30164838; }
  dialog::backdrop { background:rgba(37,21,54,.35); backdrop-filter:blur(7px); }
  dialog .dialog-card { border-color:var(--line); background:#fff; }
  dialog :is(.dialog-heading,.dialog-actions) { border-color:var(--line); }
  dialog :is(.voice-upload-panel,.avatar-upload-panel,.voice-record-panel) { background:#faf7fe; border-color:#e5d8f3; }
  #avatar-form .avatar-owner-consent {
    display:grid; grid-template-columns:22px minmax(0,1fr); align-items:start; gap:12px;
    padding:14px; border:1px solid #e4d5f6; border-radius:12px;
    background:#f3ecfc; color:#57416d; font-size:14px; font-weight:500; line-height:1.65; cursor:pointer;
  }
  #avatar-form .avatar-owner-consent input {
    width:22px; height:22px; min-height:22px; margin:1px 0 0; padding:0; accent-color:#7939df;
  }
  #avatar-form .avatar-owner-consent:has(input:checked) { border-color:#b88bea; background:#efe3fc; }
  #avatar-form .avatar-owner-consent:focus-within { outline:2px solid #b88bea; outline-offset:2px; }
  .voice-create-card { border-color:var(--line); background:#fcfaff; box-shadow:none; }
  .voice-create-card.active { border-color:#b895e9; box-shadow:0 8px 20px #7939df10; }
  .voice-create-card:focus-within { border-color:#ae83e2; box-shadow:0 0 0 3px #7939df12; }
  .voice-create-heading { border:0; border-bottom:1px solid var(--line); box-shadow:none; border-radius:0; background:transparent; }
  .voice-create-heading:hover:not(:disabled) { transform:none; box-shadow:none; background:transparent; }
  .voice-create-icon { border:1px solid #e5d5f9; background:linear-gradient(145deg,#faf6ff,#ecdefb); box-shadow:0 6px 14px #7939df14,inset 0 1px #fff; }
  .voice-create-icon > .wb-icon { background:none; border:0; box-shadow:none; width:100%; height:100%; color:inherit; }
  .voice-reading-label { color:#665173; font-size:13px; }
  .voice-record-level { background:#e9def4; }
  input[type="file"]::file-selector-button { border:1px solid #dfcdf5; border-radius:6px; padding:5px 9px; background:#f3eafc; color:var(--green-strong); margin-right:12px; cursor:pointer; }
  .workspace-login { background:radial-gradient(ellipse at 30% 0,#ebddfb,transparent 60%),#f9f6fd; }
  .workspace-login-card { box-shadow:0 22px 60px #592b8220; }

  @media (hover:hover) and (pointer:fine) {
    button:hover:not(:disabled) { transform:translateY(-2px); box-shadow:var(--wb-hover); }
    :is(.primary,.accent):hover:not(:disabled) { background:linear-gradient(155deg,#995fea,#7939df); box-shadow:0 9px 19px #7939df30,0 2px 3px #50258625,inset 0 1px #ffffff55; }
    :is(.secondary,.ghost):hover:not(:disabled) { background:#eee4fb; border-color:#cfb7eb; }
    :is(.danger,.history-delete):hover:not(:disabled) { color:#a22d48; background:#ffeef3; border-color:#e6b8c6; }
    .wb-icon { transition:transform .25s ease,box-shadow .25s ease; }
    :is(.material-asset-card,.avatar-library-card,.portfolio-card):hover { border-color:#ceb6ec; box-shadow:0 10px 26px #65399216; }
    button:active:not(:disabled) { transform:translateY(0); box-shadow:inset 0 2px 4px #52207512; }
  }
  @media (prefers-reduced-motion:no-preference) {
    .active-page > .wb-page-heading .wb-float,
    .active-page .entity-form-heading .wb-float,
    .active-page .script-picker-heading .wb-float,
    .active-page .edit-mode-card > .wb-icon-heading .wb-float,
    .active-page .asset-section-heading .wb-float,
    .active-page .avatar-library-toolbar .wb-float { animation:wb-drift 5.5s ease-in-out infinite; }
  }
  @media (prefers-reduced-motion:reduce) {
    *,*::before,*::after { animation:none!important; transition:none!important; scroll-behavior:auto!important; }
    button:hover:not(:disabled),.tabs a:hover .wb-icon { transform:none!important; }
  }
  @media (max-width:1200px) {
    .entity-layout { grid-template-columns:minmax(0,1fr) 280px; gap:16px; }
    .entity-form { padding:18px; gap:16px 12px; }
    .entity-form .field-span-4 { grid-column:span 6; }
    .entity-form > label.field-span-4:nth-of-type(3) { grid-column:1/-1; }
    .entity-form-heading p { max-width:34ch; }
    #voices .voice-library-groups { grid-template-columns:1fr; }
    #voices .voice-library-list { height:clamp(12rem,34dvh,22rem); }
    #voices .voice-preview-panel { order:-1; grid-template-columns:1fr; }
  }
  @media (max-width:1000px) {
    main { padding:22px 20px 112px; }
    .entity-layout { grid-template-columns:1fr; }
    .history-card { position:static; }
    .history-card .product-list { grid-template-columns:repeat(2,minmax(0,1fr)); }
    .material-library-toolbar { grid-template-columns:auto minmax(0,1fr) auto; }
    .material-folder-list { grid-column:1/-1; grid-row:2; }
    #material-library-quota { grid-column:1/-1; grid-row:3; text-align:left; }
  }
  @media (max-width:760px) {
    main { grid-column:1; grid-row:3; padding:18px 14px 116px; }
    .creation-progress-dock { left:0; }
    .creation-progress-dock-inner { padding-inline:16px; gap:10px; }
    .creation-progress-copy { min-width:96px; }
    .creation-progress-track { width:64px; }
    .creation-progress-action { min-width:0; font-size:12px; padding:9px 12px; }
    .history-card .product-list { grid-template-columns:1fr; }
    .entity-form .field-span-4,.entity-form .field-span-6 { grid-column:1/-1; }
    .entity-persona-fields { grid-template-columns:1fr; }
    .entity-form-heading > span { display:none; }
    .entity-custom-industry-context { grid-template-columns:1fr; }
    .wb-page-heading h2 { font-size:22px; }
    .wb-page-heading p { font-size:12px; }
    .wb-page-heading::after { display:none; }
    #scripts .script-library-layout { grid-template-columns:1fr; }
    #scripts .script-category-tabs button { font-size:16px; min-height:50px; }
    #scripts .script-industry-types { max-height:180px; }
    #scripts .script-topic-actions { gap:6px; }
    #scripts .script-topic-actions button { font-size:11px; padding:8px 6px; }
    #voices .voice-library-group-heading { height:auto; min-height:60px; gap:10px; flex-direction:row; flex-wrap:wrap; align-items:center; }
    #voices .voice-library-group-heading h4 { min-height:44px; margin:0; }
    #voices .voice-library-group-heading .voice-heading-create { min-width:0; padding-inline:14px; }
    #voices .voice-group-heading-actions { margin-left:auto; }
    #voices .voice-library-row { grid-template-columns:1fr; }
    #voices .voice-card-actions { display:flex; flex-wrap:wrap; }
    #voices .voice-card-actions button { width:auto; min-width:0; flex:1 1 auto; }
    #voices .voice-card-actions .voice-select-choice { flex-basis:100%; }
    #voices .voice-library-list { height:320px; }
    #avatars .avatar-manager-panel .media-library-grid:not(.empty),
    .material-asset-grid:not(.empty),.portfolio-grid:not(.empty) { grid-template-columns:repeat(auto-fill,minmax(min(160px,100%),1fr)); gap:12px; }
    #editing .edit-mode-card > div:first-child.wb-icon-heading { padding-left:54px; }
    #editing .edit-mode-card > div:first-child h3 { font-size:22px; }
    #editing .edit-mode-card > div:first-child p { font-size:12px; }
    #editing .auto-mix-action { padding:18px; }
    :is(.publishing-compose,.publishing-account-grid) { grid-template-columns:minmax(0,1fr); }
    .publishing-platforms { min-width:0; }
    .publishing-platform-card { min-width:0; }
    [data-wb-icon]::before { width:14px; height:14px; margin-right:4px; }
  }
}
@keyframes wb-drift { 0%,100% { transform:translateY(0) rotate(-2deg); } 50% { transform:translateY(-4px) rotate(2deg); } }

/* Default industries retain their existing AI progress emphasis. */
html:not(.home-workspace) #scripts .script-quick-actions.is-generating .script-ai-generate:disabled {
  color:#fff!important;
  border-color:#7939df!important;
  background:linear-gradient(160deg,#8d50e4,#7939df)!important;
  box-shadow:0 10px 24px #7939df2d,inset 0 1px #ffffff38!important;
  opacity:1!important;
}

/* A direct download action beside the native player, not inside its overflow menu. */
#voices .voice-audio-controls {
  display:grid; grid-template-columns:minmax(0,1fr); align-items:center; gap:12px;
  min-width:0;
}
#voices .voice-audio-controls audio { width:100%; min-width:0; }
#voices .voice-download {
  display:inline-flex; align-items:center; justify-content:center; gap:8px;
  min-width:100px; min-height:46px; padding:10px 18px; margin:0;
  font-size:16px; font-weight:750; line-height:1.4; white-space:nowrap; border-radius:12px;
}
#voices .voice-download svg { width:20px; height:20px; flex:0 0 20px; }
#voices .voice-download:focus-visible { outline:3px solid #a875ef; outline-offset:3px; }
@media (max-width:600px) {
  #voices .voice-audio-controls { gap:8px; }
  #voices .voice-download { min-width:72px; padding:10px 12px; gap:5px; font-size:14px; }
  #voices .voice-download svg { width:16px; height:16px; flex-basis:16px; }
}

/* Manual industries: keep the editable path primary, even while AI is busy. */
html:not(.home-workspace) #scripts :is(.script-quick-actions,.script-topic-actions).custom-industry-priority {
  .script-custom-open, .script-ai-generate, .script-rewrite-compact {
    display:inline-flex; align-items:center; justify-content:center; gap:12px;
    min-height:64px;
  }
  :is(.script-custom-open,.script-ai-generate,.script-rewrite-compact)[data-wb-icon]::before {
    content:""; flex:0 0 28px; width:28px; height:28px; margin-right:0;
  }
  .script-custom-open {
    color:#fff; border-color:#7939df;
    background:linear-gradient(160deg,#8d50e4,#7939df);
    box-shadow:0 10px 24px #7939df30,inset 0 1px #ffffff38;
  }
  .script-ai-generate, .script-ai-generate:disabled {
    color:#6326c0!important; border-color:#e7dbf6!important;
    background:#f4eefd!important;
    box-shadow:inset 0 1px #fff!important; opacity:1!important;
  }
  @media (hover:hover) and (pointer:fine) {
    .script-custom-open:hover:not(:disabled) {
      transform:translateY(-3px);
      background:linear-gradient(160deg,#995cf0,#7130d8);
      box-shadow:0 14px 30px #7939df40,inset 0 1px #ffffff50;
    }
    .script-custom-open:active:not(:disabled) { transform:translateY(0); }
    .script-ai-generate:hover:not(:disabled) { background:#eee4fb!important; }
  }
  @media (prefers-reduced-motion:no-preference) {
    .script-custom-open[data-wb-icon]::before { animation:wb-custom-script-float 3s ease-in-out infinite; }
  }
  @media (max-width:760px) {
    :is(.script-custom-open,.script-ai-generate,.script-rewrite-compact)[data-wb-icon]::before { flex-basis:24px; width:24px; height:24px; }
  }
}
@keyframes wb-custom-script-float {
  0%,100% { transform:translateY(1px) rotate(-3deg); }
  50% { transform:translateY(-3px) rotate(3deg); }
}

/* Completed videos live in three folders; the editor only shows live progress. */
html:not(.home-workspace) {
  #auto-mix-results { grid-template-columns:repeat(5,minmax(150px,1fr)); gap:10px; width:100%; max-width:1200px; margin-inline:auto; overflow-x:auto; }
  #auto-mix-results[hidden] { display:none; }
  #auto-mix-results .auto-mix-result { align-content:start; gap:8px; border-color:var(--line); min-height:100px; }
  #auto-mix-results .auto-mix-preview-frame { width:100%; max-width:190px; justify-self:center; }
  #auto-mix-results .auto-mix-result small { color:var(--muted); }
  #auto-mix-results progress { accent-color:var(--green); }
  #portfolio .portfolio-total { margin:0 0 22px; color:var(--muted); font-size:13px; }
  #portfolio .portfolio-folders { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:20px; padding:8px 0 28px; }
  #portfolio .portfolio-folder { position:relative; display:grid; grid-template-columns:minmax(0,1fr) auto; gap:24px 12px; text-align:left; padding:24px; min-height:200px; border:1px solid #e4d8f5; border-radius:22px; background:linear-gradient(145deg,#fff 35%,#f7f1ff); color:var(--ink); box-shadow:0 6px 20px #4e258009,inset 0 1px #fff; transition:transform .2s ease,box-shadow .2s ease,border-color .2s ease; cursor:pointer; }
  #portfolio .portfolio-folder.selected { border-color:#a16aea; background:linear-gradient(145deg,#fff,#eee2fd); box-shadow:0 8px 24px #7939df15,inset 0 0 0 1px #a16aea; }
  #portfolio .portfolio-folder-icon { position:relative; align-self:center; margin-top:8px; width:59px; height:41px; border-radius:7px 10px 10px 10px; background:linear-gradient(145deg,#b081f5,#7939df); box-shadow:0 8px 12px #7939df27,inset 0 2px 1px #ffffff60; transform:rotate(-5deg); transition:transform .2s ease; }
  #portfolio .portfolio-folder-icon::before { content:""; position:absolute; top:-7px; left:0; width:26px; height:10px; border-radius:6px 8px 0 0; background:#a272e8; }
  #portfolio .portfolio-folder-icon::after { content:""; position:absolute; inset:8px 6px auto; height:1px; background:#ffffff80; }
  #portfolio .portfolio-folder-count { grid-column:2; grid-row:1; align-self:start; padding:6px 12px; border:1px solid #e1d1f5; border-radius:999px; background:#fff9; color:#7434cb; font-size:13px; font-weight:700; }
  #portfolio .portfolio-folder-copy { grid-column:1/-1; display:grid; gap:9px; min-width:0; }
  #portfolio .portfolio-folder-copy strong { font-size:clamp(18px,1.6vw,24px); line-height:1.3; font-weight:750; }
  #portfolio .portfolio-folder-copy small { color:var(--muted); font-size:13px; line-height:1.6; font-weight:400; }
  #portfolio .portfolio-folder-heading { display:flex; align-items:center; flex-wrap:wrap; gap:16px; padding:20px 0 8px; border-top:1px solid var(--line); }
  #portfolio .portfolio-folder-heading[hidden] { display:none; }
  #portfolio .portfolio-folder-heading h3 { margin:0; font-size:20px; }
  #portfolio .portfolio-folder-heading span { margin-left:auto; color:var(--muted); font-size:12px; }
  #portfolio .portfolio-grid.empty { grid-template-columns:1fr; justify-items:center; align-content:center; gap:14px; text-align:center; margin-top:0; background:#faf7fd; border:1px dashed #ded1f0; box-shadow:none; border-radius:20px; min-height:170px; }
  #portfolio .portfolio-card { padding:14px; border-radius:18px; gap:10px; }
  #portfolio .portfolio-card strong { line-height:1.5; }
  #portfolio .portfolio-folder:focus-visible { outline:3px solid #a875ef; outline-offset:4px; }
  @media (hover:hover) and (prefers-reduced-motion:no-preference) {
    #portfolio .portfolio-folder:hover { transform:translateY(-4px); box-shadow:0 14px 30px #6834a91c; border-color:#b88cea; }
    #portfolio .portfolio-folder:hover .portfolio-folder-icon { transform:translateY(-3px) rotate(0deg); }
    #portfolio .portfolio-folder:active { transform:translateY(-1px); }
  }
  @media (max-width:1100px) {
    #portfolio .portfolio-folders { gap:12px; }
    #portfolio .portfolio-folder { padding:20px 16px; min-height:190px; }
  }
  @media (max-width:680px) {
    #portfolio .portfolio-folders { grid-template-columns:1fr; gap:14px; padding-bottom:22px; }
    #portfolio .portfolio-folder { grid-template-columns:48px minmax(0,1fr) auto; align-items:center; gap:16px; min-height:116px; padding:20px 16px; }
    #portfolio .portfolio-folder-icon { width:44px; height:32px; }
    #portfolio .portfolio-folder-copy { grid-column:2; grid-row:1; }
    #portfolio .portfolio-folder-copy small { font-size:12px; }
    #portfolio .portfolio-folder-count { grid-column:3; align-self:center; padding:5px 8px; }
    #portfolio .portfolio-folder-heading { gap:10px; }
    #portfolio .portfolio-folder-heading span { width:100%; margin-left:0; }
  }
}
