body.mode-user .app-shell {
  grid-template-columns: minmax(0, 1fr);
  height: var(--portal-viewport-height, 100svh);
}

@keyframes progress-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

body.mode-user .sidebar,
body.mode-user .topbar,
body.mode-user .topbar-actions,
body.mode-user .eyebrow,
body.mode-user #pageSubtitle {
  display: none;
}

body.mode-user .workspace {
  grid-template-rows: minmax(0, 1fr);
}

body.mode-user.portal-input-focused {
  overflow: hidden;
}

body.mode-user .view {
  padding: 0;
}

body.mode-user .creator-user-select {
  display: none;
}

body.mode-admin .creator-user-badge {
  display: none;
}

.creator-shell {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  height: var(--portal-viewport-height, 100%);
  overflow: hidden;
  background: #fff;
}

.creator-topbar,
.creator-layout,
.creator-compose,
.creator-preview {
  min-width: 0;
}

.creator-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 22px;
  border-bottom: 1px solid #f2f2f2;
}

.creator-brand,
.creator-brand-nav {
  display: flex;
  align-items: baseline;
  gap: 12px;
}

.creator-brand-nav {
  align-items: center;
  min-width: 0;
  gap: 24px;
}

.creator-product-switch {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 3px;
  border: 1px solid #ececec;
  border-radius: 7px;
  background: #fafafa;
}

.creator-product-switch a {
  min-height: 32px;
  display: inline-flex;
  align-items: center;
  padding: 0 12px;
  border-radius: 5px;
  color: #6b6b68;
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
}

.creator-product-switch a:hover {
  color: #171717;
  background: #f1f1ef;
}

.creator-product-switch a.is-active {
  background: #171717;
  color: #fff;
}

.creator-topbar span {
  color: #777;
  font-size: 13px;
}

.creator-user-select {
  width: 260px;
}

.creator-user-badge {
  display: grid;
  gap: 2px;
  min-height: 34px;
  padding: 8px 12px;
  border: 1px solid #f0d9de;
  border-radius: 8px;
  background: #fff8f9;
  color: var(--creator-red);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.25;
}

.creator-user-badge strong {
  font-size: 13px;
}

.creator-user-badge span {
  color: #8b5b63;
  font-size: 12px;
  font-weight: 600;
}

.creator-user-badge.is-expired {
  border-color: #f2b8b5;
  background: #fff4f2;
  color: var(--danger);
}

.creator-user-badge.is-expired span {
  color: var(--danger);
}

.creator-actions {
  display: flex;
  align-items: end;
  gap: 10px;
}

.creator-layout {
  display: grid;
  grid-template-columns: 380px minmax(0, 1fr);
  gap: 0;
  min-height: 0;
  overflow: hidden;
  background: #fff;
}

.creator-compose,
.creator-preview {
  min-height: 0;
  padding: 0;
}

.creator-compose {
  display: grid;
  align-content: start;
  gap: 18px;
  overflow: auto;
  border-right: 1px solid #eeeeee;
  padding: 28px 26px;
  background: #fffafa;
}

.creator-preview {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  overflow: hidden;
  padding: 26px 30px;
  background: #fff;
}

.creator-heading span {
  color: var(--creator-red);
  font-size: 13px;
  font-weight: 700;
}

.creator-heading h2 {
  margin: 6px 0 0;
  max-width: 320px;
  font-size: 28px;
  line-height: 1.12;
}

.creator-form {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  align-items: stretch;
  margin-top: 0;
  max-width: 100%;
}

.creator-form label {
  min-width: 0;
}

.portal-payment-panel {
  display: grid;
  gap: 10px;
  border: 1px solid #f0e1e4;
  border-radius: 8px;
  padding: 12px;
  background: #fff;
}

.creator-user-badge strong {
  display: flex;
  align-items: center;
  gap: 8px;
}

.portal-credit-recharge {
  min-height: 24px;
  border: 1px solid #f1cbd1;
  border-radius: 999px;
  padding: 0 9px;
  background: #fff8f8;
  color: #9f1d35;
  font-size: 12px;
  font-weight: 700;
}

.portal-credit-recharge:hover {
  background: #fff0f1;
}

.creator-primary {
  min-height: 52px;
  width: 100%;
  grid-column: 1;
  border: 0;
  border-radius: 8px;
  background: var(--creator-red);
  color: #fff;
  font-size: 15px;
  font-weight: 700;
}

.creator-primary:disabled {
  background: #d1d5db;
  cursor: not-allowed;
}

.creator-submit-row {
  display: grid;
  grid-template-columns: minmax(160px, 1fr) minmax(132px, 0.58fr);
  gap: 10px;
}

