/* Homepage's charcoal/violet palette, limited to secondary workspaces.
   No media filters, canvas geometry, business behavior or light-mode overrides. */
.pearl-workbench.home-dark.workspace-refined:not(.home-light) {
  --vf-ink: #f5f5f5;
  --vf-muted: #b8b8b8;
  --vf-line: #383838;
  --vf-card: #1b1b1b;
  --vf-soft: #242424;
  --vf-accent: #c4a7ff;
  --vf-brand: #7c4cde;
  --vf-brand-2: #8959e6;
  --vf-pearl: #7c4cde;
  --vf-pearl-glow: none;
  --ws-selected: #352944;
  background: #121212;
  color: var(--vf-ink);
  accent-color: var(--vf-brand);
}

/* The shell stays the same when moving away from the homepage. */
.pearl-workbench.home-dark.workspace-refined:not(.home-light):has(.studio-main) .studio-rail {background:#101010; border-color:#303030;}
.pearl-workbench.home-dark.workspace-refined:not(.home-light):has(.studio-main) .rail-item.active {background:#2d243b; color:#fff; box-shadow:none;}
.home-dark.workspace-refined:not(.home-light) :is(.rail-item.active svg,.top-credit svg) {color:var(--vf-accent);}
.home-dark.workspace-refined:not(.home-light) :is(.top-credit em,.rail-account-icon) {color:var(--vf-ink);}
.home-dark.workspace-refined:not(.home-light) ::selection {background:#533a7b; color:#fff;}
.home-dark.workspace-refined:not(.home-light) :is(input,textarea) {caret-color:var(--vf-accent);}
.home-dark.workspace-refined:not(.home-light) :is(button,a,summary,input,textarea,select):focus-visible {outline:2px solid var(--vf-accent); outline-offset:3px;}
.home-dark.workspace-refined:not(.home-light) :is(table,.credit-balance-grid,.operations-kpis) {font-variant-numeric:tabular-nums;}

/* Shared neutral cards, including the administration screens and dialogs. */
.home-dark.workspace-refined:not(.home-light) :is(
  .operations-tabs,.operations-analytics,.redemption-admin,.announcement-admin,
  .customer-directory,.admin-video-library,.router-lab,.customer-credit-dialog,
  .operations-charts>article,.operations-users,.pricing-admin-grid form,.pricing-plan-list article,
  .announcement-history,.announcement-history article,.redemption-list article,.router-candidates article,
  .credit-admin,.credit-redeem,.team-side>form,.team-members>div>button,
  .api-key-list>article,.secret-once,.agent-step,.agent-script-choice article,
  .asset-preview-dialog,.announcement-modal
) {background:var(--vf-card); border-color:var(--vf-line); color:var(--vf-ink); box-shadow:none;}

.home-dark.workspace-refined:not(.home-light) :is(
  .operations-kpis article,.operations-kpis article.cost,.customer-credit-balance span,
  .customer-directory-summary button,.customer-directory-summary button:not(.effective),
  .customer-credit-dialog>form,.customer-credit-ledger>header,.customer-pricing-admin,
  .team-kpis article,.team-detail-grid>article,.team-avatar,.team-hero>div>span,
  .scope-option,.developer-doc-links a,.credit-redeem>div>span,.router-lab form,
  .router-lab .router-consent,.router-decision,.redemption-admin>form,
  .announcement-admin form,.announcement-modal-content,.customer-directory-search,
  .credit-activity-detail td,.pricing-override-fields fieldset,.developer-example,
  .developer-snippets,.api-key-list code,.status-message,.team-divider span,
  .asset-tabs button span,.publisher-compose header .setup
) {background:var(--vf-soft); border-color:var(--vf-line); color:var(--vf-ink); box-shadow:none;}

.home-dark.workspace-refined:not(.home-light) :is(.credits-loading,.operations-forbidden) {background:#121212; color:var(--vf-muted);}
.home-dark.workspace-refined:not(.home-light) :is(.credit-activity-table th,.customer-directory-table th,.operations-users th) {background:#222; color:var(--vf-muted); border-color:var(--vf-line);}
.home-dark.workspace-refined:not(.home-light) :is(.customer-directory-table td,.credit-activity-table td,.operations-users td) {background:transparent; color:var(--vf-ink); border-color:var(--vf-line);}
.home-dark.workspace-refined:not(.home-light) :is(.credit-activity-row:hover,.customer-directory-table tbody tr:hover) {background:#252525;}

/* Text inside old light cards must change with their surfaces. Status colors
   are deliberately separate below; never globally recolor every descendant. */
.home-dark.workspace-refined:not(.home-light) :is(
  .operations-tabs>button b,.operations-heading b,.operations-kpis b,
  .operations-charts header b,.operations-users header b,.redemption-list>header b,
  .announcement-history>header b,.announcement-history h3,.announcement-history p,
  .customer-directory-summary b,.customer-credit-dialog>header b,.customer-credit-balance b,
  .customer-credit-ledger article b,.customer-pricing-admin>header b,
  .pricing-admin-grid h3,.pricing-override-fields legend,.pricing-plan-list b,
  .team-members b,.team-detail b,.team-kpis b,.credit-redeem header b,
  .developer-card header b,.api-key-list b,.publisher-setup h2,
  .face-panel-heading b,.face-slider b,.smart-edit-create h2,.smart-project-list h2,
  .credit-activity-row td b,.credit-activity-title,.announcement-history article b
) {color:var(--vf-ink);}
.home-dark.workspace-refined:not(.home-light) :is(
  .pricing-admin-grid label,.customer-price-grid label>span,.customer-price-audit,
  .team-onboarding label,.team-invite label,.team-limits label,
  .customer-credit-dialog>form label,.announcement-admin form label,
  .redemption-admin>form label,.router-lab form>label,.face-slider,
  .agent-form label,.publisher-form>label,.smart-field>span,.developer-card legend
) {color:#ddd;}
.home-dark.workspace-refined:not(.home-light) :is(
  .pricing-plan-list small,.pricing-plan-list span,.pricing-admin-grid p,
  .customer-price-grid label small,.customer-price-audit small,.customer-credit-empty,
  .customer-credit-ledger time,.customer-credit-ledger article small,
  .customer-credit-dialog>header small,.team-members small,.team-detail small,
  .team-limits>p,.team-onboarding p,.developer-card small,.developer-card p,
  .developer-card li,.api-key-list small,.face-empty p,.publisher-empty p,
  .smart-edit-create p,.smart-project-list p,.agent-empty p,.team-divider span,
  .publisher-compose header .setup
) {color:var(--vf-muted);}
.home-dark.workspace-refined:not(.home-light) :is(
  .heading-icon,.smart-edit-icon,.asset-library-empty>div,.team-onboarding-icon,
  .developer-hero-title>span,.developer-endpoint code,.developer-card code,
  .developer-card a,.operations-heading>div,.customer-credit-dialog>header>div,
  .operations-kpis svg,.credit-title>svg,.credit-history-head>svg
) {color:var(--vf-accent);}

/* Violet means action or selection, not a large purple background everywhere. */
.home-dark.workspace-refined:not(.home-light) :is(
  .primary,.pearl-button,.agent-start>button,.agent-actions button,.panel-submit>button,
  .face-submit-bar>button,.publisher-compose>footer button,.publisher-connect button,
  .publisher-setup a,.developer-primary,.image-chat-submit>button,
  .team-invite>button,.team-onboarding form>button:not(.secondary),
  .team-balance button:not(.secondary),.team-limits button,.credit-redeem button,
  .credit-admin-actions button:not(.deduct),.customer-credit-dialog>form button:not(.deduct),
  .redemption-admin>form button,.router-lab form>button,.announcement-admin form button,
  .pricing-admin-grid button,.customer-price-actions button:first-child,
  .asset-preview-actions a,.announcement-modal>button,.registration-create button[type=submit]
) {background:var(--vf-brand); color:#fff; border-color:#a884f0; box-shadow:none;}
.home-dark.workspace-refined:not(.home-light) :is(
  .primary,.pearl-button,.agent-start>button,.face-submit-bar>button,.developer-primary,
  .image-chat-submit>button,.credit-redeem button,.pricing-admin-grid button,
  .announcement-admin form button,.redemption-admin>form button
):hover:not(:disabled) {background:var(--vf-brand-2); color:#fff; box-shadow:none;}
.home-dark.workspace-refined:not(.home-light) :is(
  .face-mode-tabs button.active,.asset-tabs button.active,.operations-tabs>button.active,
  .operations-tabs>button:hover,.team-members>div>button.active,.image-chat-modes label.selected,
  .scope-option:has(input:checked),.customer-credit-open,.customer-directory-summary button.active,
  .announcement-history article.active,.router-candidates article.selected,
  .agent-script-choice article.selected
) {background:var(--ws-selected); color:#e4d4ff; border-color:#8b66c2; box-shadow:none;}
.home-dark.workspace-refined:not(.home-light) .operations-tabs>button.active b {color:#e4d4ff;}
.pearl-workbench.home-dark.workspace-refined:not(.home-light) .credit-balance-grid article.primary {background:var(--ws-selected)!important; border-color:#8b66c2!important;}
.home-dark.workspace-refined:not(.home-light) .credit-balance-grid article.primary b {color:#e4d4ff;}
.home-dark.workspace-refined:not(.home-light) :is(
  .operations-heading>button,.operations-heading>em,.customer-credit-dialog>header>button,
  .team-hero>button,.team-ledger>header>button,.secret-once button,
  .customer-price-actions button:not(:first-child)
) {background:var(--vf-soft); color:var(--vf-ink); border-color:var(--vf-line); box-shadow:none;}
.home-dark.workspace-refined:not(.home-light) :is(.credit-message,.operations-message,.router-message,.customer-credit-message,.announcement-admin form>p,.team-message,.developer-message) {background:var(--ws-selected); color:#e4d4ff; border-color:#5e477b;}
.home-dark.workspace-refined:not(.home-light) :is(input,textarea,select):focus {border-color:#8b66c2;}

/* Functional status colors remain distinct and legible on dark surfaces. */
.home-dark.workspace-refined:not(.home-light) :is(.customer-valid,.customer-directory-summary .effective,.no-payment-note,.agent-trust,.developer-notice) {background:#1d3027; color:#a2e6c4; border-color:#3d6456;}
.home-dark.workspace-refined:not(.home-light) :is(.no-payment-note p,.developer-notice small,.customer-directory-summary .effective b,.customer-directory-summary .effective svg) {color:#a2e6c4;}
.home-dark.workspace-refined:not(.home-light) :is(.customer-invalid,.customer-directory-summary .inactive) {background:#272727; color:var(--vf-muted);}
.home-dark.workspace-refined:not(.home-light) :is(.customer-credit-dialog button.deduct,.credit-admin-actions button.deduct) {background:#382328; color:#ffb7c3; border-color:#74414c;}
.home-dark.workspace-refined:not(.home-light) :is(.customer-credit-ledger .positive,.team-ledger>div em.positive,.credit-activity-row .positive) {color:#9adfbf;}
.home-dark.workspace-refined:not(.home-light) :is(.customer-credit-ledger .negative,.team-ledger>div em.negative) {color:#ffb7c3;}
.home-dark.workspace-refined:not(.home-light) button:disabled {opacity:.55; cursor:not-allowed;}
.home-dark.workspace-refined:not(.home-light) :is(.announcement-history footer button,.face-result-actions button) {background:var(--vf-soft); color:var(--vf-ink); border-color:var(--vf-line);}
.home-dark.workspace-refined:not(.home-light) :is(.announcement-history article>div>span,.developer-endpoint em) {background:#1d3027; color:#a2e6c4; border-color:#3d6456;}
.home-dark.workspace-refined:not(.home-light) :is(.credit-status.credit,.credit-status.success) {background:#1d3027; color:#a2e6c4;}
.home-dark.workspace-refined:not(.home-light) :is(.credit-status.refunded,.credit-status.partial) {background:#362d1d; color:#ecd098;}
.home-dark.workspace-refined:not(.home-light) .credit-status.processing {background:var(--ws-selected); color:#e4d4ff;}
.home-dark.workspace-refined:not(.home-light) .credit-status.debit {background:#382328; color:#ffb7c3;}
.home-dark.workspace-refined:not(.home-light) :is(.face-privacy p,.face-privacy small) {color:#a2e6c4;}
.home-dark.workspace-refined:not(.home-light) :is(.team-divider,.face-submit-bar,.credit-history-head,.asset-tabs,.customer-credit-ledger,.customer-credit-ledger article) {border-color:var(--vf-line);}

/* Existing layouts stay in place; prevent long pricing labels spilling out. */
.home-dark.workspace-refined:not(.home-light) :is(.pricing-admin-grid,.operations-tabs) {min-width:0;}
.home-dark.workspace-refined:not(.home-light) :is(.pricing-admin-grid label,.pricing-plan-list span) {overflow-wrap:anywhere;}
