:root {
  --bg: #f8f7fb;
  --surface: #ffffff;
  --surface-muted: #fbfaff;
  --surface-strong: #f2eefb;
  --sidebar: #ffffff;
  --border: #ebe7f2;
  --border-strong: #d9d0e8;
  --text: #171324;
  --text-soft: #4d455d;
  --muted: #80778e;
  --muted-2: #aaa2b6;
  --accent: #6419d8;
  --accent-hover: #5314b7;
  --accent-soft: #f2eaff;
  --teal: #0f8f8c;
  --success: #16845b;
  --success-soft: #e8f7ef;
  --warning: #9b6116;
  --warning-soft: #fff4df;
  --danger: #b33b36;
  --danger-soft: #fff0ef;
  --shadow: 0 20px 46px rgba(40, 25, 70, 0.09);
  --shadow-soft: 0 1px 2px rgba(40, 25, 70, 0.06);
  --topbar-height: 64px;
  --sidebar-width: 244px;
  --radius-lg: 8px;
  --radius-md: 7px;
  --radius-sm: 5px;
  --font-body: "Noto Sans SC", "PingFang SC", "Microsoft YaHei", Arial, sans-serif;
  --font-display: "Manrope", "Noto Sans SC", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
  margin: 0;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.5;
  letter-spacing: 0;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.62;
}

::selection {
  background: rgba(49, 95, 220, 0.18);
}

.hidden {
  display: none !important;
}

[v-cloak] {
  display: none !important;
}

.top-bar {
  position: sticky;
  top: 0;
  z-index: 20;
  height: var(--topbar-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 22px;
  background: rgba(255, 255, 255, 0.9);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(12px);
}

.top-left,
.top-right,
.admin-actions,
.toolbar,
.detail-card-actions,
.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.top-left,
.top-right {
  min-width: 0;
}

.app-main-nav {
  min-width: 0;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(246, 248, 252, 0.78);
}

.app-nav-link {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 14px;
  border-radius: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.16s ease, color 0.16s ease, box-shadow 0.16s ease;
}

.app-nav-link:hover,
.app-nav-link:focus-visible {
  color: var(--text);
  background: rgba(255, 255, 255, 0.72);
  outline: none;
}

.app-nav-link.active {
  color: var(--text);
  background: #fff;
  box-shadow: 0 1px 3px rgba(20, 28, 45, 0.08);
}

.user-shell {
  display: inline-flex;
  align-items: center;
  min-width: 0;
}

.user-chip {
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: 340px;
  padding: 3px 4px 3px 6px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-muted);
  color: var(--text-soft);
}

.user-avatar {
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  display: inline-grid;
  place-items: center;
  border-radius: 50%;
  background: var(--accent);
  background-size: cover;
  background-position: center;
  color: #fff;
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 800;
}

.user-avatar.large {
  width: 46px;
  height: 46px;
  font-size: 16px;
}

.user-avatar.has-image {
  color: transparent;
}

.user-meta {
  min-width: 0;
  display: grid;
  gap: 1px;
}

.user-meta strong,
.user-meta em {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-meta strong {
  color: var(--text);
  font-weight: 700;
}

.user-meta em {
  color: var(--muted);
  font-size: 11px;
  font-style: normal;
  font-weight: 650;
}

.logo {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 800;
  color: var(--text);
  white-space: nowrap;
}

.menu-toggle {
  width: 34px;
  height: 34px;
  display: inline-grid;
  place-items: center;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--muted);
  transition: background 140ms ease, color 140ms ease, border-color 140ms ease;
}

.menu-toggle:hover {
  background: var(--surface-strong);
  border-color: var(--border);
  color: var(--text);
}

.mode-pill,
.cost-pill,
.status-chip,
.char-count,
.soft-note {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--surface-muted);
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.mode-pill {
  color: var(--accent);
  background: var(--accent-soft);
  border-color: #d7e0ff;
}

.cost-pill {
  color: var(--teal);
  background: #eaf8f7;
  border-color: #c9e9e7;
}

.app-layout {
  min-height: calc(100vh - var(--topbar-height));
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
}

body.avatar-flow .app-layout {
  grid-template-columns: minmax(0, 1fr);
}

.sidebar {
  position: sticky;
  top: var(--topbar-height);
  height: calc(100vh - var(--topbar-height));
  padding: 12px 8px;
  overflow-y: auto;
  background: var(--sidebar);
  border-right: 1px solid var(--border);
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 40px;
  padding: 0 12px;
  border-radius: var(--radius-md);
  color: var(--text-soft);
  font-size: 13px;
  font-weight: 650;
  transition: background 140ms ease, color 140ms ease;
}

.nav-item + .nav-item {
  margin-top: 3px;
}

.nav-item:hover {
  background: var(--surface-strong);
  color: var(--text);
}

.nav-item.active {
  position: relative;
  background: var(--accent-soft);
  color: var(--accent);
}

.nav-item.active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 9px;
  bottom: 9px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--accent);
}

.nav-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: var(--radius-sm);
  background: rgba(21, 32, 51, 0.05);
  color: inherit;
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 800;
}

.main-content {
  min-width: 0;
  padding: 18px 20px 26px;
}

.page {
  display: none;
}

.page.active {
  display: block;
}

.page-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 16px;
}

.eyebrow,
.panel-kicker,
.task-label {
  margin: 0 0 5px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
}

.page-header h1,
.panel-head h1,
.card-header h3,
.detail-card-head h3,
.detail-subsection h4 {
  margin: 0;
  font-family: var(--font-display);
  letter-spacing: 0;
}

.page-header h1 {
  font-size: clamp(24px, 2.2vw, 34px);
  line-height: 1.18;
}

.header-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(112px, 1fr));
  gap: 8px;
  min-width: min(480px, 100%);
}

.header-metrics div,
.usage-grid > div,
.task-summary-grid > div,
.summary-card {
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-soft);
}

.header-metrics span,
.usage-grid span,
.task-summary-grid span,
.summary-card span,
.detail-grid span,
.field-label,
.review-list span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}

.header-metrics strong,
.usage-grid strong,
.task-summary-grid strong,
.summary-card strong {
  display: block;
  margin-top: 3px;
  overflow-wrap: anywhere;
  color: var(--text);
  font-size: 14px;
}

.usage-grid small,
.operations-health-grid small {
  display: block;
  margin-top: 2px;
  overflow-wrap: anywhere;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.workbench-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 14px;
  align-items: start;
}

.workspace-left,
.workspace-right,
.admin-layout,
.stack,
.sidebar-stack,
.auth-grid {
  display: grid;
  gap: 14px;
}

.workspace-left-top {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(280px, 0.85fr);
  gap: 14px;
}

.card,
.panel {
  min-width: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-soft);
}

.card {
  padding: 14px;
}

.review-card,
.preview-card {
  position: sticky;
  top: calc(var(--topbar-height) + 16px);
}

.card-header,
.panel-head,
.detail-card-head,
.detail-subsection-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.header-actions {
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
}

.card-header h3 {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 15px;
  line-height: 1.3;
}

.task-header-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.icon-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px rgba(49, 95, 220, 0.1);
}

.btn,
.primary-button,
.secondary-button,
.ghost-link,
.text-button {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 0 13px;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  background: transparent;
  color: var(--text);
  font-weight: 750;
  line-height: 1;
  white-space: nowrap;
  transition: background 140ms ease, border-color 140ms ease, color 140ms ease, transform 80ms ease;
}

.btn:active,
.primary-button:active,
.secondary-button:active,
.ghost-link:active {
  transform: translateY(1px);
}

.btn-primary,
.primary-button {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.btn-primary:hover,
.primary-button:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}

.btn-outline,
.secondary-button,
.ghost-link {
  background: var(--surface);
  border-color: var(--border-strong);
  color: var(--text-soft);
}

.btn-outline:hover,
.secondary-button:hover,
.ghost-link:hover {
  background: var(--surface-strong);
  color: var(--text);
}

.btn-danger-outline {
  border-color: #f2c6c2;
  color: var(--danger);
  background: var(--surface);
}

.btn-danger-outline:hover {
  background: var(--danger-soft);
  border-color: #e4aca6;
  color: var(--danger);
}

.btn-link,
.text-button {
  min-height: 30px;
  padding: 0;
  border: 0;
  color: var(--accent);
  background: transparent;
}

.btn-link:hover,
.text-button:hover {
  color: var(--accent-hover);
}

.btn-sm {
  min-height: 32px;
  padding: 0 10px;
  font-size: 12px;
}

.btn-xs {
  min-height: 28px;
  padding: 0 9px;
  font-size: 12px;
  border-radius: 7px;
}

.full {
  width: 100%;
}

.inline {
  width: auto;
}

.upload-dropzone {
  min-height: 286px;
  display: grid;
  place-items: center;
  padding: 16px;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-lg);
  background: var(--surface-muted);
  transition: background 140ms ease, border-color 140ms ease;
}

.upload-dropzone.dragging {
  background: var(--accent-soft);
  border-color: var(--accent);
}

.dropzone-copy {
  max-width: 360px;
  display: grid;
  gap: 8px;
  text-align: center;
  overflow-wrap: anywhere;
}

.dropzone-copy strong,
.task-empty strong,
.audio-panel strong {
  color: var(--text);
  font-size: 15px;
}

.dropzone-copy p,
.audio-panel p,
.helper-text,
.field-helper,
.task-empty p,
.side-card p,
.panel-head p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.upload-progress {
  display: grid;
  gap: 7px;
  margin-top: 4px;
}

.progress-bar {
  width: 100%;
  height: 7px;
  overflow: hidden;
  border-radius: var(--radius-sm);
  background: #e3e8f0;
}

.progress-bar span {
  display: block;
  width: 0;
  height: 100%;
  background: var(--accent);
  transition: width 140ms ease;
}

.image-preview {
  width: 100%;
  display: grid;
  gap: 12px;
}

.image-preview img {
  width: 100%;
  max-height: 300px;
  object-fit: contain;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: #eef2f7;
}

.image-meta {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.image-meta strong {
  display: block;
  margin-bottom: 3px;
}

.image-meta p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.audio-panel {
  min-height: 286px;
  display: grid;
  align-content: center;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface-muted);
}

.audio-panel audio {
  width: 100%;
}

.compact-field {
  gap: 5px;
}

.compact-field select {
  min-height: 34px;
  font-size: 13px;
}

.form-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.form-grid,
.params-grid,
.detail-grid {
  display: grid;
  gap: 12px;
}

.form-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.params-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.form-group,
.field {
  min-width: 0;
  display: grid;
  gap: 6px;
}

.form-group.grow {
  min-width: 0;
}

.form-group > span,
.field-label {
  color: var(--text-soft);
  font-size: 12px;
  font-weight: 700;
}

.form-group input,
.form-group select,
.form-group textarea,
.toolbar input,
.toolbar select,
.input-text,
.input-select,
.mini-input,
.script-input {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  outline: none;
  background: #fff;
  color: var(--text);
  padding: 8px 10px;
  transition: border-color 140ms ease, box-shadow 140ms ease, background 140ms ease;
}

.form-group select,
.toolbar select,
.input-select {
  appearance: none;
  padding-right: 32px;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--muted) 50%),
    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position:
    calc(100% - 17px) 16px,
    calc(100% - 12px) 16px;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}