.creator-submit-row .secondary-button,
.creator-submit-row .creator-primary {
  width: 100%;
}

.generation-pause-notice {
  margin: 0;
  border-left: 3px solid #ff2442;
  padding: 8px 10px;
  background: #fff5f6;
  color: #8f1d2f;
  font-size: 13px;
  line-height: 1.5;
}

.creator-preview-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.creator-preview-head strong {
  font-size: 16px;
}

.portal-history-retention-note {
  color: #777;
  font-size: 12px;
  line-height: 1.5;
  text-align: right;
}

.portal-tabs {
  display: flex;
  gap: 18px;
  border-bottom: 1px solid #ececec;
}

.portal-tabs button {
  min-height: 40px;
  border: 0;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  padding: 0 2px;
  background: transparent;
  color: #777;
  font-weight: 700;
}

.portal-tabs button.is-active {
  border-bottom-color: var(--creator-red);
  color: var(--ink);
}

.portal-tab-panel {
  display: none;
  margin-top: 14px;
  min-height: 0;
  overflow: auto;
}

.portal-tab-panel.is-active {
  display: block;
}

.portal-tab-panel[data-portal-panel="history"].is-active {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
}

.portal-tab-panel[data-portal-panel="current"].is-active {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  overflow: hidden;
}

.creator-mockup {
  display: grid;
  grid-template-columns: minmax(260px, 360px) minmax(0, 1fr);
  align-items: start;
  gap: 18px;
  margin-top: 16px;
}

.creator-sample-summary {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid #f0f0f0;
  border-radius: 8px;
}

.creator-sample-summary strong {
  font-size: 15px;
}

.creator-sample-summary span {
  color: #666;
  font-size: 13px;
}

.creator-sample-image {
  display: block;
  width: 100%;
  max-height: min(68vh, 720px);
  overflow: hidden;
  border: 1px solid #eeeeee;
  border-radius: 8px;
  padding: 0;
  background: #fafafa;
  cursor: zoom-in;
}

.creator-sample-image img {
  display: block;
  width: 100%;
  max-height: min(68vh, 720px);
  object-fit: contain;
  object-position: top center;
}

.portal-result {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  min-height: 120px;
  max-height: none;
  overflow: hidden;
  border: 1px solid #eeeeee;
  border-radius: 8px;
  background: #fff;
}

.portal-result-body {
  min-height: 0;
  overflow: auto;
  padding: 14px;
}

.portal-result-actions {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  padding: 10px;
  border-top: 1px solid #eeeeee;
  background: #fff;
}

.result-state {
  display: grid;
  gap: 6px;
}

.result-state.is-error span {
  color: var(--danger);
}

.result-state span {
  color: var(--creator-red);
  font-size: 12px;
  font-weight: 700;
}

.result-state p {
  color: #666;
  line-height: 1.55;
}

.result-ready-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.result-ready-head strong {
  min-width: 0;
  font-size: 16px;
  line-height: 1.35;
}

.result-ready-head span {
  flex: 0 0 auto;
  color: var(--creator-red);
  font-size: 12px;
  font-weight: 700;
}

.portal-task-progress {
  height: 8px;
  margin-top: 12px;
  overflow: hidden;
  border-radius: 999px;
  background: #ffe5ea;
}

.portal-task-progress span {
  display: block;
  height: 100%;
  min-width: 8px;
  border-radius: inherit;
  background: var(--creator-red);
  transition: width 220ms ease;
}

.portal-progress-meta {
  margin-top: 12px;
  color: #555;
  font-size: 12px;
}

.portal-history {
  background: transparent;
}

.portal-history-shell {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  gap: 10px;
  min-height: 0;
  overflow: hidden;
}

.portal-history-frame {
  display: grid;
  grid-template-rows: minmax(0, 1fr);
  min-height: 0;
  min-width: 0;
  overflow: hidden;
  border: 1px solid #eeeeee;
  border-radius: 8px;
  background: #fff;
}

.portal-history-table {
  min-height: 0;
  min-width: 0;
  overflow: auto;
}

.portal-task-table-head {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) 1fr auto auto minmax(140px, 0.6fr) auto;
  gap: 14px;
  padding: 0 14px 10px;
  color: #777;
  font-size: 12px;
  font-weight: 700;
  border-bottom: 1px solid #eeeeee;
  background: #fff;
}

.portal-task-row {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) 1fr auto auto minmax(140px, 0.6fr) auto;
  gap: 14px;
  align-items: center;
  padding: 16px 14px;
  border-bottom: 1px solid #eeeeee;
}

.portal-task-row:last-child {
  border-bottom: 0;
}

.portal-task-row-main {
  display: contents;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
}

.portal-task-row-main:hover {
  background: #fafafa;
}

