.creative-work-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}

.creative-work-layout .work-form {
  position: static;
  top: auto;
  min-width: 0;
  padding: 22px 24px;
}

.creative-work-layout .form-grid {
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 12px 16px;
}

.creative-work-layout .creative-parameter-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.creative-work-layout .creative-style-grid,
.creative-work-layout .creative-routing-grid {
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
}

.creative-work-layout .creative-parameter-grid .field,
.creative-work-layout .creative-style-grid .field,
.creative-work-layout .creative-routing-grid .field {
  min-width: 0;
}

.creative-work-layout #creative-results {
  min-width: 0;
}

.creative-work-layout .creative-config-bar {
  display: flex;
  justify-content: flex-end;
  min-width: 0;
}

.creative-work-layout .work-form[hidden] {
  display: none;
}

.result-browser-tools,
.result-mini-tools {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 9px 12px;
  margin: 0 0 12px;
}

.result-browser-tools > input[type="search"] {
  width: min(230px, 100%);
  margin-left: auto;
}

.result-browser-tools > select {
  width: auto;
  min-width: 125px;
}

.result-tools-spacer {
  flex: 1;
}

.result-selected,
.result-mini-tools > span {
  color: var(--text-secondary);
  font-size: 0.8125rem;
  white-space: nowrap;
}

.result-tabs {
  display: flex;
  gap: 22px;
  margin: 0 0 12px;
  border-bottom: 1px solid var(--line);
}

.result-tab {
  padding: 8px 0;
  border: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: var(--text-secondary);
  font-size: 0.875rem;
  white-space: nowrap;
}

.result-tab.active {
  border-color: var(--primary);
  color: var(--primary);
  font-weight: 650;
}

