/**
 * Shared workflow UI: brand bar (logos + theme toggle) and light/dark theme.
 * Loaded after page inline styles; uses html[data-theme="light"|"dark"].
 */

/* —— Top brand bar —— */
.workflow-topbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 1rem;
  margin-bottom: 1rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border, #2b3448);
}

.workflow-brand-mark {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.85rem 1.1rem;
  text-decoration: none;
  color: inherit;
  min-width: 0;
}

.workflow-brand-mark:hover .workflow-studio-name {
  color: var(--accent, #6eb8ff);
}

.workflow-brand-text {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 0;
}

.workflow-studio-name {
  font-size: 1.38rem;
  font-weight: 650;
  letter-spacing: 0.04em;
  line-height: 1.15;
  color: var(--text, #f0f2fa);
  transition: color 0.15s ease;
}

.workflow-studio-tagline {
  font-size: 0.8rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted, #8b95ad);
}

.workflow-story-breadcrumb {
  font-size: 0.74rem;
  font-weight: 500;
  line-height: 1.35;
  letter-spacing: 0.01em;
  color: var(--muted, #9aa4b2);
  margin-top: 0.12rem;
  max-width: min(36rem, 72vw);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.workflow-logo {
  display: block;
  height: auto;
  width: auto;
  object-fit: contain;
  flex-shrink: 0;
}

.workflow-logo--fa {
  max-height: 3.75rem;
  max-width: 3.75rem;
}

.workflow-theme-btn {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.85rem;
  height: 2.85rem;
  padding: 0;
  border-radius: 10px;
  border: 1px solid var(--border, #2b3448);
  background: var(--surface, #121825);
  color: var(--text, #eef2ff);
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
}

.workflow-theme-btn:hover {
  border-color: var(--accent, #5ed4ff);
  color: var(--accent, #5ed4ff);
}

.workflow-theme-btn:focus-visible {
  outline: 2px solid var(--accent, #5ed4ff);
  outline-offset: 2px;
}

.workflow-theme-btn svg {
  width: 1.25rem;
  height: 1.25rem;
}

.workflow-restart-btn {
  border-color: rgba(239, 68, 68, 0.7);
  background: rgba(127, 29, 29, 0.28);
  color: #f87171;
}

.workflow-restart-btn:hover {
  border-color: #ef4444;
  background: rgba(185, 28, 28, 0.38);
  color: #fecaca;
}

.workflow-restart-btn:disabled {
  opacity: 0.55;
  cursor: wait;
}

.workflow-topbar-actions {
  display: inline-flex;
  flex-shrink: 0;
  align-items: center;
  gap: 0.5rem;
}

/* —— Account menu (top bar) —— */
.wf-account-menu {
  position: relative;
}

.wf-account-trigger {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  max-width: min(16rem, 42vw);
  padding: 0.35rem 0.55rem 0.35rem 0.4rem;
  border-radius: 10px;
  border: 1px solid var(--border, #2b3448);
  background: var(--surface, #121825);
  color: var(--text, #eef2ff);
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
}

.wf-account-trigger:hover,
.wf-account-menu.is-open .wf-account-trigger {
  border-color: var(--accent, #5ed4ff);
}

.wf-account-trigger:focus-visible {
  outline: 2px solid var(--accent, #5ed4ff);
  outline-offset: 2px;
}

.wf-account-avatar {
  flex-shrink: 0;
  width: 2rem;
  height: 2rem;
  border-radius: 999px;
  background: linear-gradient(135deg, #3b82f6, #8b5cf6);
  color: #fff;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background-size: cover;
  background-position: center;
}

.wf-account-trigger-text {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  min-width: 0;
  text-align: left;
}

.wf-account-name {
  font-size: 0.88rem;
  font-weight: 600;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.wf-account-sub {
  font-size: 0.68rem;
  color: var(--muted, #8b95ad);
  line-height: 1.2;
  white-space: nowrap;
}

.wf-account-chevron {
  flex-shrink: 0;
  width: 0.95rem;
  height: 0.95rem;
  color: var(--muted, #8b95ad);
  transition: transform 0.15s ease;
}

.wf-account-menu.is-open .wf-account-chevron {
  transform: rotate(180deg);
}

.wf-account-dropdown {
  position: absolute;
  top: calc(100% + 0.45rem);
  right: 0;
  z-index: 120;
  width: min(18.5rem, 92vw);
  border-radius: 12px;
  border: 1px solid var(--border, #2b3448);
  background: var(--surface, #121825);
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.35);
  overflow: hidden;
}

.wf-account-dropdown-head {
  padding: 0.85rem 1rem 0.65rem;
  border-bottom: 1px solid var(--border, #2b3448);
}

.wf-account-dropdown-head strong {
  display: block;
  font-size: 0.95rem;
  font-weight: 650;
  margin-bottom: 0.15rem;
}

.wf-account-dropdown-head span {
  display: block;
  font-size: 0.78rem;
  color: var(--muted, #8b95ad);
  word-break: break-word;
}

.wf-account-dropdown-body {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  padding: 0.85rem 1rem;
}

.wf-account-field {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.wf-account-usage {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  padding-bottom: 0.7rem;
  border-bottom: 1px solid var(--border, #2b3448);
  color: var(--text, #eef2ff);
  font-size: 0.8rem;
  line-height: 1.45;
}

.wf-gem-wallet {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  border: 1px solid color-mix(in srgb, var(--workflow-accent, #7c5cff) 35%, transparent);
  border-radius: 12px;
  background: color-mix(in srgb, var(--workflow-accent, #7c5cff) 10%, transparent);
}

.wf-gem-wallet strong {
  display: block;
  margin-top: 2px;
  font-size: 1.08rem;
}

.wf-gem-buy {
  border: 0;
  border-radius: 9px;
  padding: 9px 11px;
  background: var(--workflow-accent, #7c5cff);
  color: #fff;
  font: inherit;
  font-size: .78rem;
  font-weight: 750;
  cursor: pointer;
  white-space: nowrap;
}

.wf-gem-buy:disabled { cursor: not-allowed; opacity: .52; }

.wf-account-field-label {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted, #8b95ad);
}

.wf-account-input {
  width: 100%;
  padding: 0.45rem 0.55rem;
  border-radius: 8px;
  border: 1px solid var(--border, #2b3448);
  background: var(--bg, #0d111a);
  color: var(--text, #eef2ff);
  font: inherit;
  font-size: 0.84rem;
}

.wf-account-input:disabled {
  opacity: 0.72;
  cursor: not-allowed;
}

.wf-account-status {
  min-height: 1.25rem;
  color: var(--muted, #8b95ad);
  font-size: 0.78rem;
}

.wf-account-status.is-error {
  color: #e85d6a;
}

.wf-account-save {
  width: 100%;
  border: 0;
  border-radius: 8px;
  padding: 0.6rem 0.8rem;
  background: #7c5cff;
  color: #fff;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.wf-account-save:hover:not(:disabled) {
  filter: brightness(1.08);
}

.wf-account-save:disabled {
  cursor: wait;
  opacity: 0.65;
}

.wf-account-manage {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 38px;
  border-radius: 8px;
  border: 1px solid color-mix(in srgb, var(--workflow-accent, #7c5cff) 45%, transparent);
  background: color-mix(in srgb, var(--workflow-accent, #7c5cff) 12%, transparent);
  color: var(--text, #eef2ff);
  text-decoration: none;
  font-size: .82rem;
  font-weight: 700;
}

.wf-account-manage:hover {
  border-color: var(--workflow-accent, #7c5cff);
  background: color-mix(in srgb, var(--workflow-accent, #7c5cff) 20%, transparent);
}

.wf-account-dropdown-foot {
  padding: 0.65rem 1rem 0.85rem;
  border-top: 1px solid var(--border, #2b3448);
}

.wf-account-logout {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 0.5rem 0.75rem;
  border-radius: 8px;
  border: 1px solid rgba(239, 68, 68, 0.45);
  background: rgba(239, 68, 68, 0.08);
  color: #f87171;
  text-decoration: none;
  font-size: 0.88rem;
  font-weight: 600;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.wf-account-logout:hover {
  background: rgba(239, 68, 68, 0.16);
  border-color: #f87171;
}

.wf-hidden {
  display: none !important;
}

.wf-select-row {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.wf-select-row .wf-app-settings-input {
  width: 100%;
}

select.wf-app-settings-input {
  cursor: pointer;
  appearance: auto;
}

/* —— App settings modal (gear) —— */
.wf-app-settings-dialog {
  max-width: min(720px, 96vw);
  width: 100%;
  max-height: min(92vh, 900px);
  margin: auto;
  padding: 0;
  border: 1px solid var(--border, #2b3448);
  border-radius: 14px;
  background: var(--surface, #121825);
  color: var(--text, #eef2ff);
  box-shadow: 0 24px 48px rgba(0, 0, 0, 0.45);
}

.wf-app-settings-dialog::backdrop {
  background: rgba(0, 0, 0, 0.5);
}

.wf-app-settings-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 1rem 1.1rem 0.5rem;
  border-bottom: 1px solid var(--border, #2b3448);
}

.wf-app-settings-title {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 650;
  letter-spacing: 0.02em;
}

.wf-app-settings-close-x {
  flex-shrink: 0;
  width: 2.25rem;
  height: 2.25rem;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--muted, #8b95ad);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
}

.wf-app-settings-close-x:hover {
  color: var(--accent, #5ed4ff);
  background: rgba(94, 212, 255, 0.08);
}

.wf-app-settings-config-path {
  margin: 0.35rem 1.1rem 0;
  font-size: 0.72rem;
  color: var(--muted, #8b95ad);
  word-break: break-all;
}

.wf-app-settings-config-path code {
  font-size: inherit;
}

.wf-app-settings-tabs {
  display: flex;
  gap: 0.25rem;
  padding: 0.5rem 1.1rem 0;
  border-bottom: 1px solid var(--border, #2b3448);
  overflow-x: auto;
}

.wf-app-settings-tab {
  padding: 0.5rem 1rem;
  border: none;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: var(--muted, #8b95ad);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: color 0.2s, border-color 0.2s;
}

.wf-app-settings-tab:hover {
  color: var(--text, #eef2ff);
}

.wf-app-settings-tab--active {
  color: var(--accent, #5ed4ff);
  border-bottom-color: var(--accent, #5ed4ff);
}

.wf-app-settings-tab-content {
  display: none;
}

.wf-app-settings-tab-content--active {
  display: block;
}

.wf-app-settings-msg {
  min-height: 1.25rem;
  margin: 0.5rem 1.1rem 0;
  font-size: 0.85rem;
}

.wf-app-settings-msg--err {
  color: #f87171;
}

.wf-app-settings-msg--ok {
  color: #6ee7b7;
}

.wf-app-settings-body {
  padding: 0.75rem 1.1rem 1rem;
  max-height: calc(92vh - 11rem);
  overflow: auto;
}

.wf-app-settings-hint {
  margin: 0 0 0.75rem;
  font-size: 0.8rem;
  color: var(--muted, #8b95ad);
  line-height: 1.4;
}

.wf-app-settings-fieldset {
  margin: 0 0 1rem;
  padding: 0.65rem 0.85rem 0.85rem;
  border: 1px solid var(--border, #2b3448);
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.12);
}

.wf-app-settings-fieldset legend {
  padding: 0 0.35rem;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted, #8b95ad);
}

.wf-app-settings-label {
  display: block;
  margin: 0.55rem 0 0.25rem;
  font-size: 0.8rem;
  color: var(--muted, #a8b0c4);
}

.wf-app-settings-input {
  display: block;
  width: 100%;
  box-sizing: border-box;
  padding: 0.45rem 0.55rem;
  border-radius: 8px;
  border: 1px solid var(--border, #2b3448);
  background: var(--bg, #0c1018);
  color: var(--text, #eef2ff);
  font-size: 0.88rem;
}

.wf-app-settings-input:focus {
  outline: 2px solid var(--accent, #5ed4ff);
  outline-offset: 1px;
}

.wf-app-settings-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.65rem;
}

.wf-app-settings-row--triples {
  grid-template-columns: repeat(3, 1fr);
}

@media (max-width: 520px) {
  .wf-app-settings-row {
    grid-template-columns: 1fr;
  }

  .wf-app-settings-row--triples {
    grid-template-columns: 1fr;
  }
}

.wf-app-settings-foot {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.5rem;
  padding: 0.75rem 1.1rem 1rem;
  border-top: 1px solid var(--border, #2b3448);
}

.wf-app-settings-primary,
.wf-app-settings-secondary {
  padding: 0.5rem 1rem;
  border-radius: 9px;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid var(--border, #2b3448);
}

.wf-app-settings-primary {
  background: linear-gradient(135deg, #0d9488, #0f766e);
  border-color: #5eead4;
  color: #fff;
}

.wf-app-settings-primary:hover {
  filter: brightness(1.06);
}

.wf-app-settings-secondary {
  background: var(--surface, #121825);
  color: var(--text, #eef2ff);
}

.wf-app-settings-secondary:hover {
  border-color: var(--accent, #5ed4ff);
  color: var(--accent, #5ed4ff);
}

@media (max-width: 520px) {
  .workflow-brand-mark {
    flex-direction: column;
    align-items: flex-start;
  }
  .workflow-studio-name {
    font-size: 1.12rem;
  }
  .workflow-logo--fa {
    max-height: 3.25rem;
    max-width: 3.25rem;
  }
}

/* —— Light theme: mint / teal lines (inherits --vars on .workflow-shell) —— */
html[data-theme="light"] {
  color-scheme: light;
}

html[data-theme="light"] .workflow-shell {
  --bg: #f0faf7;
  --surface: #ffffff;
  --surface-soft: #e8f7f2;
  --border: #7dd3c0;
  --text: #0f241f;
  --muted: #3d6b62;
  --accent: #0d9488;
  --accent-dim: #0f766e;
  --studio-gold: #0f766e;
  --studio-gold-dim: rgba(13, 148, 136, 0.28);
  --danger: #b83232;
  --table-wrap-bg: #ffffff;
  --table-row-hover: rgba(167, 243, 208, 0.55);
  --card-surface-muted: #ffffff;
  --table-head-bg: rgba(236, 253, 249, 0.98);
  --table-cell-border: #a7e8dc;
}

html[data-theme="light"] .workflow-shell a {
  color: #0f766e;
}

html[data-theme="light"] .workflow-shell .job-bar {
  background: rgba(224, 242, 237, 0.85);
  color: var(--text);
  border: 1px solid var(--border);
}

html[data-theme="light"] .workflow-shell .job-bar.error {
  color: #8a1f1f;
}

html[data-theme="light"] .workflow-shell .modal-backdrop {
  background: rgba(80, 90, 110, 0.45);
}

html[data-theme="light"] .workflow-shell .modal-card {
  background: #ffffff;
}

html[data-theme="light"] .workflow-shell .marketing-process {
  background: #eef1f8;
}

html[data-theme="light"] .workflow-shell .marketing-process--warn {
  background: #faf6e8;
  border-color: #c4a01a;
  color: #6b5600;
}

html[data-theme="light"] .workflow-shell .marketing-process--error {
  background: #fdeeee;
  color: #8a1f1f;
}

html[data-theme="light"] .workflow-shell .marketing-process--active {
  color: #0f766e;
}

html[data-theme="light"] .workflow-shell .flash.ok {
  background: #e0f5ec;
  color: #0d5c3d;
  border-color: #2d9d6c;
}

html[data-theme="light"] .workflow-shell .flash.err {
  background: #fdeeee;
  color: #8a1f1f;
}

html[data-theme="light"] .workflow-shell .story-toolbar {
  background: linear-gradient(165deg, rgba(255, 255, 255, 0.98) 0%, rgba(232, 247, 242, 0.95) 100%);
  border-color: var(--border);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.9) inset,
    0 10px 32px rgba(13, 148, 136, 0.09);
}

html[data-theme="light"] .workflow-shell .onboard-hero.workflow-opening-only {
  border-color: var(--studio-gold-dim);
  border-left-color: var(--accent);
  background:
    linear-gradient(90deg, rgba(204, 251, 241, 0.45) 0%, transparent 46%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.99), rgba(240, 253, 250, 0.92));
}

html[data-theme="light"] .workflow-shell .onboard-hero {
  border-color: rgba(45, 212, 191, 0.35);
  background:
    radial-gradient(circle at 18% 18%, rgba(45, 212, 191, 0.14), transparent 42%),
    linear-gradient(130deg, rgba(255, 255, 255, 0.98), rgba(236, 253, 249, 0.96));
}

html[data-theme="light"] .workflow-shell .onboard-card {
  background: rgba(255, 255, 255, 0.92);
  border-color: var(--border);
}

html[data-theme="light"] .workflow-shell .onboard-cta {
  border-color: rgba(45, 212, 191, 0.4);
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.98), rgba(224, 242, 237, 0.85));
}

html[data-theme="light"] .workflow-shell .advanced-config {
  border-color: #9dd9cf;
  background: rgba(255, 255, 255, 0.88);
}

html[data-theme="light"] .workflow-shell .story-toolbar__import-card {
  background: rgba(236, 253, 249, 0.75);
  border-color: rgba(125, 211, 192, 0.55);
}

html[data-theme="light"] .workflow-shell .wf-hub-create-banner__btn {
  border-color: rgba(45, 212, 191, 0.5);
  background: linear-gradient(
    125deg,
    rgba(236, 253, 249, 0.98) 0%,
    rgba(204, 251, 241, 0.4) 48%,
    #ffffff 100%
  );
}

html[data-theme="light"] .workflow-shell .wf-hub-create-banner__btn:hover {
  border-color: var(--accent);
  box-shadow: 0 14px 36px rgba(13, 148, 136, 0.12);
}

html[data-theme="light"] .workflow-shell .wf-hub-create-banner__plus {
  background: rgba(45, 212, 191, 0.2);
  color: var(--accent-dim);
}

html[data-theme="light"] .workflow-shell .wf-hub-projects {
  border-top-color: var(--border);
}

html[data-theme="light"] .workflow-shell .wf-series-library-wrap {
  background: var(--table-wrap-bg);
  border-color: var(--border);
}

html[data-theme="light"] .workflow-shell .wf-series-char-card {
  background: var(--card-surface-muted);
  border-color: var(--border);
}

html[data-theme="light"] .workflow-shell .wf-series-char-dialog {
  border-color: rgba(45, 212, 191, 0.45);
  box-shadow: 0 12px 36px rgba(15, 118, 110, 0.12);
}

html[data-theme="light"] .workflow-shell .wf-series-char-dialog__img-wrap {
  border-color: rgba(45, 212, 191, 0.35);
}

html[data-theme="light"] .workflow-shell .wf-series-combine-dialog {
  border-color: rgba(45, 212, 191, 0.45);
  box-shadow: 0 12px 36px rgba(15, 118, 110, 0.1);
}

html[data-theme="light"] .workflow-shell .wf-series-combine-card {
  border-color: var(--border);
  background: var(--card-surface-muted);
}

html[data-theme="light"] .workflow-shell .wf-series-hub-section {
  border-top-color: var(--border);
}

html[data-theme="light"] .workflow-shell .wf-pipeline-check--yes {
  color: #0f766e;
}

html[data-theme="light"] .workflow-shell .workflow-topbar {
  border-bottom-color: var(--border);
}

html[data-theme="light"] .workflow-shell .workflow-restart-btn {
  border-color: #dc2626;
  background: #fef2f2;
  color: #b91c1c;
}

html[data-theme="light"] .workflow-shell .workflow-restart-btn:hover {
  border-color: #991b1b;
  background: #fee2e2;
  color: #991b1b;
}

html[data-theme="light"] .workflow-shell .workflow-theme-btn {
  border-color: var(--border);
  background: var(--surface);
}

html[data-theme="light"] .workflow-shell .wf-app-settings-dialog {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border);
  box-shadow: 0 20px 40px rgba(15, 36, 31, 0.18);
}

html[data-theme="light"] .workflow-shell .wf-app-settings-fieldset {
  background: rgba(240, 253, 250, 0.45);
  border-color: var(--border);
}

html[data-theme="light"] .workflow-shell .wf-app-settings-input {
  background: #ffffff;
  color: var(--text);
  border-color: var(--border);
}

html[data-theme="light"] .workflow-shell .wf-app-settings-secondary {
  background: var(--surface);
  color: var(--text);
}

html[data-theme="light"] .workflow-shell .onboard-btn-row button.primary,
html[data-theme="light"] .workflow-shell #btnGoStoryDevelopment {
  background: linear-gradient(135deg, var(--accent-dim), #14b8a6);
  border-color: #5eead4;
  color: #fff;
}

html[data-theme="light"] .workflow-shell .onboard-btn-row button.primary:hover,
html[data-theme="light"] .workflow-shell #btnGoStoryDevelopment:hover {
  filter: brightness(1.05);
  border-color: #99f6e4;
}

html[data-theme="light"] .workflow-shell button.btn-danger,
html[data-theme="light"] .workflow-shell .btn.btn-danger {
  background: #fff5f5;
}

html[data-theme="light"] .workflow-shell .panel-table th {
  background: rgba(236, 253, 249, 0.95);
  border-color: var(--table-cell-border, #a7e8dc);
}

html[data-theme="light"] .workflow-shell .task-queue-bar {
  background: rgba(236, 253, 249, 0.9);
  color: #1e4d45;
  border-color: var(--border);
}

html[data-theme="light"] .workflow-shell .act-step2-details {
  background: rgba(240, 253, 250, 0.65);
}

html[data-theme="light"] .workflow-shell .img-lightbox__caption {
  background: rgba(255, 255, 255, 0.95);
}

html[data-theme="light"] .workflow-shell .cap-table th {
  background: #e8edf6;
}

html[data-theme="light"] .workflow-shell .section {
  background: rgba(240, 253, 250, 0.5);
}

html[data-theme="light"] .workflow-shell .letter-ai-card,
html[data-theme="light"] .workflow-shell #letterAiNotes {
  background: #ffffff;
}

html[data-theme="light"] .workflow-shell .pub-block input[type="text"],
html[data-theme="light"] .workflow-shell .pub-block textarea {
  background: var(--surface);
}

html[data-theme="light"] .workflow-shell .tile .lbl {
  color: #e8ecf4;
}

@media (max-width: 640px) {
  .workflow-brand-logos {
    justify-content: center;
  }

  .workflow-topbar {
    flex-direction: column;
    align-items: stretch;
  }

  .workflow-topbar-actions {
    align-self: flex-end;
    flex-wrap: wrap;
    justify-content: flex-end;
  }

  .wf-account-sub {
    display: none;
  }
}

/* ——— Phased story development sections ——— */
.wf-dev-phase__title {
  margin: 0 0 0.35rem;
  font-size: 1.35rem;
}
.wf-dev-phase__lead {
  margin: 0 0 1rem;
  max-width: 52rem;
}
.wf-mode-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 0.85rem;
  margin-bottom: 1.5rem;
}
.wf-mode-card {
  text-align: left;
  padding: 1rem;
  border-radius: 12px;
  border: 1px solid var(--border, #2a3441);
  background: var(--surface, #111923);
  color: inherit;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  min-height: 5.5rem;
}
.wf-mode-card:hover:not(.wf-mode-card--disabled) {
  border-color: var(--accent-dim, #14b8a6);
}
.wf-mode-card--disabled {
  opacity: 0.55;
  cursor: not-allowed;
}
.wf-mode-card__title {
  font-weight: 700;
  font-size: 1.05rem;
}
.wf-mode-card__desc {
  font-size: 0.82rem;
  color: var(--muted, #94a3b8);
  line-height: 1.45;
}

/* Choose adaptation: 4×2 tile grid */
.wf-adaptation-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1rem 1.1rem;
  max-width: 76rem;
  margin: 0 auto 1.75rem;
}
@media (max-width: 960px) {
  .wf-adaptation-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
.wf-adapt-tile[hidden] {
  display: none !important;
}
.wf-adapt-tile {
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  text-align: center;
  gap: 0.65rem;
  min-height: 11.5rem;
  padding: 1.25rem 1rem 1.35rem;
  border-radius: 14px;
  border: 1px solid var(--border, #2a3441);
  background: var(--surface, #111923);
  color: inherit;
  cursor: default;
  transition:
    border-color 0.15s ease,
    box-shadow 0.15s ease,
    transform 0.12s ease;
}
.wf-adapt-tile--pick {
  cursor: pointer;
  border-color: rgba(110, 184, 255, 0.35);
  background: linear-gradient(165deg, rgba(110, 184, 255, 0.1) 0%, var(--surface, #111923) 48%);
}
.wf-adapt-tile--pick:hover {
  border-color: var(--accent-dim, #14b8a6);
  box-shadow: 0 0 0 1px rgba(110, 184, 255, 0.25);
  transform: translateY(-2px);
}
.wf-adapt-tile--pick:focus-visible {
  outline: 2px solid var(--accent-dim, #14b8a6);
  outline-offset: 2px;
}
.wf-adapt-tile--soon {
  opacity: 0.58;
  cursor: not-allowed;
  border-style: dashed;
}
.wf-adapt-tile__icon {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent-dim, #6eb8ff);
  flex-shrink: 0;
}
.wf-adapt-tile__icon svg {
  display: block;
}
.wf-adapt-tile__icon--muted {
  color: var(--muted, #94a3b8);
}
.wf-adapt-tile__title {
  font-weight: 750;
  font-size: 1.02rem;
  line-height: 1.25;
  letter-spacing: 0.01em;
}
.wf-adapt-tile--pick .wf-adapt-tile__title {
  font-size: 1.05rem;
}
.wf-adapt-tile__sub {
  font-size: 0.8rem;
  color: var(--muted, #94a3b8);
  line-height: 1.35;
  max-width: 15rem;
}

.wf-dev-field-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.25rem;
}
.wf-mode-story-readonly-wrap {
  margin-top: 1.75rem;
}
.wf-chapter-prose-panel {
  margin: 0 0 1rem;
  border-radius: 10px;
  border: 1px solid var(--border, #2a3441);
  background: rgba(0, 0, 0, 0.12);
  padding: 0.35rem 0.85rem 0.65rem;
}
.wf-chapter-prose-panel > summary {
  cursor: pointer;
  font-weight: 600;
  padding: 0.35rem 0;
  list-style-position: outside;
}
.wf-chapter-prose-panel__body {
  padding: 0.25rem 0 0.35rem;
}
.wf-dev-phase--wizard .wf-chapter-prose-panel {
  margin-bottom: 1rem;
}
.wf-story-full-readonly {
  width: 100%;
  box-sizing: border-box;
  margin: 0;
  padding: 0.85rem 1rem;
  max-height: min(55vh, 28rem);
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: ui-monospace, monospace;
  font-size: 0.82rem;
  line-height: 1.45;
  border-radius: 10px;
  border: 1px solid var(--border, #2a3441);
  background: rgba(0, 0, 0, 0.22);
  color: var(--text, #e2e8f0);
}
.wf-dev-phase--choose-mode .wf-story-full-editor {
  min-height: 14rem;
  resize: vertical;
  font-family: inherit;
  display: block;
}
.wf-story-full-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.5rem;
  margin: 0.65rem 0 0;
}
.wf-story-full-empty {
  margin: 0;
  padding: 0.85rem 1rem;
  border-radius: 10px;
  border: 1px dashed var(--border, #2a3441);
  color: var(--muted, #94a3b8);
  font-size: 0.85rem;
}
.wf-scene-wizard-inline-host {
  max-width: 56rem;
}
.wf-dev-wizard-step-outline .wf-scene-wizard-inline-host,
.wf-dev-wizard-step-references .wf-scene-wizard-inline-host {
  max-width: none;
  width: 100%;
}
.wf-scene-wizard-inline-head .wf-scene-wizard-dismiss {
  margin-left: auto;
}
.wf-dev-wizard-step-outline .wf-sw-tabs {
  display: none !important;
}
.wf-dev-wizard-step-outline #wfSceneWizardPanelChars,
.wf-dev-wizard-step-outline #wfSceneWizardPanelEntities {
  display: none !important;
}
.wf-dev-wizard-step-outline #wfSceneWizardPanelOutline {
  display: block !important;
}
.wf-dev-wizard-step-references #wfSceneWizardPanelOutline {
  display: none !important;
}
#wfCharsGenScreenLead {
  display: none;
}
.wf-dev-wizard-step-references #wfCharsGenScreenLead {
  display: block;
}
.wf-dev-wizard-step-references .wf-chapter-prose-panel {
  display: none !important;
}