.form-group textarea,
.script-input {
  min-height: 142px;
  resize: vertical;
  line-height: 1.55;
}

.script-card .script-input {
  min-height: 178px;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus,
.toolbar input:focus,
.toolbar select:focus,
.input-text:focus,
.input-select:focus,
.mini-input:focus,
.script-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(49, 95, 220, 0.12);
}

.form-group input::placeholder,
.form-group textarea::placeholder,
.input-text::placeholder,
.script-input::placeholder {
  color: var(--muted-2);
}

.switch-row,
.toggle-row {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: var(--text-soft);
  font-size: 13px;
  font-weight: 650;
}

.switch-row input,
.toggle-row input {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
}

.inline-upload-row {
  display: flex;
  min-width: 0;
  gap: 8px;
  align-items: center;
}

.inline-upload-row .btn {
  min-height: 38px;
  white-space: nowrap;
}

.background-image-group .field-helper {
  min-height: 18px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.range-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 48px;
  gap: 10px;
  align-items: center;
  min-height: 38px;
}

.range-row input[type="range"] {
  width: 100%;
  accent-color: var(--accent);
}

.range-row strong {
  color: var(--text-soft);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.span-2,
.detail-span-2 {
  grid-column: span 2;
}

.field-helper.warning {
  color: var(--warning);
}

.model-select-field {
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: #fff;
}

.model-select-field .field-helper {
  line-height: 1.45;
}

.review-list {
  display: grid;
  gap: 0;
  margin-bottom: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.review-list div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 11px;
  background: var(--surface-muted);
}

.review-list div + div {
  border-top: 1px solid var(--border);
}

.review-list strong {
  min-width: 0;
  color: var(--text);
  text-align: right;
  overflow-wrap: anywhere;
}

.review-card .helper-text {
  margin-top: 10px;
}

.submit-actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

.status-chip.pending {
  color: var(--warning);
  background: var(--warning-soft);
  border-color: #efd19a;
}

.status-chip.blocked,
.status-chip.risk-high {
  color: var(--danger);
  background: var(--danger-soft);
  border-color: #f2c6c2;
}

.status-chip.approved,
.status-chip.risk-low {
  color: var(--success);
  background: var(--success-soft);
  border-color: #bde7cf;
}

.status-chip.rejected,
.status-chip.risk-medium {
  color: var(--warning);
  background: var(--warning-soft);
  border-color: #efd19a;
}

.status-chip.processing,
.status-chip.composing {
  color: var(--accent);
  background: var(--accent-soft);
  border-color: #d7e0ff;
}

.status-chip.success {
  color: var(--success);
  background: var(--success-soft);
  border-color: #bde7cf;
}

.status-chip.failed {
  color: var(--danger);
  background: var(--danger-soft);
  border-color: #f2c6c2;
}

.status-chip.limited {
  color: var(--danger);
  background: var(--danger-soft);
  border-color: #f2c6c2;
}

.status-chip.warning {
  color: var(--warning);
  background: var(--warning-soft);
  border-color: #efd19a;
}

.status-chip.normal,
.status-chip.observed {
  color: var(--muted);
  background: #f8fafc;
  border-color: var(--border);
}

.status-chip.canceled {
  color: var(--muted);
  background: #f4f1f8;
  border-color: var(--border-strong);
}

.status-chip.archived {
  color: var(--muted);
  background: #f8fafc;
  border-color: var(--border);
}

.status-chip.history-type {
  color: #31546f;
  background: #eef5f8;
  border-color: #d8e6ec;
}

.status-chip.active {
  color: var(--success);
  background: var(--success-soft);
  border-color: #bde7cf;
}

.status-chip.offline,
.status-chip.disabled {
  color: var(--muted);
  background: #f4f1f8;
  border-color: var(--border-strong);
}

.status-chip.large {
  min-height: 34px;
  padding: 0 12px;
}

.task-empty {
  min-height: 252px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 8px;
  padding: 18px;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-lg);
  background: var(--surface-muted);
  text-align: center;
}

.task-detail {
  display: grid;
  gap: 12px;
}

.task-banner {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface-muted);
}

.task-banner h3 {
  margin: 0 0 4px;
  font-family: var(--font-display);
  font-size: 17px;
}

.task-banner p {
  margin: 0;
  color: var(--muted);
}

.task-summary-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.timeline-list {
  display: grid;
  gap: 8px;
}

.segment-list {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.segment-item {
  display: grid;
  gap: 8px;
  padding: 10px 11px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-muted);
}

.segment-head,
.segment-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.segment-head strong {
  min-width: 0;
  color: var(--text);
  font-size: 13px;
}

.segment-item p {
  margin: 0;
  color: var(--text-soft);
  font-size: 12px;
  line-height: 1.55;
}

.segment-item .segment-prompt {
  padding-left: 8px;
  border-left: 2px solid var(--primary);
  color: var(--text);
}

.segment-meta {
  color: var(--muted);
  font-size: 12px;
}

.segment-meta span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.timeline-item {
  position: relative;
  padding: 10px 11px 10px 24px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-muted);
}

.timeline-item::before {
  content: "";
  position: absolute;
  top: 16px;
  left: 10px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
}

.timeline-item strong {
  display: block;
  color: var(--text);
  font-size: 13px;
}

.timeline-item span {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
}

.timeline-copy {
  margin: 6px 0 0;
  color: var(--text-soft);
  white-space: pre-wrap;
}

.timeline-code,
.code-block {
  margin: 8px 0 0;
  padding: 10px;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: #0f172a;
  color: #e6edf7;
  font-size: 12px;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
}

.video-wrap {
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface-muted);
}

.video-wrap video {
  width: 100%;
  display: block;
  border-radius: var(--radius-md);
  background: #111827;
}

.video-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 9px;
}

.admin-layout {
  grid-template-columns: minmax(0, 1fr);
}

.usage-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(130px, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}

.toolbar {
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 12px;
}

.toolbar input,
.toolbar select {
  width: auto;
  min-width: 132px;
}

.toolbar input[type="text"] {
  min-width: min(280px, 100%);
  flex: 1 1 220px;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

.usage-wrap {
  margin-bottom: 12px;
}

.task-table {
  width: 100%;
  min-width: 860px;
  border-collapse: collapse;
  background: var(--surface);
}

.compact-table {
  min-width: 720px;
}

.user-table {
  min-width: 980px;
}

.public-avatar-table {
  min-width: 920px;
}

.review-table {
  min-width: 1120px;
}

.operations-trend-table {
  min-width: 720px;
}

.operations-overall-trend-table {
  min-width: 760px;
}

.operations-small-table,
.operations-failure-table {
  min-width: 520px;
}

.operations-breakdown-table {
  min-width: 680px;
}

.task-table th,
.task-table td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}

.task-table th {
  background: var(--surface-muted);
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.task-table tr:last-child td {
  border-bottom: 0;
}

.task-table tbody tr:hover td {
  background: #fbfdff;
}

.admin-user-cell,
.admin-muted-stack {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.admin-user-cell {
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 10px;
}

.admin-user-cell strong,
.admin-muted-stack strong {
  min-width: 0;
  display: block;
  overflow: hidden;
  color: var(--text);
  font-size: 13px;
  line-height: 1.3;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-user-cell span:not(.user-avatar),
.admin-muted-stack span {
  min-width: 0;
  display: block;
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.access-select {
  width: 118px;
  min-height: 32px;
  padding: 0 28px 0 10px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  background-color: var(--surface);
  color: var(--text);
  font-size: 12px;
  font-weight: 700;
}

.access-select:focus {
  border-color: var(--accent);
  outline: 0;
  box-shadow: 0 0 0 3px rgba(49, 95, 220, 0.12);
}

.public-avatar-admin-layout {
  display: grid;
  grid-template-columns: minmax(320px, 0.42fr) minmax(0, 0.58fr);
  gap: 14px;
  align-items: start;
}

.public-avatar-editor {
  min-width: 0;
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface-muted);
}

.public-avatar-cover-control {
  min-width: 0;
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr);
  gap: 12px;
  align-items: stretch;
  padding: 10px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  background: var(--surface);
  transition: border-color 140ms ease, box-shadow 140ms ease;
}

.public-avatar-cover-control.is-uploading {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(49, 95, 220, 0.1);
}

.public-avatar-cover-preview {
  width: 112px;
  aspect-ratio: 4 / 5;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-muted);
}

.public-avatar-cover-preview img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  object-position: center top;
}

.public-avatar-cover-empty {
  width: 100%;
  height: 100%;
  display: grid;
  place-content: center;
  gap: 4px;
  padding: 10px;
  text-align: center;
}

.public-avatar-cover-empty strong {
  color: var(--text-soft);
  font-size: 12px;
}

.public-avatar-cover-empty span,
.public-avatar-cover-content .field-helper {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.45;
}

.public-avatar-cover-content {
  min-width: 0;
  display: grid;
  align-content: center;
  gap: 8px;
}

.public-avatar-cover-input {
  display: none;
}

.public-avatar-cover-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.public-avatar-cover-content .field-helper {
  margin: 0;
}

.public-avatar-variants-editor {
  display: grid;
  gap: 10px;
  padding-top: 4px;
}

.public-avatar-variant-empty {
  padding: 12px;
  border: 1px dashed var(--border-strong);
  color: var(--muted);
  text-align: center;
}

.public-avatar-variant-row {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: start;
  padding: 10px 0;
  border-top: 1px solid var(--border);
}

.public-avatar-variant-preview {
  width: 72px;
  aspect-ratio: 4 / 5;
  overflow: hidden;
  display: grid;
  place-items: center;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
}

.public-avatar-variant-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
}

.public-avatar-variant-fields {
  min-width: 0;
  display: grid;
  gap: 7px;
}

.public-avatar-variant-inline {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
}

.public-avatar-variant-actions {
  display: grid;
  gap: 7px;
}

.public-avatar-variant-actions label {
  cursor: pointer;
}

.public-avatar-variant-actions input[type="file"] {
  display: none;
}

.admin-avatar-cell {
  min-width: 0;
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
}

.admin-avatar-cell img {
  width: 48px;
  height: 58px;
  display: block;
  object-fit: cover;
  object-position: center top;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--surface-muted);
}

.admin-avatar-cell strong,
.admin-avatar-cell span {
  min-width: 0;
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-avatar-cell strong {
  color: var(--text);
  font-size: 13px;
}

.admin-avatar-cell span {
  color: var(--muted);
  font-size: 12px;
}

.avatar-row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.operations-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(320px, 0.85fr);
  gap: 14px;
  align-items: start;
}

.operations-overview-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.18fr) minmax(320px, 0.82fr);
  gap: 14px;
  align-items: start;
  margin-bottom: 14px;
}

.operations-overall-metrics > div {
  background: var(--surface-muted);
}

.operations-secondary-metrics {
  margin-top: -4px;
}

.operations-panel {
  min-width: 0;
  display: grid;
  gap: 10px;
}

.operations-panel-wide {
  grid-column: 1 / -1;
}

.storage-cleanup-panel {
  margin-bottom: 14px;
}

.operations-table-wrap {
  margin: 0;
}

.operations-health-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.operations-health-grid > div {
  min-width: 0;
  padding: 9px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
}