.result-table-wrap {
  max-width: 100%;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.result-table {
  width: 100%;
  min-width: 820px;
  border-collapse: collapse;
  color: var(--text-secondary);
  font-size: 0.8125rem;
}

.result-table th {
  height: 40px;
  padding: 8px 10px;
  background: var(--surface-muted);
  color: var(--text);
  font-weight: 650;
  text-align: left;
  white-space: nowrap;
}

.result-table td {
  height: 48px;
  padding: 7px 10px;
  border-top: 1px solid var(--line);
  vertical-align: middle;
  white-space: nowrap;
}

.result-table tbody tr:hover td {
  background: var(--surface-hover);
}

.result-table .result-check-cell {
  width: 38px;
  min-width: 38px;
  padding-right: 4px;
  padding-left: 12px;
  text-align: center;
}

.result-check-cell input {
  display: block;
  margin: 0 auto;
}

.result-table .result-task-title {
  max-width: 420px;
  overflow: hidden;
  color: var(--text);
  text-overflow: ellipsis;
}

.result-table .result-style-cell {
  max-width: 190px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.result-row-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.result-row-actions .btn.sm {
  min-height: 30px;
  padding: 4px 7px;
}

.result-progress-label {
  margin-left: 6px;
  color: var(--text-muted);
}

.result-pagination {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 12px;
  padding: 10px 2px;
  color: var(--text-muted);
  font-size: 0.8125rem;
}

.result-page-buttons {
  display: flex;
  align-items: center;
  gap: 3px;
}

.result-page-arrow svg {
  transform: rotate(180deg);
}

.result-page-arrow.next svg {
  transform: none;
}

.result-page-number {
  min-width: 30px;
  height: 30px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--text-secondary);
}

.result-page-number.active {
  border-color: var(--primary);
  color: var(--primary);
}

.result-page-size {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  font-weight: 400;
}

.result-page-size select {
  width: 82px;
  padding: 5px 7px;
}

.task-results-table {
  min-width: 900px;
}

@media (max-width: 700px) {
  .result-browser-tools > input[type="search"] {
    width: 100%;
    margin-left: 0;
  }

  .result-browser-tools > select {
    flex: 1;
  }

  .result-tools-spacer {
    display: none;
  }
}

.creative-work-layout .work-form > button[type="submit"] {
  width: auto !important;
  min-width: 160px;
}

.creative-work-layout .work-form > button[type="submit"] + .hint {
  display: inline-block;
  margin-left: 12px;
  text-align: left !important;
  vertical-align: middle;
}

@media (max-width: 1050px) {
  .creative-work-layout .creative-parameter-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 520px) {
  .creative-work-layout .work-form {
    padding: 18px 16px;
  }

  .creative-work-layout .form-grid,
  .creative-work-layout .creative-parameter-grid,
  .creative-work-layout .creative-style-grid,
  .creative-work-layout .creative-routing-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .creative-work-layout .work-form > button[type="submit"] + .hint {
    display: block;
    margin: 8px 0 0;
  }
}

.handoff-queue {
  margin: 4px 0 18px;
}

.handoff-queue .between {
  align-items: flex-start;
}

.handoff-queue p {
  margin-top: 4px;
  font-size:0.8125rem;
}

.handoff-queue details {
  margin-top: 8px;
}

.handoff-queue ol {
  max-height: 180px;
  overflow: auto;
  margin: 7px 0 0;
  padding-left: 24px;
}

.handoff-queue li {
  padding: 3px 0;
  overflow-wrap: anywhere;
}

.story-body {
  margin: 12px 0;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:var(--surface-muted);
}

.story-body summary {
  color:var(--text-muted);
  font-weight: 600;
}

.story-body[open] .text-output {
  margin-top: 8px;
}

.board-page-details > summary {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  margin: 0;
}

.board-page-summary {
  flex: 1;
  min-width: 0;
  color:var(--text-muted);
  font-size:0.8125rem;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.board-page-count {
  flex: 0 0 auto;
  font-size:0.8125rem;
  white-space: nowrap;
}

.board-page-content {
  margin-top: 10px;
}

.board-page-actions {
  justify-content: flex-start;
  flex-wrap: wrap;
  margin-top: 12px;
}

.brand img {
  width: 48px;
  height: 36px;
  object-fit: contain;
  flex-shrink: 0;
}

.account-card > img,
.boot > img {
  width: 80px;
  height: auto;
  object-fit: contain;
}

.account-card {
  width: 390px;
  max-width: calc(100vw - 32px);
}

.account-card .eyebrow {
  margin-bottom: 8px;
}

.account-card h2 {
  color:var(--text);
}

.account-card .account-hint {
  margin: 8px 0 22px;
}

.account-card label {
  margin-bottom: 14px;
}

.account-card input {
  margin-top: 6px;
}

.account-card .account-submit,
.account-card .account-toggle {
  width: 100%;
  margin-top: 10px;
}

.sidebar > .brand,
.sidebar > .user-center-link {
  flex-shrink: 0;
}

.sidebar-content {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  scrollbar-width: thin;
}

.user-center-link {
  width: 100%;
  margin: 12px 0 0;
  padding: 13px 10px 4px;
  border: 0;
  border-top: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
  text-align: left;
  color:var(--text-muted);
}

.user-center-link:hover,
.user-center-link.active {
  background:var(--surface-hover);
}

.user-copy {
  overflow: hidden;
}

.user-copy strong,
.user-copy small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-copy small {
  color:var(--text-muted);
  font-size:0.8125rem;
}

.login-indicator {
  display: inline-block;
  width: 6px;
  height: 6px;
  margin-right: 5px;
  border-radius: 50%;
  background: #67b38e;
}

.user-open {
  font-size:0.8125rem;
  color: var(--primary);
}

.account-layout {
  max-width: 960px;
  display: grid;
  gap: 24px;
}

.account-profile {
  display: flex;
  align-items: center;
  gap: 22px;
  padding: 30px;
}

.account-avatar {
  display: grid;
  place-items: center;
  flex-shrink: 0;
  width: 72px;
  height: 72px;
  border-radius: 22px;
  background:var(--accent-surface);
  color: var(--primary);
  font-size:1.75rem;
}

.account-profile h2 {
  margin: 8px 0 6px;
  font-size:1.5rem;
  overflow-wrap: anywhere;
}

.account-profile p {
  color:var(--text-muted);
  font-size:0.8125rem;
}

.account-model-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 15px;
}

.account-model {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px;
}

.account-model .grow > span {
  color:var(--text-muted);
  font-size:0.8125rem;
}

.account-model strong {
  display: block;
  font-size:1.375rem;
}

.account-model strong small {
  color:var(--text-muted);
  font-weight: 400;
}

.account-model-dot {
  flex-shrink: 0;
  height: 7px;
  width: 7px;
  border-radius: 50%;
  background: #d7ddea;
}

.account-model-dot.configured {
  background: #67b38e;
}

.account-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 20px;
  padding: 24px 28px;
}

@media (max-width: 1050px) {
  .account-model-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 520px) {
  .account-profile {
    padding: 22px 18px;
    gap: 14px;
  }

  .account-avatar {
    width: 50px;
    height: 50px;
    font-size:1.375rem;
    border-radius: 16px;
  }

  .account-actions {
    padding: 22px 18px;
  }
}

