:root {
  --soft-canvas: #f5f6f8;
  --soft-canvas-deep: #edf0f4;
  --soft-radius-control: 8px;
  --soft-radius-card: 8px;
  --soft-shadow-sm: 0 1px 3px rgb(35 44 61 / 5%);
  --soft-shadow-md: 0 2px 8px rgb(35 44 61 / 6%);
  --soft-shadow-lg: 0 3px 12px rgb(35 44 61 / 7%);
  --soft-shadow-primary: 0 2px 6px rgb(99 102 241 / 14%);
}

body::before { display: none; }

body :is(.primary-button, .secondary-button, .icon-button, .custom-select-trigger) {
  border-radius: 6px;
}

body :is(.primary-button, .secondary-button) {
  min-height: 44px;
  padding-block: 8px;
  box-shadow: none;
}

body :is(input:not([type="checkbox"]):not([type="radio"]):not([type="file"]), textarea, select) {
  border-radius: 6px;
}

body :is(.characters-shell, .materials-shell) { padding-top: 24px; }
body :is(.characters-hero, .materials-hero) { padding: 0 0 20px; gap: 16px; }
body :is(.characters-hero h1, .materials-hero h1, .settings-heading h1) { margin: 0; font-size: 26px; }
body :is(.characters-hero .eyebrow, .materials-hero .eyebrow) { margin: 0 0 4px; }
body :is(.character-library-panel, .materials-library, .settings-section) {
  padding: 24px;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}
body :is(.character-library-heading, .materials-library-heading, .settings-section-title) { margin-bottom: 16px; }
body :is(.character-library-heading h2, .materials-library-heading h2) { margin: 0; font-size: 20px; }
body :is(.character-stats, .materials-overview) { margin-bottom: 16px; gap: 12px; }
body :is(.character-stat-card, .materials-overview > div) {
  min-height: 72px;
  padding: 12px 16px;
  border-radius: 8px;
  box-shadow: none;
}
body :is(.character-stat-icon, .materials-overview span) { width: 36px; height: 36px; border-radius: 6px; }
body :is(.character-card, .material-card) { padding: 16px; border-radius: 8px; box-shadow: none; }
body :is(.character-card:hover, .material-card:hover) { transform: none; }

.settings-page .settings-shell { padding-top: 24px; }
.settings-page .settings-heading { margin-bottom: 20px; }
.settings-page .settings-form { gap: 16px; }
.settings-page #assetLibrarySettingsForm { margin: 24px 0; }
.settings-page #assetLibrarySettingsMessage:not(:empty) { margin-top: 16px; }

body :is(.step-host, .remake-stage) {
  min-height: 0;
  padding: 24px;
  border-radius: 0;
  box-shadow: none;
}
body :is(.form-section, .review-section) { border-radius: 0; box-shadow: none; }
body .wizard-heading-row .page-heading h1,
body.viewing-task .wizard-heading-row .page-heading h1,
body .remake-hero h1 { font-size: 28px; }
body :is(.wizard-heading-row, .remake-hero) { margin-bottom: 20px; }
body :is(.hero-highlights, .remake-highlights) { margin-top: 10px; gap: 8px; }
body :is(.hero-highlights li, .remake-highlights li) { min-height: 30px; padding: 0 10px; border-radius: 6px; box-shadow: none; }
body :is(.character-role-card, .script-beat-editor, .script-node-pager, .remake-generated-shot, .remake-reference-card) { border-radius: 8px; box-shadow: none; }
.remake-page .remake-shell { padding-top: 24px; gap: 24px; }
.remake-page .remake-stage-heading { padding-bottom: 16px; }

#storyOptions { gap: 12px; }
#storyOptions > .story-option {
  min-height: 76px;
  padding: 14px 48px 14px 16px;
  gap: 4px;
  border: 1px solid #b8c2d1;
  border-radius: 8px;
  background: #f9fafc;
  box-shadow: none;
  transform: none;
  transition: border-color var(--soft-transition), background var(--soft-transition), box-shadow var(--soft-transition);
}
#storyOptions > .story-option > span {
  color: var(--soft-ink);
  font-size: 15px;
  font-weight: 650;
  line-height: 1.5;
}
#storyOptions > .story-option > small {
  margin-top: 0;
  color: var(--soft-text);
  font-size: 12px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}