.operations-health-grid span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}

.operations-health-grid strong {
  display: block;
  margin-top: 2px;
  overflow-wrap: anywhere;
  color: var(--text);
  font-size: 14px;
}

.rate-limit-summary-grid,
.system-log-summary-grid,
.queue-summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.rate-limit-summary-grid > div,
.system-log-summary-grid > div,
.queue-summary-grid > div {
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fbfcff;
}

.rate-limit-summary-grid span,
.system-log-summary-grid span,
.queue-summary-grid span,
.rate-limit-scope-chip em {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
}

.rate-limit-summary-grid strong,
.system-log-summary-grid strong,
.queue-summary-grid strong {
  display: block;
  margin-top: 4px;
  color: var(--text);
  font-size: 20px;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}

.system-log-summary-grid small,
.queue-summary-grid small {
  display: block;
  margin-top: 4px;
  overflow-wrap: anywhere;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.queue-monitor-panel {
  margin-bottom: 14px;
}

.queue-monitor-grid {
  display: grid;
  grid-template-columns: minmax(320px, 0.74fr) minmax(0, 1.26fr);
  gap: 14px;
  align-items: start;
}

.queue-policy-table {
  min-width: 520px;
}

.queue-recovery-table {
  min-width: 760px;
}

.system-log-diagnostics-panel {
  margin-bottom: 14px;
}

.system-log-diagnostics-grid {
  display: grid;
  grid-template-columns: minmax(260px, 0.42fr) minmax(0, 1fr);
  gap: 14px;
  align-items: start;
}

.rate-limit-scope-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.rate-limit-scope-chip {
  display: inline-flex;
  min-height: 32px;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  font-size: 12px;
}

.rate-limit-scope-chip em {
  color: var(--warning);
}

.rate-limit-runtime-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
  gap: 10px;
}

.rate-limit-runtime-grid .compact-table {
  min-width: 620px;
}

.system-log-breakdown-table {
  min-width: 360px;
}

.system-log-problem-table {
  min-width: 680px;
}

.trend-meter {
  width: 120px;
  height: 8px;
  display: inline-flex;
  overflow: hidden;
  border-radius: 999px;
  background: #eef2f7;
  vertical-align: middle;
}

.trend-meter i {
  min-width: 4px;
  display: block;
  border-radius: inherit;
  background: var(--accent);
}

.review-content-cell {
  min-width: 0;
  display: grid;
  gap: 5px;
  max-width: 360px;
}

.review-content-cell strong,
.review-content-cell p,
.review-content-cell span {
  min-width: 0;
  margin: 0;
  overflow-wrap: anywhere;
}

.review-content-cell strong {
  color: var(--text);
}

.review-content-cell p,
.review-content-cell span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.review-row-actions {
  display: grid;
  gap: 8px;
  min-width: 86px;
}

.empty-table-cell {
  padding: 26px 12px !important;
  color: var(--muted);
  text-align: center !important;
}

.detail-card {
  scroll-margin-top: calc(var(--topbar-height) + 16px);
}

.route-empty {
  display: grid;
  justify-items: start;
  gap: 8px;
  padding: 22px;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-lg);
  background: var(--surface-muted);
}

.route-empty strong {
  color: var(--text);
  font-size: 16px;
}

.route-empty p {
  margin: 0;
  color: var(--muted);
}

.detail-card-head {
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.detail-card-head p {
  margin: 3px 0 0;
  color: var(--muted);
}

.detail-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.detail-grid > div {
  min-width: 0;
  padding: 11px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface-muted);
}

.detail-grid p {
  margin: 4px 0 0;
  color: var(--text);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.detail-grid a {
  color: var(--accent);
  font-weight: 700;
}

.detail-subsection {
  margin-top: 14px;
}

.detail-subsection h4 {
  font-size: 15px;
}

.mini-preview {
  min-height: 150px;
  display: grid;
  place-items: center;
  overflow: hidden;
  margin-top: 6px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: #eef2f7;
  color: var(--muted);
}

.mini-preview img {
  width: 100%;
  height: 100%;
  max-height: 260px;
  object-fit: contain;
}

.page-shell {
  min-height: 100vh;
  padding: 22px;
}

.theme-admin {
  min-height: 100vh;
  background: var(--bg);
}

.auth-shell {
  display: grid;
  place-items: center;
}

.auth-card {
  width: min(520px, 100%);
  padding: 22px;
  box-shadow: var(--shadow);
}

.auth-head {
  align-items: flex-start;
}

.panel-kicker {
  color: var(--accent);
}

.panel-head h1 {
  font-size: 26px;
}

.auth-gate {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(20, 17, 30, 0.48);
}

.auth-card {
  position: relative;
  width: min(420px, 100%);
  display: grid;
  gap: 16px;
  padding: 24px;
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: 0 24px 70px rgba(30, 20, 55, 0.24);
}

.auth-card-head {
  display: grid;
  gap: 7px;
  padding-right: 34px;
}

.auth-card-head h2 {
  margin: 0;
  font-size: 22px;
  line-height: 1.2;
}

.auth-card-head p {
  margin: 0;
  color: var(--text-soft);
}

.profile-card {
  width: min(560px, 100%);
}

.digital-human-voice-card {
  width: min(480px, 100%);
  max-height: min(760px, calc(100vh - 48px));
  overflow: auto;
}

.digital-human-image-editor {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  gap: 14px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-muted);
}

.digital-human-image-preview {
  aspect-ratio: 4 / 5;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #edeaf2;
}

.digital-human-image-preview img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
}

.digital-human-image-copy {
  min-width: 0;
  display: grid;
  gap: 6px;
}

.digital-human-image-copy > span {
  color: var(--text-soft);
  font-size: 12px;
  font-weight: 700;
}

.digital-human-image-copy strong,
.digital-human-image-copy .field-helper {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.digital-human-image-agreement {
  align-items: flex-start;
  font-size: 13px;
}

.digital-human-material-picker {
  display: grid;
  gap: 8px;
}

.digital-human-material-picker > span {
  color: var(--text-soft);
  font-size: 12px;
  font-weight: 700;
}

.digital-human-material-list {
  max-height: 176px;
  display: grid;
  gap: 8px;
  overflow: auto;
  padding-right: 2px;
}

.digital-human-material-option {
  width: 100%;
  min-width: 0;
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  color: inherit;
  text-align: left;
  cursor: pointer;
  transition: border-color 140ms ease, background 140ms ease, box-shadow 140ms ease;
}

.digital-human-material-option:hover,
.digital-human-material-option:focus-visible {
  border-color: var(--border-strong);
  background: #f8fafc;
  outline: none;
}

.digital-human-material-option.selected {
  border-color: var(--accent);
  background: var(--accent-soft);
  box-shadow: 0 0 0 2px rgba(49, 95, 220, 0.12);
}

.digital-human-material-thumb {
  width: 44px;
  aspect-ratio: 4 / 5;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: 7px;
  background: #eef2f7;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.digital-human-material-thumb img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.digital-human-material-copy {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.digital-human-material-copy strong,
.digital-human-material-copy em {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.digital-human-material-copy strong {
  color: var(--text);
  font-size: 13px;
}

.digital-human-material-copy em {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
}

.digital-human-voice-card #digitalHumanVoiceName {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.digital-human-voice-card #digitalHumanVoiceSummary {
  min-height: 18px;
}

.digital-human-voice-card #digitalHumanDescriptionInput {
  min-height: 82px;
}

.share-card {
  width: min(560px, 100%);
}

.history-detail-card {
  width: min(920px, 100%);
  max-height: min(86vh, 820px);
  overflow: auto;
}

.history-detail-body {
  display: grid;
  gap: 12px;
}

.history-detail-card .video-wrap video {
  aspect-ratio: 9 / 16;
  max-height: 520px;
  object-fit: contain;
}

.history-detail-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.public-avatar-detail-card {
  width: min(860px, 100%);
}

.public-avatar-detail-layout {
  display: grid;
  grid-template-columns: minmax(240px, 0.42fr) minmax(0, 0.58fr);
  gap: 18px;
  align-items: start;
}

.public-avatar-detail-media {
  display: grid;
  gap: 10px;
}

.public-avatar-detail-media img,
.public-avatar-detail-media video {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #edeaf2;
}

.public-avatar-detail-media img {
  aspect-ratio: 4 / 5;
  object-fit: cover;
  object-position: center top;
}

.public-avatar-detail-media video {
  aspect-ratio: 16 / 9;
}

.public-avatar-detail-body {
  min-width: 0;
  display: grid;
  gap: 14px;
}

.public-avatar-detail-meta {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-muted);
}

.public-avatar-detail-meta div {
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr);
  gap: 8px;
  color: var(--text-soft);
  font-size: 13px;
}

.public-avatar-detail-meta strong {
  color: var(--text);
}

.public-avatar-asset-options {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(92px, 1fr));
  gap: 8px;
}

.public-avatar-asset-option {
  min-width: 0;
  display: grid;
  gap: 6px;
  padding: 6px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-soft);
  cursor: pointer;
}

.public-avatar-asset-option:hover,
.public-avatar-asset-option.selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(49, 95, 220, 0.1);
}

.public-avatar-asset-option img {
  width: 100%;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  object-position: center top;
}

.public-avatar-asset-option span {
  overflow: hidden;
  font-size: 12px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.public-avatar-detail-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.compliance-card {
  width: min(640px, 100%);
  max-height: min(720px, calc(100vh - 48px));
}

.compliance-content {
  display: grid;
  gap: 12px;
  max-height: min(420px, 48vh);
  overflow: auto;
  padding-right: 4px;
}

.compliance-content section {
  display: grid;
  gap: 4px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-muted);
}

.compliance-content h3,
.compliance-content p {
  margin: 0;
}

.compliance-content h3 {
  font-size: 14px;
}

.compliance-content p {
  color: var(--text-soft);
  font-size: 13px;
  line-height: 1.65;
}

.share-form-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: end;
}

.share-download-policy-row {
  grid-column: 1 / -1;
}

.share-permission-summary {
  min-height: 18px;
  margin-top: -2px;
}

.share-link-box {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-muted);
}

.share-link-box span {
  grid-column: 1 / -1;
  color: var(--text-soft);
  font-size: 12px;
  font-weight: 700;
}

.share-link-box input {
  min-width: 0;
  min-height: 34px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  background: #fff;
  color: var(--text);
  padding: 7px 9px;
}

.share-actions {
  grid-template-columns: 1fr;
}

.profile-preview {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface-muted);
}

.profile-preview div {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.profile-preview strong,
.profile-preview span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profile-preview strong {
  color: var(--text);
  font-size: 14px;
}

.profile-preview span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}

.profile-form-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.auth-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 34px;
  height: 34px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-muted);
  color: var(--muted);
}

.auth-close:hover {
  color: var(--text);
  border-color: var(--border-strong);
}

.auth-actions {
  display: grid;
  gap: 10px;
}

.auth-code-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
}

.auth-code-row .btn {
  min-height: 42px;
  white-space: nowrap;
}