/* Clear text and solid surfaces across the workspace. */
:root {
  --primary: #4355cf;
  --muted: #526079;
  --line: #d7deea;
  --shadow: 0 2px 8px rgb(15 23 42 / 4%);
  color:var(--text);
  background:var(--page-background);
}

body {
  font-size:0.9375rem;
  line-height: 1.7;
}

h1, h2, h3,
.page-head h1,
.section-head h2,
.work-form h3,
.project-info h3,
.aside-card h3,
.title-row h3,
.job-head h3,
.board-page h3,
.asset-info h3,
.template h3,
.provider h3,
.modal-head h2,
.draft h3,
.empty h3 {
  color:var(--text);
}

input, textarea, select {
  font-size:0.875rem;
  border-color: #bdc9d9;
}

input::placeholder,
textarea::placeholder {
  color:var(--text-muted);
  opacity: 1;
}

label {
  font-size:0.875rem;
  color:var(--text-secondary);
}

.btn {
  min-height: 40px;
  font-size:0.875rem;
  color:var(--text-secondary);
  border-color: #cbd5e1;
}

.btn.primary {
  color: #fff;
}

.btn.primary:hover {
  background: #3445b9;
}

.btn.light,
.tab.active,
.chip.on,
.seg button.active,
.badge {
  color:var(--accent-text);
}

.btn.danger,
.toast.error,
.job-error {
  color:var(--danger-text);
}

.btn.sm {
  min-height: 34px;
  font-size:0.8125rem;
}

.icon-btn {
  width: 34px;
  height: 34px;
  color:var(--text-muted);
}

.badge.green {
  color:var(--success-text);
}

.badge.orange {
  color:var(--warning-text);
}

.badge.red {
  color:var(--danger-text);
}

.badge.gray {
  color:var(--text-muted);
}

.nav-item {
  font-size:0.875rem;
  color:var(--text-secondary);
}

.nav-item svg {
  color:var(--text-muted);
}

.nav-item.active,
.nav-item.active svg {
  color:var(--accent-text);
}

.brand b {
  color:var(--text);
}

.brand small {
  letter-spacing: 1px;
}

.user-copy small,
.online {
  color:var(--success-text);
}

.avatar {
  color:var(--accent-text);
  font-size:0.875rem;
}

.topbar {
  gap: 12px;
  padding: 0 24px;
  background:var(--surface);
  backdrop-filter: none;
}

.top-right {
  gap: 10px;
  min-width: 0;
}

.online {
  white-space: nowrap;
}

.search {
  width: 180px;
}

.search input {
  min-width: 0;
}

.page-head h1 {
  font-size:1.75rem;
}

.page-head p {
  font-size:0.875rem;
}

.hero {
  background:var(--accent-surface);
  border-color: #d6def7;
}

.hero h2 {
  font-size:1.75rem;
  font-weight: 700;
  color:var(--text);
}

.hero p {
  font-size:0.875rem;
  color:var(--text-secondary);
  max-width: 460px;
}

.stat {
  min-width: 0;
}

.stat > div:last-child {
  min-width: 0;
}

.stat .num {
  font-size:1.75rem;
  font-weight: 700;
  color:var(--text);
}

.stat-sub {
  overflow-wrap: anywhere;
}

.section-head h2 {
  font-size:1.125rem;
}

.step b,
.project-info h3 {
  font-size:0.9375rem;
  color:var(--text);
}

.project-info p,
.aside-card p,
.model-line,
.task-row strong {
  font-size:0.875rem;
}

.aside-card h3 {
  font-size:0.9375rem;
}

.stat-icon,
.step-icon,
.task-icon,
.model-icon {
  flex-shrink: 0;
  color:var(--accent-text);
}

.stat:nth-child(2) .stat-icon,
.step:nth-child(3) .step-icon {
  color:var(--purple-text);
}

.stat:nth-child(3) .stat-icon,
.step:nth-child(4) .step-icon {
  color:var(--success-text);
}

.stat:nth-child(4) .stat-icon,
.step:nth-child(2) .step-icon {
  color:var(--warning-text);
}

.work-form h3,
.provider h3 {
  font-size:1rem;
}

.text-output,
.work-form textarea {
  font-size:1rem;
  line-height: 1.9;
  color:var(--text);
}

.panel-shot {
  font-size:0.9375rem;
  color:var(--text-secondary);
}

.panel-shot b {
  font-size:0.875rem;
  color:var(--text);
}

.modal-backdrop {
  background: rgb(15 23 42 / 38%);
  backdrop-filter: none;
}

#creative-results .result-select-toolbar {
  background:var(--surface);
  backdrop-filter: none;
}

@media (max-width: 1150px) {
  .breadcrumb,
  .topbar > .divider {
    display: none;
  }
}