#storyOptions > .story-option::before,
#storyOptions > .story-option::after {
  top: calc(50% - 7.5px);
  right: 16px;
}
#storyOptions > .story-option::before { border-color: #8d9bb0; }
#storyOptions > .story-option:hover,
#storyOptions > .story-option:active {
  border-color: #8d9bb0;
  background: #f1f4f8;
  box-shadow: none;
  transform: none;
}
#storyOptions > .story-option:has(input:checked) {
  border-color: var(--soft-primary);
  background: var(--soft-primary-soft);
  box-shadow: inset 0 0 0 1px var(--soft-primary);
}
#storyOptions > .story-option:has(input:checked) > span { color: var(--soft-primary-strong); }
#storyOptions > .story-option:has(input:checked)::before { border-color: var(--soft-primary); }

@media (min-width: 1024px) {
  body .editor, body.viewing-task .editor, body .remake-shell { grid-template-columns: 208px minmax(0, 1fr); column-gap: 24px; }
  body .workspace, body.viewing-task .workspace { padding-top: 24px; }
  body .workflow-steps, body.viewing-task .workflow-steps, body .remake-sidebar { padding: 14px 10px; border-radius: 0; box-shadow: none; }
  body .editor .workflow-steps button { min-height: 48px; }
}

/* History keeps the same records and actions in both layouts. */
.task-history-page { padding: 24px 32px 64px; }
.task-history-page .task-history-heading {
  display: flex;
  margin: 0 0 16px;
  padding: 0;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border: 0;
}
.task-history-heading .task-history-title-row { display: flex; width: auto; min-width: 0; flex-wrap: wrap; align-items: center; gap: 8px 16px; }
.task-history-heading h1 { margin: 0; font-size: 26px; }
.task-history-heading .task-history-count { display: flex; min-height: 0; padding: 0; align-items: baseline; gap: 4px; border-radius: 0; background: transparent; box-shadow: none; white-space: nowrap; }
.task-history-count strong { font-size: 16px; font-variant-numeric: tabular-nums; }
.task-history-heading .history-back-button { min-height: 44px; margin: 0; padding: 8px 12px; flex-shrink: 0; border-radius: 6px; background: transparent; box-shadow: none; }
.task-history-page .cost-history-summary { margin-bottom: 16px; padding: 12px 0; border-width: 1px 0; border-radius: 0; background: transparent; }
.task-history-page .cost-history-summary > div { min-width: 0; }
.task-history-page .cost-history-summary strong { overflow-wrap: anywhere; }
.task-history-page :is(.task-draft-section, .task-history-remake) { margin-bottom: 20px; padding: 0; border: 0; border-radius: 0; background: transparent; box-shadow: none; }
.task-history-page :is(.task-draft-heading, .task-history-remake-heading) { margin-bottom: 12px; }
.task-history-page :is(.task-draft-heading h2, .task-history-remake-heading h2) { margin: 0; font-size: 18px; }
.task-history-page :is(.task-draft-heading .eyebrow, .task-history-remake-heading .eyebrow) { display: none; }
.task-history-page :is(.task-draft-item, .remake-history-card) { border-radius: 8px; box-shadow: none; }
.task-history-toolbar { display: flex; margin-bottom: 16px; align-items: center; justify-content: space-between; gap: 16px; }
.task-history-toolbar .task-history-search { width: min(440px, 100%); margin: 0; padding: 0; border: 0; border-radius: 0; background: transparent; box-shadow: none; }
.task-history-toolbar .task-history-search-control { display: flex; min-width: 0; min-height: 44px; padding: 0; gap: 0; border: 1px solid var(--border-strong); border-radius: 6px; background: #fff; box-shadow: none; }
.task-history-search-control input { flex: 1; min-width: 0; }
.task-history-toolbar .task-history-search-control input { min-height: 44px; padding: 8px 12px; border: 0; box-shadow: none; }
.task-history-search-control:focus-within { outline: 2px solid var(--focus, #2563eb); outline-offset: 2px; }
.task-history-toolbar .task-history-search-control .icon-button { display: grid; width: 44px; min-width: 44px; height: 44px; padding: 0; place-items: center; border: 0; border-radius: 0 5px 5px 0; box-shadow: none; }
.task-history-favorite,
.task-history-toolbar .task-history-favorites-filter { display: inline-grid; width: 44px; min-width: 44px; height: 44px; padding: 0; flex: 0 0 44px; place-items: center; border: 1px solid var(--border); border-radius: 6px; background: #fff; cursor: pointer; }
.task-history-favorite img,
.task-history-favorites-filter img { width: 19px; height: 19px; }
.task-history-favorite:hover,
.task-history-favorites-filter:hover { border-color: var(--border-strong); background: #f6f7f8; }
.task-history-favorite[aria-pressed="true"],
.task-history-favorites-filter[aria-pressed="true"] { border-color: #c98f16; background: #fff7df; }
.task-history-favorite[aria-pressed="true"] img,
.task-history-favorites-filter[aria-pressed="true"] img { filter: invert(58%) sepia(75%) saturate(1385%) hue-rotate(6deg) brightness(89%) contrast(91%); }
.task-history-favorite:focus-visible,
.task-history-favorites-filter:focus-visible { outline: 2px solid var(--focus, #2563eb); outline-offset: 2px; }
.task-history-favorite:disabled { cursor: wait; opacity: 0.55; }
.task-history-view-controls { display: flex; padding: 2px; gap: 2px; border: 1px solid var(--border); border-radius: 6px; background: #fff; }
.task-history-view-controls .icon-button { display: grid; width: 44px; height: 44px; padding: 0; place-items: center; border: 0; background: transparent; box-shadow: none; }
.task-history-view-controls [aria-pressed="true"] { background: var(--primary-soft); color: var(--primary); }
.task-history-view-controls [aria-pressed="true"] img { filter: invert(34%) sepia(97%) saturate(1845%) hue-rotate(230deg); }
.task-history-page .task-history-grid { gap: 16px; }
.task-history-grid .task-history-card { display: flex; height: 100%; min-width: 0; flex-direction: column; border: 1px solid var(--border); border-radius: 8px; box-shadow: none; }
.task-history-grid .task-history-card:hover { border-color: var(--border-strong); box-shadow: var(--soft-shadow-sm); transform: none; }
.task-history-grid .task-history-card > a { display: flex; height: auto; min-width: 0; flex: 1; flex-direction: column; }
.task-history-grid .task-history-card-media { width: 100%; height: auto; aspect-ratio: 16 / 10; background: #eef1f4; }
.task-history-grid .task-history-card-media > img { object-fit: contain; }
.task-history-grid .task-history-card-media[data-thumbnail-kind="face"] > img { padding: 0; object-fit: contain; }
.task-history-grid .task-history-card-content { min-width: 0; padding: 12px; flex: 1; gap: 6px; }
.task-history-grid .task-history-card-content h2 { min-height: 42px; margin: 0; font-size: 15px; line-height: 1.4; overflow-wrap: anywhere; }
.task-history-grid .task-history-card-content p { min-height: 40px; margin: 0; font-size: 13px; line-height: 1.5; }
.task-history-grid .task-history-status-badge { width: fit-content; align-self: flex-start; border-radius: 4px; }
.task-history-grid .task-history-card-meta { padding-top: 6px; gap: 8px; flex-wrap: wrap; }
.task-history-grid .task-history-card-actions { margin: 0; padding: 8px 12px; grid-template-columns: repeat(4, 44px); justify-content: end; gap: 8px; border-top: 1px solid var(--border); }
.task-history-grid .task-history-card[data-task-kind="volcengine_edit"] .task-history-card-actions { grid-template-columns: repeat(3, 44px); justify-content: end; }
.task-history-card-actions .secondary-button { width: 44px; min-height: 44px; padding: 0; }
.task-history-card-actions .secondary-button span { display: none; }
.task-history-page .task-history-empty { min-height: 220px; padding: 24px; border-radius: 0; background: transparent; box-shadow: none; }
.task-history-empty > span { width: 48px; height: 48px; box-shadow: none; }
.task-history-page .task-history-pagination { gap: 12px; }
.task-history-pagination > span { white-space: nowrap; }
.task-history-page .task-history-pagination button { min-width: 44px; flex-shrink: 0; white-space: nowrap; }

.task-history-grid[data-view="list"] { grid-template-columns: minmax(0, 1fr); grid-auto-rows: auto; gap: 0; border: 1px solid var(--border); border-radius: 8px; background: #fff; overflow: hidden; }
.task-history-grid[data-view="list"]:empty { border: 0; }
.task-history-grid[data-view="list"] .task-history-card { display: grid; grid-template-columns: minmax(0, 1fr) auto; height: auto; padding: 12px; align-items: center; gap: 16px; border: 0; border-bottom: 1px solid var(--border); border-radius: 0; }
.task-history-grid[data-view="list"] .task-history-card:last-child { border-bottom: 0; }
.task-history-grid[data-view="list"] .task-history-card:hover { background: #fafbfc; box-shadow: none; }
.task-history-grid[data-view="list"] .task-history-card > a { display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 16px; align-items: center; }
.task-history-grid[data-view="list"] .task-history-card-media { width: 96px; height: 96px; border-radius: 6px; }
.task-history-grid[data-view="list"] .task-history-card-content { display: grid; padding: 0; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 16px; align-items: start; }
.task-history-grid[data-view="list"] .task-history-card-content h2 { grid-area: 1 / 1; min-height: 0; }
.task-history-grid[data-view="list"] .task-history-status-badge { grid-area: 1 / 2; justify-self: end; }
.task-history-grid[data-view="list"] .task-history-card-content p { grid-area: 2 / 1 / auto / -1; min-height: 0; -webkit-line-clamp: 1; }
.task-history-grid[data-view="list"] .task-history-card-meta { grid-area: 3 / 1; margin: 0; padding: 0; justify-content: flex-start; }
.task-history-grid[data-view="list"] .task-type-badge { grid-column: 1 / -1; width: fit-content; }
.task-history-grid[data-view="list"] :is(.task-history-recovery, .task-history-cleaned) { grid-column: 1 / -1; }
.task-history-grid[data-view="list"] .task-history-card-actions { display: flex; padding: 0; flex-direction: row; border: 0; }

@media (max-width: 700px) {
  body :is(.characters-shell, .materials-shell) { padding-top: 20px; }
  body :is(.character-library-panel, .materials-library, .settings-section, .step-host, .remake-stage) { padding: 16px; }
  body .wizard-heading-row .page-heading h1,
  body.viewing-task .wizard-heading-row .page-heading h1,
  body .remake-hero h1 { font-size: 24px; }
  .task-history-page { padding: 20px 16px 48px; }
  .task-history-page .task-history-heading { flex-wrap: wrap; gap: 8px; }
  .task-history-heading h1 { font-size: 24px; }
  .task-history-heading .history-back-button { padding-inline: 0; }
  .task-history-heading .task-history-count { font-size: 12px; }
  .task-history-page .cost-history-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .task-history-page .cost-history-actions { grid-column: 1 / -1; display: flex !important; flex-wrap: wrap; width: auto; justify-content: flex-start; justify-self: start; }
  .task-history-page .cost-history-actions a { width: auto; }
  .task-history-toolbar { gap: 8px; }
  .task-history-toolbar .task-history-search { flex: 1; min-width: 0; }
  .task-history-view-controls { flex-shrink: 0; }
  .task-history-grid[data-view="list"] .task-history-card { padding: 12px; gap: 12px; }
  .task-history-grid[data-view="list"] .task-history-card > a { grid-template-columns: 64px minmax(0, 1fr); gap: 12px; align-items: start; }
  .task-history-grid[data-view="list"] .task-history-card-media { width: 64px; height: 80px; }
  .task-history-grid[data-view="list"] .task-history-card-content { display: flex; gap: 4px; }
  .task-history-grid[data-view="list"] .task-history-card-content h2 { order: -1; font-size: 14px; }
  .task-history-grid[data-view="list"] .task-history-card-content p { display: none; }
  .task-history-grid[data-view="list"] .task-history-card-meta { font-size: 12px; gap: 2px 6px; }
  .task-history-grid[data-view="list"] .task-history-card-actions { flex-direction: column; }
  .task-history-page .task-history-pagination button { width: 44px; height: 44px; padding: 0; }
  .task-history-pagination button span { display: none; }
}