.auth-card input:focus {
  outline: 2px solid rgba(100, 25, 216, 0.18);
  outline-offset: 2px;
  border-color: var(--accent);
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  /* Keep validation errors visible above the upload drawer/backdrop. */
  z-index: 120;
  max-width: min(380px, calc(100vw - 36px));
  padding: 11px 13px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  background: #172033;
  color: #fff;
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 160ms ease, transform 160ms ease;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.share-page {
  min-height: 100vh;
  background: var(--surface-muted);
}

.share-shell {
  width: min(980px, calc(100% - 32px));
  min-height: 100vh;
  display: grid;
  align-items: center;
  margin: 0 auto;
  padding: 32px 0;
}

.share-viewer {
  display: grid;
  gap: 16px;
  padding: 22px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow-soft);
}

.share-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.share-head h1 {
  margin: 8px 0 4px;
  color: var(--text);
  font-size: clamp(22px, 3vw, 32px);
  line-height: 1.12;
}

.share-head p {
  margin: 0;
  color: var(--muted);
}

.share-video-frame {
  min-height: 260px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #101828;
}

.share-video-frame video {
  width: 100%;
  max-height: min(72vh, 720px);
  display: block;
  background: #101828;
}

.share-empty {
  padding: 28px;
  color: rgba(255, 255, 255, 0.82);
  font-weight: 800;
  text-align: center;
}

.share-actions-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

.toast[data-type="error"] {
  background: #7f1d1d;
}

.promo-strip {
  min-height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  padding: 8px 18px;
  background: linear-gradient(90deg, #e8ddff 0%, #f7e5f4 100%);
  color: #301553;
  font-size: 13px;
  font-weight: 750;
}

.promo-strip span {
  color: #6c597d;
  font-weight: 650;
}

.avatar-studio {
  background:
    radial-gradient(circle at 82% -10%, rgba(100, 25, 216, 0.08), transparent 28rem),
    var(--bg);
}

.avatar-studio .top-bar {
  background: rgba(255, 255, 255, 0.94);
  border-bottom-color: var(--border);
  box-shadow: 0 1px 0 rgba(46, 30, 72, 0.02);
}

@media (min-width: 981px) {
  .avatar-studio .sidebar-brand {
    display: none;
  }

  body.avatar-studio.sidebar-collapsed .sidebar {
    padding: 16px 10px;
  }

  body.avatar-studio.sidebar-collapsed .sidebar-section,
  body.avatar-studio.sidebar-collapsed .sidebar-create,
  body.avatar-studio.sidebar-collapsed .sidebar-account {
    display: none;
  }
}

.brand-lockup,
.sidebar-brand,
.sidebar-account {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-mark {
  flex: 0 0 auto;
  width: 36px;
  height: 36px;
  display: inline-grid;
  place-items: center;
  border-radius: 8px;
  background: linear-gradient(145deg, #7b28f2, #4d12c7);
  color: #fff;
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 900;
  box-shadow: 0 10px 24px rgba(100, 25, 216, 0.22);
  overflow: hidden;
}

.brand-mark img {
  width: 100%;
  height: 100%;
  display: block;
  border-radius: inherit;
  object-fit: cover;
}

.brand-lockup .brand-title {
  color: var(--text);
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 850;
  line-height: 1.1;
}

.brand-lockup span,
.sidebar-brand span,
.sidebar-account em {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
  font-weight: 650;
}

.avatar-studio .top-left > .logo {
  display: none;
}

.avatar-studio .mode-pill {
  border-color: #e3d7f7;
  background: #f5efff;
  color: var(--accent);
}

.avatar-studio .cost-pill {
  border-color: #ecdca6;
  background: #fff6dd;
  color: #8a6200;
}

.avatar-studio .sidebar {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 20px 18px;
  background: var(--sidebar);
}

.sidebar-brand {
  padding: 4px 4px 18px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 8px;
}

.sidebar-brand strong {
  display: block;
  color: var(--text);
  font-family: var(--font-display);
  font-size: 17px;
  line-height: 1.1;
}

.sidebar-section {
  display: block;
  padding: 12px 4px 4px;
  color: #a49aaa;
  font-size: 12px;
  font-weight: 750;
}

.muted-section {
  margin-top: 14px;
  border-top: 1px solid var(--border);
}

.avatar-studio .nav-item {
  min-height: 44px;
  padding: 0 12px;
  border-radius: 8px;
  color: #574d66;
  font-size: 14px;
}

.avatar-studio .nav-icon {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: #f5f2fa;
  color: #7a7187;
}

.avatar-studio .nav-item:hover {
  background: #f7f3ff;
  color: var(--accent);
}

.avatar-studio .nav-item.active {
  background: var(--accent-soft);
  color: var(--accent);
}

.avatar-studio .nav-item.active::before {
  display: none;
}

.sidebar-create {
  min-height: 46px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-top: auto;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font-weight: 850;
  box-shadow: 0 12px 24px rgba(100, 25, 216, 0.18);
  transition: background 140ms ease, transform 80ms ease;
}

.sidebar-create:hover {
  background: var(--accent-hover);
}

.sidebar-create:active {
  transform: translateY(1px);
}

.sidebar-account {
  margin-top: 6px;
  padding: 10px 2px 0;
  border-top: 1px solid var(--border);
}

.sidebar-account > span {
  width: 36px;
  height: 36px;
  display: inline-grid;
  place-items: center;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 900;
}

.sidebar-account strong {
  display: block;
  color: var(--text);
  font-size: 13px;
  line-height: 1.2;
}

.avatar-studio .main-content {
  padding: 28px 32px 36px;
}

.avatar-studio .page-header {
  align-items: center;
  margin-bottom: 20px;
}

.avatar-studio .eyebrow {
  color: var(--accent);
}

.avatar-studio .page-header h1 {
  font-size: clamp(28px, 2.5vw, 40px);
}

.avatar-studio .header-metrics {
  min-width: min(520px, 100%);
}

.avatar-studio .header-metrics div {
  border-color: var(--border);
  background: #fff;
}

.studio-tabs {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 16px;
}

.tabs-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.studio-tab {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 16px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--text-soft);
  font-weight: 800;
}

.studio-tab.active {
  background: var(--accent-soft);
  color: var(--accent);
}

.studio-search {
  width: min(340px, 100%);
  min-height: 42px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  color: var(--muted);
}

.studio-search input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
}

.avatar-mode-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 22px;
}

.mode-card {
  min-height: 112px;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow-soft);
}

.mode-card.active {
  border-color: #cdb7f4;
  background: linear-gradient(180deg, #fff 0%, #f8f3ff 100%);
}

.mode-icon {
  width: 42px;
  height: 42px;
  display: inline-grid;
  place-items: center;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 900;
}

.mode-card:not(.active) .mode-icon {
  background: #f3f0f8;
  color: #7a7089;
}

.mode-card strong {
  display: block;
  color: var(--text);
  font-size: 16px;
}

.mode-card p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.avatar-studio .workbench-grid {
  grid-template-columns: minmax(0, 1fr) 390px;
  gap: 22px;
}

.avatar-studio .workspace-left,
.avatar-studio .workspace-right {
  gap: 18px;
}

.avatar-studio .workspace-left-top {
  grid-template-columns: minmax(360px, 1.08fr) minmax(300px, 0.92fr);
  gap: 18px;
}

.avatar-studio .card,
.avatar-studio .panel {
  border-color: var(--border);
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 12px 28px rgba(42, 25, 68, 0.05);
}

.avatar-studio .card {
  padding: 18px;
}

.avatar-studio .card-header h3 {
  font-size: 16px;
}

.avatar-studio .icon-dot {
  width: 10px;
  height: 10px;
  background: var(--accent);
  box-shadow: 0 0 0 5px rgba(100, 25, 216, 0.1);
}

.avatar-studio .upload-card {
  min-height: 430px;
}

.avatar-studio .upload-dropzone {
  min-height: 350px;
  border-color: #cdb7f4;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.88), rgba(249, 245, 255, 0.88)),
    var(--surface-muted);
}

.avatar-studio .upload-dropzone.dragging {
  border-color: var(--accent);
  background: #f5efff;
}

.avatar-studio .dropzone-copy::before {
  content: "+";
  width: 44px;
  height: 44px;
  display: inline-grid;
  place-items: center;
  justify-self: center;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: 26px;
  font-weight: 800;
  line-height: 1;
}

.avatar-studio .dropzone-copy strong {
  color: var(--accent);
  font-size: 18px;
}

.avatar-studio .image-preview img {
  aspect-ratio: 4 / 5;
  max-height: 420px;
  object-fit: contain;
  border-color: var(--border);
  background: #f6f4fa;
}

.avatar-studio .audio-panel {
  min-height: 350px;
  border-color: var(--border);
  background: linear-gradient(180deg, #fff, #fbf9ff);
}

.avatar-studio .params-grid {
  border-color: var(--border);
  background: #fcfbff;
}

.avatar-studio .params-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  padding: 4px;
}

.avatar-studio .form-group input,
.avatar-studio .form-group select,
.avatar-studio .form-group textarea,
.avatar-studio .toolbar input,
.avatar-studio .toolbar select,
.avatar-studio .input-text,
.avatar-studio .input-select,
.avatar-studio .mini-input,
.avatar-studio .script-input {
  min-height: 42px;
  border-color: #ded6ea;
  border-radius: 8px;
  background: #fff;
}

.avatar-studio .form-group textarea,
.avatar-studio .script-input {
  min-height: 150px;
}

.avatar-studio .script-card .script-input {
  min-height: 188px;
}

.avatar-studio .form-group input:focus,
.avatar-studio .form-group select:focus,
.avatar-studio .form-group textarea:focus,
.avatar-studio .toolbar input:focus,
.avatar-studio .toolbar select:focus,
.avatar-studio .input-text:focus,
.avatar-studio .input-select:focus,
.avatar-studio .mini-input:focus,
.avatar-studio .script-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(100, 25, 216, 0.12);
}

.avatar-studio .btn {
  border-radius: 8px;
}

.avatar-studio .btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  box-shadow: 0 10px 22px rgba(100, 25, 216, 0.15);
}

.avatar-studio .btn-primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}

.avatar-studio .btn-outline {
  background: #fff;
  border-color: #ded6ea;
}

.avatar-studio .review-card {
  top: calc(var(--topbar-height) + 18px);
}

.avatar-studio .preview-card {
  position: static;
}

.avatar-studio .review-list {
  border-color: var(--border);
  background: #fff;
}

.avatar-studio .review-list div {
  background: #fcfbff;
}

.avatar-studio .task-empty {
  min-height: 260px;
  border-color: #d7c5f4;
  background: #fbf8ff;
}

.avatar-studio .task-banner,
.avatar-studio .segment-item,
.avatar-studio .timeline-item,
.avatar-studio .video-wrap,
.avatar-studio .task-summary-grid > div {
  border-color: var(--border);
  background: #fcfbff;
}

.avatar-studio .video-wrap video {
  aspect-ratio: 9 / 16;
  max-height: 520px;
  object-fit: contain;
}

body.sidebar-collapsed .app-layout {
  grid-template-columns: 72px minmax(0, 1fr);
}

body.sidebar-collapsed .sidebar {
  width: 72px;
}

body.sidebar-collapsed .nav-item {
  justify-content: center;
  padding: 0;
}

body.sidebar-collapsed .nav-text {
  display: none;
}

body.sidebar-collapsed .nav-item.active::before {
  display: none;
}