@media (max-width: 800px) {
  .topbar {
    gap: 8px;
    padding: 0 16px;
  }

  .page-head h1,
  .hero h2 {
    font-size:1.5rem;
  }

  .page-head {
    flex-wrap: wrap;
  }
}
.job-duration { font-variant-numeric: tabular-nums; white-space: nowrap; }
.image-viewer-stage { display: grid; place-items: center; min-height: 160px; background: var(--surface-muted); border-radius: 8px; }
.image-viewer-stage img.preview { display: block; max-height: 52vh; width: 100%; object-fit: contain; }
.image-viewer-nav { display: flex; align-items: center; justify-content: center; gap: 20px; padding: 14px 0; }
.image-viewer-nav [role="status"] { min-width: 90px; text-align: center; color: var(--text); }
.preview-previous svg { transform: rotate(180deg); }
.image-viewer-thumbnails { display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 8px; }
.image-viewer-thumbnail { flex: 0 0 64px; position: relative; padding: 3px; border: 2px solid transparent; border-radius: 7px; background: var(--surface-muted); cursor: pointer; }
.image-viewer-thumbnail.active { border-color: var(--accent, #6078de); }
.image-viewer-thumbnail img { display: block; width: 54px; height: 54px; object-fit: contain; }
.image-viewer-thumbnail span { position: absolute; right: 2px; bottom: 2px; padding: 0 5px; border-radius: 4px; background: var(--surface); color: var(--text); font-size: 0.75rem; }
.image-viewer-actions { margin-top: 14px; }
.library-controls { margin-bottom: 20px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.library-filter-row, .library-selection-row { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; padding: 14px 16px; }
.library-filter-row { border-bottom: 1px solid var(--line); }
.library-filter-row > input[type="search"] { flex: 1; min-width: 180px; width: auto; }
.library-filter-row > select { width: auto; min-width: 130px; }
.library-view-switch { display: flex; gap: 3px; padding: 3px; background: var(--surface-muted); border-radius: 8px; }
.library-view-switch .btn { border: 0; background: transparent; }
.library-view-switch .btn.active { background: var(--surface); color: var(--primary); box-shadow: 0 1px 4px #00000012; }
.library-selection-spacer { flex: 1; }
.library-selection-row strong { font-size: 0.875rem; color: var(--text); font-weight: 550; white-space: nowrap; }
.library-album-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 20px; }
.library-album { overflow: hidden; }
.library-album-cover { position: relative; background: var(--surface-muted); }
.library-cover-button { display: block; width: 100%; padding: 14px 18px; border: 0; background: transparent; cursor: pointer; }
.library-cover-button img { display: block; width: 100%; height: 175px; object-fit: contain; filter: none; }
.library-cover-button:hover { background: var(--accent-surface); }
.library-album-select { position: absolute; top: 10px; left: 10px; display: flex; align-items: center; gap: 5px; padding: 5px 7px; border-radius: 6px; background: var(--surface); color: var(--text); font-size: 0.75rem; }
.library-album-select input { margin: 0; }
.library-album-pages { position: absolute; right: 10px; bottom: 10px; padding: 3px 8px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); color: var(--text); font-size: 0.8125rem; }
.library-album-info { padding: 14px 16px 12px; }
.library-album-info h3 { font-size: 0.9375rem; line-height: 1.6; min-height: 3em; overflow-wrap: anywhere; color: var(--text); font-weight: 600; }
.library-album-info p { display: flex; align-items: center; flex-wrap: wrap; gap: 7px; color: var(--text-secondary); font-size: 0.75rem; margin: 5px 0 12px; }
.library-album-foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.library-album-foot > span { font-size: 0.8125rem; color: var(--primary); }
.library-group-heading { display: flex; align-items: center; flex-wrap: wrap; gap: 14px; margin: 0 0 18px; }
.library-group-heading h2 { margin: 0; font-size: 1.125rem; color: var(--text); }
.library-group-heading > .btn svg { transform: rotate(180deg); }
.library-group-heading > span { font-size: 0.8125rem; }
.library-image-grid .asset-info h3 { white-space: normal; line-height: 1.6; min-height: 2.8em; font-size: 0.875rem; }
.library-image-grid .asset-thumb { height: 220px; }
#asset-results { scroll-margin-top: 88px; }
@media (max-width: 650px) {
  .library-album-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .library-cover-button { padding: 12px 8px; }
  .library-cover-button img { height: 155px; }
  .library-album-select span { display: none; }
  .library-album-info { padding: 12px; }
  .library-selection-spacer { display: none; }
}