.task-title-cell {
  min-width: 0;
}

.task-title-cell strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--ink);
  font-size: 14px;
}

.portal-task-row span {
  color: #555;
  font-size: 13px;
}

.task-progress {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.task-progress i {
  display: inline-block;
  width: 64px;
  height: 6px;
  border-radius: 999px;
  background: #eee;
  overflow: hidden;
}

.task-progress i i {
  display: block;
  height: 100%;
  background: var(--creator-red);
}

.portal-task-row-actions {
  display: flex;
  gap: 4px;
}

.portal-task-row-actions button {
  min-width: 30px;
  height: 30px;
  border: 1px solid #eee;
  border-radius: 6px;
  background: #fff;
  color: #555;
  font-size: 14px;
  line-height: 1;
}

.portal-task-row-actions button:hover {
  background: #fafafa;
}

.trash-action {
  color: var(--danger) !important;
}

.trash-action:hover {
  background: #fff7ed !important;
}

.draft-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  font-size: 13px;
  color: #555;
}

.draft-table-head {
  grid-template-columns: 40px minmax(0, 1.4fr) 1fr minmax(140px, 0.6fr) auto;
}

.draft-row {
  grid-template-columns: 40px minmax(0, 1.4fr) 1fr minmax(140px, 0.6fr) auto;
}

.draft-check {
  display: grid;
  place-items: center;
}

.draft-check input {
  width: 18px;
  height: 18px;
}

.task-pagination {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  padding: 10px 0;
  font-size: 13px;
  color: #555;
  flex-wrap: wrap;
}

.task-pagination .task-pagination-total {
  margin-right: auto;
  color: #666;
}

.task-pagination .task-pagination-total strong {
  color: #ff2442;
  font-size: 14px;
  margin: 0 2px;
}

.task-pagination-size {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #666;
}

.task-pagination-size select {
  height: 28px;
  border: 1px solid #e0e0e0;
  border-radius: 6px;
  padding: 0 22px 0 8px;
  font-size: 12px;
  background: #fff;
  color: #333;
  cursor: pointer;
  outline: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'><path d='M3 4.5l3 3 3-3' stroke='%23999' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/></svg>");
  background-repeat: no-repeat;
  background-position: right 6px center;
  background-size: 12px;
}

.task-pagination-size select:focus {
  border-color: #ff2442;
}

.mini-action {
  border: 1px solid #eee;
  border-radius: 6px;
  padding: 4px 10px;
  background: #fff;
  color: #555;
  font-size: 12px;
}

.mini-action:hover:not(:disabled) {
  background: #fafafa;
}

.mini-action:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.portal-history-empty {
  display: grid;
  place-items: center;
  min-height: 200px;
  color: #999;
  font-size: 14px;
}

/* 四段式阶段进度条（排队 / 生成文案 / 生成图片 / 整理结果） */
.stage-progress {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 14px;
  font-size: 12px;
  color: #999;
  flex-wrap: nowrap;
}
.stage-progress .stage-step {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
  white-space: nowrap;
  transition: color 200ms ease;
}
.stage-progress .stage-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #e0e0e0;
  border: 2px solid #e0e0e0;
  flex: 0 0 auto;
  transition: background 200ms ease, border-color 200ms ease, transform 200ms ease;
}
.stage-progress .stage-line {
  flex: 1 1 auto;
  min-width: 12px;
  height: 2px;
  background: #eee;
  transition: background 200ms ease;
}
.stage-progress .stage-step.is-active {
  color: #e63946;
  font-weight: 700;
}
.stage-progress .stage-step.is-active .stage-dot {
  background: #e63946;
  border-color: #e63946;
  transform: scale(1.15);
  box-shadow: 0 0 0 4px rgba(230, 57, 70, 0.12);
}
.stage-progress .stage-step.is-done {
  color: #52c41a;
}
.stage-progress .stage-step.is-done .stage-dot {
  background: #52c41a;
  border-color: #52c41a;
}
.stage-progress .stage-step.is-done + .stage-line,
.stage-progress .stage-line.is-done {
  background: #52c41a;
}

/* 图片横向排列容器（参考网站样式） */
.image-row {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 8px;
  scroll-snap-type: x mandatory;
}
.image-row .generated-image-item {
  flex: 0 0 auto;
  width: 140px;
  scroll-snap-align: start;
}

.creator-form select,
.creator-form textarea {
  width: 100%;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 12px;
  background: #fff;
  font: inherit;
}

.creator-form textarea {
  min-height: 80px;
  resize: vertical;
}

.creator-form label span {
  display: block;
  margin-bottom: 8px;
  font-size: 13px;
  font-weight: 700;
  color: #2b2b2b;
}