@media (max-width: 1180px) {
  .workbench-grid {
    grid-template-columns: 1fr;
  }

  .review-card,
  .preview-card {
    position: static;
  }

  .workspace-right {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 980px) {
  .app-layout,
  body.sidebar-collapsed .app-layout {
    grid-template-columns: 1fr;
  }

  .sidebar,
  body.sidebar-collapsed .sidebar {
    position: static;
    width: auto;
    height: auto;
    display: flex;
    gap: 6px;
    overflow-x: auto;
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }

  .nav-item,
  body.sidebar-collapsed .nav-item {
    flex: 0 0 auto;
    justify-content: flex-start;
    padding: 0 12px;
  }

  body.sidebar-collapsed .nav-text {
    display: inline;
  }

  .nav-item.active::before {
    display: none;
  }

  .page-header {
    align-items: stretch;
    flex-direction: column;
  }

  .header-metrics {
    min-width: 0;
  }

  .workspace-left-top,
  .workspace-right,
  .form-row,
  .params-grid,
  .detail-grid {
    grid-template-columns: 1fr;
  }

  .span-2,
  .detail-span-2 {
    grid-column: auto;
  }
}

@media (max-width: 720px) {
  .top-bar {
    height: auto;
    min-height: var(--topbar-height);
    flex-wrap: wrap;
    padding: 10px 12px;
  }

  .top-right {
    width: 100%;
    justify-content: flex-start;
    overflow-x: auto;
  }

  .app-main-nav {
    order: 3;
    width: 100%;
    overflow-x: auto;
    justify-content: flex-start;
  }

  .app-nav-link {
    flex: 0 0 auto;
  }

  .user-chip {
    max-width: 190px;
  }

  .auth-gate {
    align-items: end;
    padding: 12px;
  }

  .auth-card {
    padding: 20px 16px;
  }

  .app-layout {
    min-height: auto;
  }

  .main-content {
    padding: 14px 12px 22px;
    overflow-x: hidden;
  }

  .header-metrics {
    grid-template-columns: 1fr;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .share-form-grid,
  .share-link-box {
    grid-template-columns: 1fr;
  }

  .share-shell {
    width: min(100% - 20px, 980px);
    align-items: start;
    padding: 12px 0;
  }

  .share-viewer {
    padding: 16px;
  }

  .share-head,
  .share-actions-row {
    align-items: stretch;
    flex-direction: column;
  }

  .public-avatar-admin-layout,
  .operations-overview-grid,
  .operations-grid,
  .queue-monitor-grid,
  .rate-limit-runtime-grid,
  .system-log-diagnostics-grid {
    grid-template-columns: 1fr;
  }

  .public-avatar-cover-control {
    grid-template-columns: 96px minmax(0, 1fr);
  }

  .public-avatar-cover-preview {
    width: 96px;
  }

  .rate-limit-summary-grid,
  .system-log-summary-grid,
  .queue-summary-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .usage-grid {
    grid-template-columns: 1fr;
  }

  .operations-health-grid {
    grid-template-columns: 1fr;
  }

  .task-summary-grid {
    grid-template-columns: 1fr;
  }

  .task-banner,
  .image-meta,
  .detail-card-head,
  .card-header,
  .panel-head {
    align-items: stretch;
    flex-direction: column;
  }

  .task-header-actions {
    justify-content: flex-start;
  }

  .toolbar input,
  .toolbar select,
  .toolbar .btn {
    width: 100%;
  }

  .rate-limit-summary-grid,
  .system-log-summary-grid,
  .queue-summary-grid {
    grid-template-columns: 1fr;
  }

  .page-shell {
    padding: 14px;
  }

  .upload-dropzone,
  .audio-panel {
    min-height: 248px;
  }

  .dropzone-copy {
    max-width: 100%;
    padding: 0 4px;
  }
}

@media (max-width: 1180px) {
  .avatar-studio .workbench-grid {
    grid-template-columns: 1fr;
  }

  .avatar-studio .review-card,
  .avatar-studio .preview-card {
    position: static;
  }

  .avatar-studio .workspace-right {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 980px) {
  .avatar-studio .sidebar {
    position: static;
    width: auto;
    height: auto;
    flex-direction: row;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    overflow-x: auto;
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }

  .avatar-studio .sidebar-brand,
  .avatar-studio .sidebar-section,
  .avatar-studio .sidebar-create,
  .avatar-studio .sidebar-account {
    display: none;
  }

  .avatar-studio .nav-item,
  body.avatar-studio.sidebar-collapsed .nav-item {
    flex: 0 0 auto;
    min-height: 40px;
    padding: 0 12px;
  }

  .avatar-studio .workspace-left-top,
  .avatar-studio .workspace-right,
  .avatar-studio .form-row,
  .avatar-studio .params-grid,
  .avatar-studio .detail-grid {
    grid-template-columns: 1fr;
  }

  .avatar-studio .avatar-mode-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .promo-strip {
    justify-content: flex-start;
    gap: 8px;
    overflow-x: auto;
    white-space: nowrap;
  }

  .avatar-studio .top-bar {
    min-height: var(--topbar-height);
  }

  .avatar-studio .brand-lockup div > span {
    display: none;
  }

  .avatar-studio .main-content {
    padding: 16px 12px 24px;
  }

  .avatar-studio .page-header,
  .avatar-studio .page-header > div {
    min-width: 0;
    max-width: 100%;
  }

  .avatar-studio .page-header h1 {
    width: 100%;
    max-width: 100%;
    font-size: 26px;
    line-height: 1.18;
    white-space: normal;
    word-break: break-all;
    overflow-wrap: anywhere;
  }

  .studio-tabs {
    align-items: stretch;
    flex-direction: column;
  }

  .studio-search {
    width: 100%;
  }

  .avatar-studio .header-metrics,
  .avatar-studio .task-summary-grid {
    grid-template-columns: 1fr;
  }

  .avatar-studio .upload-dropzone,
  .avatar-studio .audio-panel {
    min-height: 270px;
  }
}

/* Flow rebuild: library -> avatar material -> creator editor */
.avatar-flow .flow-shell {
  padding: 30px 34px 40px;
}

.avatar-flow .flow-stage {
  display: none;
  min-width: 0;
}

.avatar-flow .flow-stage.active {
  display: block;
}

.avatar-flow button.nav-item {
  width: 100%;
  border: 0;
  background: transparent;
  text-align: left;
}

.avatar-flow .flow-heading,
.avatar-detail-head,
.creator-topbar,
.preview-head,
.creator-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.avatar-flow .flow-heading {
  margin-bottom: 18px;
}

.avatar-flow .flow-heading h1,
.avatar-detail-head h1,
.creator-title h1 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 30px;
  line-height: 1.15;
}

.flow-tabs {
  justify-content: flex-start;
  margin-bottom: 16px;
}

.avatar-library-grid {
  display: grid;
  grid-template-columns: 300px minmax(300px, 360px);
  gap: 18px;
  align-items: stretch;
  margin-bottom: 34px;
}

.quick-avatar-card,
.avatar-profile-card,
.asset-add-card,
.asset-preview-card,
.creator-editor-card,
.creator-preview-card,
.latest-work-card {
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 10px 26px rgba(42, 25, 68, 0.04);
}

.quick-avatar-card {
  min-height: 260px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 14px;
  border-style: dashed;
  border-color: #c7a9f4;
  color: var(--accent);
  font-size: 18px;
  font-weight: 850;
}

.quick-avatar-card:hover,
.asset-add-card:hover {
  border-color: var(--accent);
  background: #fbf8ff;
}

.avatar-profile-card {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto auto;
  gap: 12px;
  padding: 14px;
}

.avatar-thumb,
.asset-image-frame,
.editor-avatar-frame,
.preview-canvas,
.latest-thumb {
  overflow: hidden;
  border-radius: 8px;
  background: #17131f;
}

.avatar-thumb {
  aspect-ratio: 4 / 5;
}

.avatar-thumb img,
.asset-image-frame img,
.editor-avatar-frame img,
.preview-canvas img,
.latest-thumb img,
.detail-avatar-mini img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
}

.avatar-profile-info {
  display: grid;
  gap: 3px;
}

.avatar-profile-info strong,
.asset-preview-card strong,
.public-avatar-card strong {
  color: var(--text);
  font-size: 15px;
}

.avatar-profile-info span,
.public-avatar-card span,
.asset-preview-card span,
.creator-card-head p,
.avatar-detail-head p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.avatar-profile-info .avatar-profile-voice {
  overflow: hidden;
  color: var(--text-soft);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.avatar-profile-info .avatar-profile-description {
  overflow: hidden;
  display: -webkit-box;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.avatar-card-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.avatar-card-actions .btn {
  flex: 1 1 auto;
}

.my-digital-human-card.selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(100, 25, 216, 0.12);
}

.public-avatar-section h2,
.asset-section h2 {
  margin: 0 0 16px;
  color: var(--text);
  font-size: 22px;
  line-height: 1.2;
}

.public-avatar-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(180px, 1fr));
  gap: 20px;
}

.public-avatar-card {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
  transition: border-color 140ms ease, box-shadow 140ms ease, transform 80ms ease;
}

.upload-avatar-card {
  align-content: center;
  min-height: 320px;
  color: inherit;
  font: inherit;
  text-align: left;
  border-style: dashed;
  border-color: #c9b7e8;
  background: #fcfbff;
}

.upload-avatar-card:hover,
.upload-avatar-card:focus-visible {
  background: #f9f6ff;
}

.upload-avatar-card .upload-avatar-visual {
  width: 56px;
  height: 56px;
  display: grid;
  place-items: center;
  border: 1px solid #d9c9f1;
  border-radius: 50%;
  color: var(--accent);
  background: #fff;
  font-size: 25px;
  font-weight: 800;
}

.upload-avatar-card .upload-avatar-model {
  width: fit-content;
  padding: 4px 8px;
  border-radius: 999px;
  color: var(--accent);
  background: var(--accent-soft);
  font-size: 12px;
  font-weight: 750;
}

.upload-avatar-card .upload-avatar-action {
  width: fit-content;
  margin-top: 4px;
  color: #fff;
  pointer-events: none;
}

.public-avatar-card:hover,
.public-avatar-card:focus-visible {
  border-color: #c7a9f4;
  box-shadow: 0 10px 28px rgba(42, 25, 68, 0.08);
}

.public-avatar-card:active {
  transform: translateY(1px);
}

.public-avatar-card.selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(100, 25, 216, 0.12);
}

.public-avatar-empty {
  grid-column: 1 / -1;
}

.public-avatar-card.loading {
  cursor: wait;
  opacity: 0.76;
}

.public-avatar-image {
  overflow: hidden;
  aspect-ratio: 4 / 5;
  border-radius: 8px;
  background: #edeaf2;
}

.public-avatar-image img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  object-position: center top;
}

.public-avatar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.public-avatar-head strong {
  min-width: 0;
}

.public-avatar-badge {
  flex: 0 0 auto;
  padding: 2px 6px;
  border-radius: 6px;
  background: #f0e8ff;
  color: #6c35b7;
  font-size: 12px;
  line-height: 1.4;
}

.public-avatar-meta {
  min-height: 18px;
}

.public-avatar-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-height: 22px;
}

.public-avatar-tags span {
  padding: 2px 6px;
  border: 1px solid #e5dced;
  border-radius: 6px;
  background: #faf9fc;
  color: #6d6178;
  font-size: 12px;
  line-height: 1.4;
}

.public-avatar-actions {
  display: grid;
  gap: 8px;
}

.public-avatar-select {
  width: 100%;
  margin-top: 2px;
}

.public-avatar-card.selected .public-avatar-select {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.public-avatar-preview-link {
  justify-self: center;
  color: var(--accent);
  font-size: 13px;
  text-decoration: none;
}

.public-avatar-preview-link:hover,
.public-avatar-preview-link:focus-visible {
  text-decoration: underline;
}

.workspace-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 20px;
  margin-top: 28px;
}

.workspace-panel {
  min-width: 0;
  display: grid;
  align-content: start;
  gap: 14px;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
}

.route-stage {
  max-width: 1180px;
  margin: 0 auto;
}

.route-heading {
  margin-bottom: 20px;
}

.route-panel {
  min-height: 360px;
}

.quota-panel {
  grid-column: 1 / -1;
}

.workspace-panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.history-panel-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.history-filter-select {
  min-height: 34px;
  min-width: 92px;
  padding: 0 30px 0 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 13px;
}

.history-filter-select:focus-visible {
  outline: 2px solid rgba(49, 95, 220, 0.18);
  outline-offset: 2px;
}

.workspace-panel h2 {
  margin: 0;
  color: var(--text);
  font-size: 18px;
  line-height: 1.25;
}

.workspace-panel p,
.workspace-empty,
.material-card-body span,
.history-item p,
.history-item span {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.workspace-empty {
  min-height: 120px;
  display: grid;
  place-items: center;
  border: 1px dashed var(--border);
  border-radius: 8px;
  background: var(--surface-muted);
  text-align: center;
}

.material-library-list,
.history-list,
.quota-ledger-list {
  display: grid;
  gap: 10px;
}

.quota-summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.quota-summary-grid > div {
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fcfdff;
}

.quota-summary-grid span,
.quota-ledger-item span {
  color: var(--muted);
  font-size: 12px;
}

.quota-summary-grid strong {
  display: block;
  margin-top: 4px;
  color: var(--text);
  font-size: 18px;
}

.quota-meter {
  height: 8px;
  overflow: hidden;
  border-radius: 8px;
  background: #eef2f7;
}

.quota-meter span {
  display: block;
  width: 0;
  height: 100%;
  background: var(--accent);
  transition: width 180ms ease;
}

.quota-breakdown {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.quota-breakdown-item {
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
}

.quota-breakdown-item span,
.quota-breakdown-item small {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.quota-breakdown-item strong {
  display: block;
  margin-top: 4px;
  color: var(--text);
  font-size: 15px;
  line-height: 1.25;
}

.quota-breakdown-item.charged {
  border-color: #bde7cf;
  background: var(--success-soft);
}

.quota-breakdown-item.reserved {
  border-color: #d7e0ff;
  background: var(--accent-soft);
}

.quota-breakdown-item.released {
  background: #f8fafc;
}

.quota-policy-summary {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #f8fafc;
}

.quota-policy-summary span {
  min-height: 22px;
  display: inline-flex;
  align-items: center;
  padding: 0 8px;
  border: 1px solid #dbe3ef;
  border-radius: 6px;
  background: #fff;
  color: var(--text-soft);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.2;
}

.quota-ledger-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fcfdff;
}

.quota-ledger-item strong {
  color: var(--text);
}

.quota-ledger-title {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.quota-source-chip {
  min-height: 20px;
  display: inline-flex;
  align-items: center;
  padding: 0 7px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #f8fafc;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
}

.quota-source-chip.long-video {
  color: #0f766e;
  background: #ecfdf5;
  border-color: #b7e4d7;
}

.quota-source-chip.batch {
  color: #8a4b10;
  background: #fff7ed;
  border-color: #fed7aa;
}

.quota-ledger-item > div {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.quota-ledger-meta {
  justify-items: end;
  text-align: right;
}

.quota-impact-line {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 6px;
}

.quota-impact-chip {
  min-height: 22px;
  display: inline-flex;
  align-items: center;
  padding: 0 7px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface-muted);
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.quota-impact-chip.reserved {
  color: var(--accent);
  background: var(--accent-soft);
  border-color: #d7e0ff;
}

.quota-impact-chip.charged {
  color: var(--success);
  background: var(--success-soft);
  border-color: #bde7cf;
}

.quota-impact-chip.partial {
  color: #8a4b10;
  background: #fff7ed;
  border-color: #fed7aa;
}

.quota-impact-chip.released {
  color: var(--muted);
  background: #f8fafc;
  border-color: var(--border);
}

.quota-impact-breakdown {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 6px;
}

.quota-amount-part {
  display: inline-flex;
  align-items: center;
  min-height: 20px;
  padding: 0 7px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #fff;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.quota-amount-part.charged {
  color: var(--success);
  border-color: #bde7cf;
}

.quota-amount-part.reserved {
  color: var(--accent);
  border-color: #d7e0ff;
}

.quota-amount-part.released {
  color: var(--muted);
}

.material-card,
.history-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fcfdff;
}

.material-card {
  grid-template-columns: 58px minmax(0, 1fr);
}

.material-thumb {
  width: 58px;
  height: 58px;
  overflow: hidden;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: #eef2f7;
}

.material-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.material-thumb.audio,
.material-thumb.video {
  background: var(--accent-soft);
  color: var(--accent);
}

.material-kind {
  font-size: 12px;
  font-weight: 800;
}

.material-card-body {
  min-width: 0;
  display: grid;
  align-content: start;
  gap: 4px;
}

.material-card-body strong,
.history-title-row strong {
  min-width: 0;
  overflow: hidden;
  color: var(--text);
  font-size: 14px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.material-lifecycle-row {
  min-width: 0;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.material-lifecycle-chip {
  min-height: 22px;
  display: inline-flex;
  align-items: center;
  padding: 0 7px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface-muted);
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.material-lifecycle-chip.protected {
  color: var(--accent);
  background: var(--accent-soft);
  border-color: #d7e0ff;
}

.material-lifecycle-chip.warning {
  color: var(--warning);
  background: var(--warning-soft);
  border-color: #efd19a;
}

.material-lifecycle-chip.danger {
  color: var(--danger);
  background: var(--danger-soft);
  border-color: #f2c6c2;
}

.material-lifecycle-text {
  min-width: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.material-delete-disabled {
  background: var(--surface-muted);
}

.video-policy-row {
  min-width: 0;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.video-policy-chip {
  min-height: 22px;
  display: inline-flex;
  align-items: center;
  padding: 0 7px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface-muted);
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.2;
  white-space: nowrap;
}

.video-policy-chip.protected {
  color: var(--accent);
  background: var(--accent-soft);
  border-color: #d7e0ff;
}

.video-policy-chip.warning {
  color: var(--warning);
  background: var(--warning-soft);
  border-color: #efd19a;
}

.video-policy-chip.danger {
  color: var(--danger);
  background: var(--danger-soft);
  border-color: #f2c6c2;
}

.video-policy-chip.muted {
  color: var(--muted);
  background: #f8fafc;
  border-color: var(--border);
}

.material-actions,
.history-actions {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.history-item {
  grid-template-columns: minmax(0, 1fr);
}

.history-title-row {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.history-status-stack {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 6px;
}

.history-item p {
  margin-top: 6px;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.history-segment-list {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.history-segment-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-muted);
}

.history-segment-main {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.history-segment-title {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px;
}

.history-segment-title strong {
  color: var(--text);
  font-size: 13px;
}

.history-segment-title > span:not(.status-chip),
.history-segment-main > span {
  color: var(--muted);
  font-size: 12px;
}

.history-segment-main p {
  margin: 0;
  color: var(--text-soft);
  font-size: 12px;
  line-height: 1.5;
  -webkit-line-clamp: 1;
}

.drawer-backdrop {
  position: fixed;
  inset: 0;
  z-index: 80;
  background: rgba(12, 10, 18, 0.52);
}

.create-drawer {
  position: fixed;
  inset: 0 0 0 auto;
  z-index: 90;
  width: min(720px, 48vw);
  min-width: 560px;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  background: #fff;
  box-shadow: -22px 0 54px rgba(25, 16, 40, 0.18);
}

body.drawer-open {
  overflow: hidden;
}

.drawer-head {
  min-height: 68px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 28px;
  border-bottom: 1px solid var(--border);
}

.drawer-head h2,
.drawer-section h3,
.creator-card-head h2,
.preview-head h2,
.latest-work-card h3 {
  margin: 0;
  color: var(--text);
  font-size: 20px;
  line-height: 1.25;
}

.icon-button {
  width: 36px;
  height: 36px;
  display: inline-grid;
  place-items: center;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text-soft);
  font-size: 24px;
}

.icon-button:hover {
  background: var(--surface-strong);
  color: var(--text);
}

.drawer-body {
  min-width: 0;
  display: grid;
  align-content: start;
  gap: 26px;
  overflow: auto;
  padding: 28px;
}

.drawer-section {
  display: grid;
  gap: 14px;
}

.drawer-section h3 {
  display: flex;
  align-items: center;
  gap: 8px;
}

.info-dot {
  width: 20px;
  height: 20px;
  display: inline-grid;
  place-items: center;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: 12px;
  font-weight: 900;
}

.requirement-box {
  display: grid;
  grid-template-columns: 1fr repeat(3, auto);
  gap: 18px;
  align-items: center;
  padding: 16px;
  border-radius: 8px;
  background: #f6f4f8;
  color: var(--text-soft);
  font-weight: 700;
}

.requirement-box strong {
  color: var(--text);
}

.drawer-dropzone {
  position: relative;
  min-height: 240px;
  cursor: pointer;
}

.seedance-import-status {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 9px 11px;
  border: 1px solid #cdb7f4;
  border-radius: 8px;
  background: #fbf8ff;
  color: #5b21b6;
  font-size: 13px;
  font-weight: 700;
}

.seedance-import-status.success {
  border-color: #a7e3c2;
  background: #f1fff6;
  color: #166534;
}

.seedance-import-status.failed {
  border-color: #f2b8b5;
  background: #fff6f5;
  color: #991b1b;
}

.seedance-import-spinner {
  width: 15px;
  height: 15px;
  flex: 0 0 15px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: seedance-import-spin 700ms linear infinite;
}

.seedance-import-status.success .seedance-import-spinner,
.seedance-import-status.failed .seedance-import-spinner {
  display: none;
}

@keyframes seedance-import-spin {
  to { transform: rotate(360deg); }
}

.upload-corner-button {
  position: absolute;
  top: -10px;
  right: 16px;
  z-index: 1;
  color: #1585e8;
  border-color: #8bc8ff;
  background: #eef8ff;
}

.drawer-model-row {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
}

.single-model-card {
  width: fit-content;
  min-width: 220px;
  min-height: 54px;
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border: 1px solid #d8c5ff;
  border-radius: 8px;
  background: #fbf8ff;
  color: var(--text);
}

.single-model-card strong,
.single-model-card em {
  display: block;
}

.single-model-card strong {
  font-size: 15px;
  line-height: 1.25;
}

.single-model-card em {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
  font-weight: 700;
}

.model-check {
  width: 22px;
  height: 22px;
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: 13px;
  font-weight: 900;
}

.radio-card {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
  font-weight: 850;
}

.radio-card input {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
}

.radio-card em {
  padding: 2px 8px;
  border-radius: 8px;
  background: #ff4d4f;
  color: #fff;
  font-size: 12px;
  font-style: normal;
}

.drawer-footer {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto auto;
  gap: 12px;
  align-items: center;
  padding: 18px 28px;
  border-top: 1px solid var(--border);
  background: #fff;
}

.drawer-footer > .agree-row,
.drawer-footer > #avatarAgreementHint,
.drawer-footer > .seedance-import-status {
  grid-column: 1 / -1;
}

.agree-row {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  color: var(--text-soft);
  font-weight: 650;
}

.agree-row input {
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
}

.agree-row label {
  min-width: 0;
}

.agree-link {
  min-height: 24px;
  font-weight: 800;
}

.point-cost {
  color: var(--accent);
  font-weight: 900;
  white-space: nowrap;
}

.avatar-detail-head {
  justify-content: flex-start;
  margin-bottom: 34px;
}

.detail-avatar-mini {
  width: 42px;
  height: 42px;
  position: relative;
  overflow: hidden;
  border-radius: 50%;
  background: var(--accent-soft);
}

.mini-avatar-fallback {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--accent);
  font-weight: 900;
}

.asset-workspace {
  display: grid;
  gap: 36px;
}

.asset-section {
  display: grid;
  gap: 12px;
}

.asset-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(280px, 400px));
  gap: 36px;
  align-items: start;
}

.asset-add-card {
  min-height: 226px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 14px;
  border-style: dashed;
  border-color: #c7a9f4;
  color: var(--accent);
  font-size: 18px;
  font-weight: 850;
}

.asset-preview-card {
  display: grid;
  gap: 10px;
  padding: 0;
  border: 0;
  box-shadow: none;
  background: transparent;
}

.asset-image-frame {
  min-height: 226px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: linear-gradient(90deg, #17171b, #3b3c44 45%, #18191e);
  color: #fff;
  font-weight: 850;
}

.asset-image-frame {
  background: #17171b;
}

.creator-topbar {
  margin-bottom: 22px;
}

.creator-title {
  display: flex;
  align-items: center;
  gap: 12px;
}

.creator-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  color: var(--text-soft);
  font-weight: 700;
}

.creator-meta strong {
  color: var(--accent);
}

.creator-stepper {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
  margin: 16px 0 18px;
  padding: 6px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.92);
}

.creator-step-item {
  min-height: 54px;
  display: flex;
  align-items: center;
  gap: 10px;
  justify-content: center;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  padding: 0 12px;
  font: inherit;
  cursor: pointer;
  transition: background 140ms ease, border-color 140ms ease, color 140ms ease;
}

.creator-step-item span {
  width: 26px;
  height: 26px;
  display: inline-grid;
  place-items: center;
  border-radius: 50%;
  background: #f3f0f8;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.creator-step-item strong {
  min-width: 0;
  font-size: 14px;
  line-height: 1.2;
}

.creator-step-item:hover {
  background: #fbfaff;
  color: var(--text-soft);
}

.creator-step-item.active {
  border-color: rgba(100, 25, 216, 0.28);
  background: var(--accent-soft);
  color: var(--accent);
}

.creator-step-item.active span,
.creator-step-item.completed span {
  background: var(--accent);
  color: #fff;
}

.creator-step-item.completed {
  color: var(--text-soft);
}

.creator-step-actions {
  max-width: 960px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin: 16px auto 0;
}

.creator-step-actions .btn {
  min-width: 156px;
}

.creator-layout {
  display: grid;
  grid-template-columns: minmax(620px, 1fr) minmax(420px, 0.82fr) 106px;
  gap: 24px;
  align-items: stretch;
}

body[data-creator-step="avatar"] .creator-layout,
body[data-creator-step="script"] .creator-layout,
body[data-creator-step="settings"] .creator-layout {
  grid-template-columns: minmax(0, 960px);
  max-width: 960px;
  margin-inline: auto;
}

body[data-creator-step="confirm"] .creator-layout {
  grid-template-columns: minmax(300px, 380px) minmax(0, 1fr);
  max-width: 1180px;
  margin-inline: auto;
}

body[data-creator-step="result"] .creator-layout {
  grid-template-columns: minmax(0, 1fr);
  max-width: 1100px;
  margin-inline: auto;
}

.creator-editor-card {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto auto auto;
  gap: 18px;
  padding: 26px;
}

.creator-editor-grid {
  display: grid;
  grid-template-columns: 330px minmax(0, 1fr);
  gap: 28px;
  min-height: 390px;
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
}

body[data-creator-step="avatar"] .creator-editor-grid {
  grid-template-columns: minmax(280px, 520px);
  justify-content: center;
  min-height: 0;
}

body[data-creator-step="avatar"] .avatar-source-panel {
  width: 100%;
  justify-self: center;
}

body[data-creator-step="settings"] .creator-editor-grid,
body[data-creator-step="confirm"] .creator-editor-grid {
  display: none;
}

body[data-creator-step="avatar"] .script-editor-panel,
body[data-creator-step="avatar"] .voice-controls,
body[data-creator-step="avatar"] .advanced-panel,
body[data-creator-step="avatar"] .batch-panel,
body[data-creator-step="avatar"] .creator-submit-bar,
body[data-creator-step="avatar"] #submitHint,
body[data-creator-step="script"] .advanced-panel,
body[data-creator-step="script"] .batch-panel,
body[data-creator-step="script"] .creator-submit-bar,
body[data-creator-step="script"] #submitHint,
body[data-creator-step="settings"] .creator-submit-bar,
body[data-creator-step="settings"] .batch-panel,
body[data-creator-step="settings"] #submitHint,
body[data-creator-step="confirm"] .advanced-panel,
body[data-creator-step="result"] .creator-editor-card {
  display: none;
}

body[data-creator-step="confirm"] .creator-editor-card {
  grid-template-rows: auto auto auto;
  align-self: start;
  min-height: 0;
}

body[data-creator-step="avatar"] .creator-card-head .char-count,
body[data-creator-step="settings"] .creator-card-head .char-count,
body[data-creator-step="confirm"] .creator-card-head .char-count,
body[data-creator-step="result"] .creator-card-head .char-count {
  display: none;
}

.avatar-source-panel {
  display: grid;
  align-content: start;
  gap: 18px;
}

.editor-avatar-frame {
  position: relative;
  aspect-ratio: 4 / 5;
  display: grid;
  place-items: center;
  background: #edeaf2;
}

body[data-creator-step="avatar"] .editor-avatar-frame {
  width: min(100%, 460px);
  justify-self: center;
}

.editor-avatar-frame .btn {
  position: absolute;
  left: 50%;
  bottom: 14px;
  transform: translateX(-50%);
  min-width: 76px;
}

.empty-avatar-hint,
.preview-canvas span,
.latest-thumb span {
  color: rgba(255, 255, 255, 0.82);
  font-weight: 850;
}

.voice-card {
  position: relative;
  width: 100%;
  min-height: 62px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  border: 0;
  border-radius: 999px;
  background: #f3f2f5;
  color: var(--text);
  padding: 0 18px;
  text-align: left;
  cursor: pointer;
  transition: background-color 140ms ease, box-shadow 140ms ease;
}

.voice-card:hover {
  background: #eceaf0;
}

.voice-card:focus-within {
  box-shadow: 0 0 0 3px rgba(111, 45, 226, 0.2);
}

.voice-card-copy {
  min-width: 0;
}

.voice-card-copy strong,
.voice-card-copy em {
  overflow: hidden;
  display: block;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.voice-card-chevron {
  color: var(--muted);
  font-size: 22px;
  line-height: 1;
}

.voice-card-native-select {
  position: absolute;
  z-index: 2;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  opacity: 0;
  cursor: pointer;
}

.voice-card em {
  display: block;
  color: var(--muted);
  font-style: normal;
  font-size: 13px;
}

.subtitle-track {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
}

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

.subtitle-track-head strong {
  font-size: 14px;
}

.subtitle-track-head span {
  color: var(--muted);
  font-size: 12px;
}

.subtitle-track-list {
  display: grid;
  gap: 6px;
}

.subtitle-track-row {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  gap: 8px;
  align-items: start;
}

.subtitle-track-row span {
  color: var(--muted);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.subtitle-track-row p {
  margin: 0;
  color: var(--text-soft);
  font-size: 13px;
  line-height: 1.45;
}

.play-dot {
  width: 36px;
  height: 36px;
  display: inline-grid;
  place-items: center;
  border-radius: 50%;
  background: #07070a;
  color: #fff;
  font-size: 14px;
}

.script-editor-panel {
  display: grid;
  align-content: start;
  gap: 12px;
}

.script-toolbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.tool-button {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text-soft);
  font-weight: 800;
  padding: 0 10px;
}

.tool-button.active,
.tool-button.accent {
  color: var(--accent);
}

.tool-button:hover {
  background: var(--accent-soft);
}

.tool-button:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(49, 95, 220, 0.12);
}

.tool-button:active {
  transform: translateY(1px);
}

.tool-button.muted {
  color: var(--muted-2);
}

.flow-script-input {
  min-height: 230px;
  font-size: 16px;
}

.creator-material-panel {
  display: grid;
  gap: 10px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

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

.creator-material-head > div {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.creator-material-head strong,
.creator-material-picker-head strong {
  color: var(--text);
  font-size: 14px;
}

.creator-material-head span,
.creator-material-empty {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.creator-selected-material {
  min-height: 58px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.creator-selected-material-card {
  width: 100%;
  min-width: 0;
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr) 34px;
  gap: 10px;
  align-items: center;
  padding: 6px;
  border: 1px solid #ddd5ea;
  border-radius: 8px;
  background: #fbfaff;
}

.creator-selected-material-card.active {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent) 22%, transparent);
}

.creator-material-card-main {
  min-width: 0;
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.creator-material-placeholder {
  color: var(--muted);
  font-size: 24px;
  line-height: 1;
}

.creator-selected-material-thumb,
.creator-material-option-thumb {
  overflow: hidden;
  display: grid;
  place-items: center;
  background: #ebe8f0;
  color: var(--muted);
}

.creator-selected-material-thumb {
  width: 52px;
  height: 52px;
  border-radius: 6px;
}

.creator-selected-material-thumb img,
.creator-material-option-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.creator-selected-material-copy {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.creator-selected-material-copy strong,
.creator-selected-material-copy em {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.creator-selected-material-copy strong {
  font-size: 13px;
}

.creator-selected-material-copy strong small {
  margin-left: 6px;
  color: var(--accent);
  font-size: 11px;
  font-weight: 600;
}

.creator-selected-material-copy em {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
}

.creator-material-remove {
  width: 32px;
  height: 32px;
  color: var(--muted);
}

.creator-material-picker {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #f8f7fa;
}

.creator-material-picker-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.creator-material-options {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.creator-material-option {
  min-width: 0;
  display: grid;
  gap: 5px;
  padding: 5px;
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  color: var(--text-soft);
  cursor: pointer;
}

.creator-material-option:hover,
.creator-material-option:focus-visible {
  border-color: #d6cbe6;
  background: #fff;
  outline: none;
}

.creator-material-option.selected {
  border-color: var(--accent);
  background: #f1eaff;
  color: var(--accent);
}

.creator-material-option-thumb {
  width: 100%;
  aspect-ratio: 4 / 3;
  border-radius: 5px;
}

.creator-material-option > span:last-child {
  overflow: hidden;
  font-size: 11px;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.advanced-panel {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fcfbff;
}

.batch-panel {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
}

.advanced-panel summary {
  cursor: pointer;
  padding: 14px 16px;
  color: var(--text);
  font-weight: 850;
}

.batch-panel summary {
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  cursor: pointer;
  padding: 13px 16px;
  color: var(--text);
  font-weight: 850;
}

.batch-panel summary strong {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.batch-panel .form-group {
  padding: 0 16px 12px;
}

.batch-script-input {
  min-height: 132px;
}

.batch-avatar-picker {
  display: grid;
  gap: 10px;
  padding: 0 16px 12px;
}

.batch-avatar-head {
  min-height: 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--text);
  font-size: 13px;
  font-weight: 800;
}

.batch-avatar-head strong {
  color: var(--muted);
  font-size: 12px;
}

.batch-avatar-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.batch-avatar-option {
  min-width: 0;
  min-height: 54px;
  display: grid;
  grid-template-columns: 18px 36px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  padding: 8px;
  border: 1px solid #e4dced;
  border-radius: 8px;
  background: #fcfbff;
  cursor: pointer;
}

.batch-avatar-option:hover,
.batch-avatar-option:has(input:focus-visible) {
  border-color: #c7a9f4;
}

.batch-avatar-option:has(input:checked) {
  border-color: var(--accent);
  background: #f7f2ff;
  box-shadow: 0 0 0 2px rgba(100, 25, 216, 0.08);
}

.batch-avatar-option input {
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: var(--accent);
}

.batch-avatar-thumb {
  width: 36px;
  height: 36px;
  overflow: hidden;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: #edeaf2;
  color: var(--accent);
  font-size: 13px;
  font-weight: 850;
}

.batch-avatar-thumb img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.batch-avatar-copy {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.batch-avatar-copy strong,
.batch-avatar-copy em {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.batch-avatar-copy strong {
  color: var(--text);
  font-size: 13px;
}

.batch-avatar-copy em {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
}

.batch-panel .field-helper {
  margin: -2px 16px 14px;
}

.batch-panel .field-helper[data-state="error"] {
  color: var(--danger);
}

.terms-confirm-row {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  color: var(--text-soft);
  font-size: 13px;
}

.terms-check {
  min-width: 0;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.terms-check input {
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
}

.terms-status {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--muted);
  background: #f8fafc;
  font-size: 12px;
}

.terms-status[data-state="accepted"] {
  color: var(--success);
  background: var(--success-soft);
  border-color: #bde7cf;
}

.terms-status[data-state="required"] {
  color: var(--warning);
  background: var(--warning-soft);
  border-color: #efd19a;
}

body[data-creator-step="settings"] .advanced-panel {
  background: #fff;
}

body.avatar-flow[data-creator-step="settings"] .advanced-panel .params-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.avatar-flow .advanced-panel .params-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  padding: 0 16px 16px;
}

.creator-submit-bar {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr) 150px 190px;
  gap: 14px;
  align-items: center;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.creator-preview-column {
  display: contents;
}

body[data-creator-step="avatar"] .creator-preview-column,
body[data-creator-step="script"] .creator-preview-column,
body[data-creator-step="settings"] .creator-preview-column,
body[data-creator-step="confirm"] .latest-work-card,
body[data-creator-step="result"] .latest-work-card {
  display: none;
}

body[data-creator-step="confirm"] .creator-preview-column,
body[data-creator-step="result"] .creator-preview-column {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
}

.creator-preview-card {
  padding: 24px;
}

body[data-creator-step="confirm"] .creator-preview-card .preview-card {
  display: none;
}

body[data-creator-step="result"] .creator-preview-card > .preview-head,
body[data-creator-step="result"] .creator-preview-card > .preview-canvas,
body[data-creator-step="result"] .creator-preview-card > .review-list {
  display: none;
}

body[data-creator-step="result"] .creator-preview-card .preview-card {
  margin-top: 0;
}

body:not([data-creator-step="result"]) .long-video-card {
  display: none !important;
}

body[data-creator-step="result"] .long-video-card {
  max-width: 1100px;
  margin: 20px auto 0;
}

body[data-creator-step="confirm"] .creator-submit-bar {
  grid-template-columns: 1fr;
  border-top: 0;
  padding-top: 0;
}

body[data-creator-step="confirm"] .creator-submit-bar [data-creator-step-target="settings"] {
  display: none;
}

body[data-creator-step="confirm"] .creator-step-actions {
  max-width: 1180px;
  justify-content: flex-start;
}

.preview-head {
  align-items: flex-start;
  margin-bottom: 14px;
}

.preview-canvas {
  position: relative;
  aspect-ratio: 16 / 9;
  display: grid;
  place-items: center;
  margin-bottom: 14px;
}

.preview-canvas::after {
  content: "*AI";
  position: absolute;
  top: 14px;
  right: 16px;
  color: #fff;
  font-size: 20px;
  font-weight: 900;
}

.creator-preview-card .preview-card {
  margin-top: 14px;
  padding: 0;
  border: 0;
  box-shadow: none;
}

.latest-work-card {
  align-self: stretch;
  padding: 22px 14px;
}

.latest-thumb {
  position: relative;
  width: 76px;
  height: 76px;
  display: grid;
  place-items: center;
  border: 2px solid #a06af0;
  padding: 0;
}

.long-video-card {
  margin-top: 24px;
}

@media (max-width: 1520px) {
  .creator-layout {
    grid-template-columns: 1fr;
  }

  .creator-preview-column {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 120px;
    gap: 16px;
  }
}

@media (max-width: 1180px) {
  .workspace-grid {
    grid-template-columns: 1fr;
  }

  .quota-summary-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .public-avatar-grid {
    grid-template-columns: repeat(2, minmax(180px, 1fr));
  }

  .asset-row,
  .creator-editor-grid {
    grid-template-columns: 1fr;
  }

  body[data-creator-step="confirm"] .creator-layout {
    grid-template-columns: 1fr;
    max-width: 960px;
  }

  body[data-creator-step="confirm"] .creator-preview-column {
    grid-template-columns: 1fr;
  }

  .create-drawer {
    width: min(720px, 82vw);
  }
}

@media (max-width: 720px) {
  .creator-material-head,
  .creator-material-picker-head {
    align-items: stretch;
    flex-direction: column;
  }

  .creator-material-head .btn {
    width: 100%;
  }

  .creator-material-picker-actions {
    display: grid;
    grid-template-columns: 1fr auto;
  }

  .creator-material-options {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .creator-selected-material {
    grid-template-columns: 1fr;
  }

  .public-avatar-variant-row {
    grid-template-columns: 64px minmax(0, 1fr);
  }

  .public-avatar-variant-preview {
    width: 64px;
  }

  .public-avatar-variant-inline {
    grid-template-columns: 1fr;
  }

  .public-avatar-variant-actions {
    grid-column: 1 / -1;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .public-avatar-variant-actions .btn,
  .public-avatar-variant-actions label {
    width: 100%;
  }

  .avatar-flow .flow-shell {
    padding: 18px 12px 24px;
  }

  .avatar-flow .flow-heading,
  .avatar-detail-head,
  .creator-topbar,
  .preview-head,
  .creator-card-head {
    align-items: stretch;
    flex-direction: column;
  }

  .avatar-library-grid,
  .public-avatar-grid,
  .batch-avatar-list,
  .public-avatar-detail-layout,
  .workspace-grid,
  .creator-preview-column,
  .avatar-flow .advanced-panel .params-grid,
  .creator-submit-bar {
    grid-template-columns: 1fr;
  }

  .workspace-panel-head,
  .quota-ledger-item,
  .history-segment-item,
  .history-title-row {
    align-items: stretch;
    grid-template-columns: 1fr;
    flex-direction: column;
  }

  .quota-ledger-meta {
    justify-items: start;
    text-align: left;
  }

  .quota-impact-line {
    justify-content: flex-start;
  }

  .quota-breakdown {
    grid-template-columns: 1fr;
  }

  .quota-impact-breakdown {
    justify-content: flex-start;
  }

  .history-panel-actions {
    width: 100%;
  }

  .history-filter-select,
  .history-panel-actions .btn {
    flex: 1 1 0;
    min-width: 0;
  }

  .creator-stepper {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .creator-step-item {
    justify-content: flex-start;
    min-height: 46px;
  }

  .creator-step-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .creator-step-actions .btn {
    width: 100%;
  }

  .create-drawer {
    width: 100vw;
    min-width: 0;
    height: 100dvh;
    display: block;
    overflow-y: auto;
  }

  .drawer-head {
    position: sticky;
    top: 0;
    z-index: 1;
    min-height: 58px;
    padding: 0 16px;
    background: #fff;
  }

  .drawer-body {
    gap: 18px;
    padding: 18px 14px 22px;
    overflow: visible;
  }

  .drawer-section {
    gap: 12px;
  }

  .drawer-dropzone {
    min-height: 220px;
    align-content: center;
    justify-items: stretch;
    gap: 14px;
    padding: 16px 12px;
  }

  .drawer-dropzone .upload-corner-button {
    position: static;
    order: -1;
    width: 100%;
    max-width: 100%;
    min-height: 36px;
    white-space: normal;
    line-height: 1.25;
  }

  .drawer-dropzone .dropzone-copy {
    width: 100%;
    max-width: 100%;
    justify-items: center;
    padding: 0 4px;
  }

  .drawer-dropzone .dropzone-copy strong {
    max-width: 100%;
    font-size: 14px;
    line-height: 1.45;
  }

  .drawer-dropzone .dropzone-copy p {
    font-size: 12px;
    line-height: 1.45;
  }

  .drawer-dropzone .image-preview {
    min-width: 0;
  }

  .drawer-dropzone .image-meta {
    flex-direction: column;
    align-items: stretch;
  }

  .drawer-model-row {
    gap: 10px 12px;
  }

  .single-model-card {
    width: 100%;
    min-width: 0;
  }

  .radio-card {
    min-height: 36px;
  }

  .drawer-footer {
    grid-template-columns: 1fr;
    gap: 10px;
    padding: 14px 16px 16px;
  }

  .drawer-footer .btn {
    width: 100%;
  }

  .agree-row {
    align-items: flex-start;
  }

  .agree-row label,
  .agree-row button {
    min-width: 0;
    overflow-wrap: anywhere;
    line-height: 1.45;
  }

  .terms-confirm-row {
    align-items: flex-start;
  }

  .terms-check,
  .terms-confirm-row button {
    min-width: 0;
    overflow-wrap: anywhere;
    line-height: 1.45;
  }

  .point-cost {
    justify-self: start;
  }

  .requirement-box {
    grid-template-columns: 1fr;
    gap: 6px;
    padding: 13px 14px;
  }

  .creator-editor-card,
  .creator-preview-card {
    padding: 16px;
  }

  .flow-script-input {
    min-height: 190px;
  }
}
