:root {
  --canvas: #f5f4f0;
  --canvas-soft: #fbfaf6;
  --paper: rgba(255, 255, 250, 0.78);
  --paper-solid: #fffefa;
  --ink: #2a2a2a;
  --ink-soft: #4a4945;
  --muted: #858178;
  --sand: #d1cdc5;
  --sand-soft: #e7e3da;
  --line: rgba(42, 42, 42, 0.12);
  --line-strong: rgba(42, 42, 42, 0.32);
  --green: #6f866c;
  --green-soft: #eef2ea;
  --danger: #a35b4f;
  --warning: #9d7a3c;
  --shadow: 0 18px 48px rgba(42, 42, 42, 0.08);
  --shadow-soft: 0 8px 26px rgba(42, 42, 42, 0.06);
  --radius: 8px;
}

/* Final UI refresh overrides. Kept at the end so old page-specific rules cannot win the cascade. */
body {
  color: var(--ui-text);
  background:
    linear-gradient(90deg, rgba(31, 35, 32, 0.015) 1px, transparent 1px),
    linear-gradient(rgba(31, 35, 32, 0.012) 1px, transparent 1px),
    linear-gradient(135deg, #fbfaf7 0%, #f1eee7 100%);
  background-size: 20px 20px, 20px 20px, auto;
}

.app-shell {
  grid-template-columns: 224px minmax(0, 1fr);
}

.sidebar {
  padding: 22px 18px 16px;
  gap: 22px;
  background: rgba(250, 249, 245, 0.92);
}

.brand {
  grid-template-columns: 44px minmax(0, 1fr);
}

.brand-mark {
  width: 44px;
  height: 44px;
}

.brand span {
  display: none;
}

.brand strong {
  font-size: 18px;
}

.side-nav {
  gap: 10px;
}

.side-nav a {
  min-height: 46px;
  gap: 10px;
  padding: 0 14px;
  font-weight: 800;
}

.side-nav a::before {
  width: 24px;
  color: var(--ui-muted);
  font-size: 18px;
  text-align: center;
}

.side-nav a:nth-child(1)::before { content: "AI"; font-size: 12px; font-weight: 900; }
.side-nav a:nth-child(2)::before { content: "▭"; }
.side-nav a:nth-child(3)::before { content: "○"; }
.side-nav a:nth-child(4)::before { content: "♢"; }
.side-nav a:nth-child(5)::before { content: "◎"; }
.side-nav a:nth-child(6)::before { content: "↺"; }
.side-nav a:nth-child(7)::before { content: "◌"; }

.side-nav a.active,
.side-nav a:hover {
  color: var(--ui-green);
  border-color: rgba(47, 108, 67, 0.12);
  background: linear-gradient(180deg, rgba(237, 245, 237, 0.92), rgba(255, 255, 252, 0.72));
}

.main-shell {
  height: 100vh;
  overflow: hidden;
  padding: 0;
}

.topbar {
  height: 80px;
  align-items: center;
  margin: 0;
  padding: 0 28px;
  border-bottom: 1px solid var(--ui-border);
  background: rgba(255, 255, 252, 0.84);
  backdrop-filter: blur(18px);
}

.topbar h1 {
  margin: 0;
  color: var(--ui-text);
  font-size: 30px;
  letter-spacing: 0;
  line-height: 1.1;
}

.topbar #openStorageFolderBtn,
.topbar #openVideoStorageFolderBtn {
  display: none;
}

.top-actions {
  gap: 12px;
}

.user-avatar {
  width: 42px;
  height: 42px;
  border: 1px solid var(--ui-border);
  border-radius: 50%;
  background:
    radial-gradient(circle at 50% 34%, #f4d7c8 0 18%, transparent 19%),
    radial-gradient(circle at 50% 104%, #1f2722 0 38%, transparent 39%),
    linear-gradient(180deg, #ece4dc, #c8c1b8);
  box-shadow: var(--shadow-soft);
}

.status-pill {
  min-height: 40px;
  padding: 0 16px;
  border-radius: 999px;
  color: var(--ui-green);
  border-color: rgba(47, 108, 67, 0.16);
  background: rgba(255, 255, 252, 0.84);
  font-weight: 900;
}

.status-pill.ok {
  background: var(--ui-green-soft);
}

.status-pill.error {
  color: var(--ui-red);
  background: var(--ui-red-soft);
}

.glass-btn,
.secondary-btn,
.primary-btn,
.text-btn,
.chip-btn,
.history-actions button,
.remove-file-btn,
.inspiration-actions button {
  min-height: 40px;
  border-color: var(--ui-border-strong);
  border-radius: 8px;
  color: var(--ui-text);
  background: rgba(255, 255, 252, 0.82);
}

.primary-btn {
  border-color: rgba(47, 108, 67, 0.38);
  color: #fff;
  background: linear-gradient(180deg, #4f855b, #2f6c43);
  box-shadow: 0 10px 22px rgba(47, 108, 67, 0.18);
}

.danger-btn,
.history-toolbar .danger-btn {
  color: var(--ui-red);
  border-color: rgba(200, 63, 53, 0.22);
  background: var(--ui-red-soft);
}

.app-page.active-page,
.workspace-grid.active-page,
.video-page.active-page {
  height: calc(100vh - 80px);
}

.workspace-grid.active-page {
  display: grid;
  grid-template-columns: minmax(390px, 0.92fr) minmax(520px, 1.32fr) minmax(340px, 0.82fr);
  grid-template-rows: minmax(0, 1fr);
  gap: 12px;
  padding: 12px 14px 16px;
  overflow: hidden;
}

.image-page-head,
.video-page-head {
  display: none !important;
}

.panel,
.task-board,
.history-card,
.inspiration-card,
.dialog-card,
.image-preview-card,
.metric-card {
  border-color: var(--ui-border);
  background: var(--ui-surface);
  box-shadow: 0 10px 30px rgba(31, 35, 32, 0.045);
}

.panel {
  padding: 22px;
}

.workspace-grid > .panel,
.workspace-grid > .task-board,
.video-create-panel,
.video-preview-panel,
.video-task-panel {
  height: 100%;
  min-height: 0;
}

.create-panel,
.video-create-panel {
  overflow: auto !important;
}

.panel-head h2 {
  color: var(--ui-text);
  font-size: 22px;
}

.compact-form {
  display: flex;
  flex-direction: column;
  min-height: 100%;
  gap: 18px;
}

.compact-form > .field-wide:first-child {
  order: 1;
}

#referenceUploadSection {
  order: 2;
}

.parameter-grid {
  order: 3;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.parameter-grid .field:last-child {
  grid-column: 1 / -1;
}

.sticky-actions {
  order: 4;
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  margin-top: auto;
}

.sticky-actions .primary-btn,
.video-primary-actions .primary-btn {
  width: 100%;
  min-height: 52px;
  font-size: 18px;
}

#clearFormBtn {
  display: none;
}

.action-summary {
  margin: 0;
  color: var(--ui-muted);
  font-size: 14px;
  font-weight: 800;
  text-align: center;
}

.field-label-row span,
.field > span,
.video-upload-head strong {
  color: var(--ui-text);
  font-size: 14px;
}

.clear-prompt-btn,
.clear-reference-btn {
  color: var(--ui-green);
  font-size: 13px;
}

textarea,
input,
select {
  border-color: var(--ui-border);
  background: rgba(255, 255, 252, 0.78);
}

textarea {
  resize: none;
}

.create-panel textarea,
.video-prompt-field textarea {
  min-height: 126px;
}

.dropzone.has-reference-files {
  min-height: 160px;
  padding: 8px 6px 10px;
  border-color: transparent;
  background: transparent;
}

.dropzone.has-reference-files > strong,
.dropzone.has-reference-files > p {
  display: none;
}

.dropzone.has-reference-files .reference-material-stack {
  min-height: 142px;
  max-height: 154px;
  margin-top: 0;
  padding: 12px 8px;
}

.reference-material-stack {
  align-items: flex-end;
}

.reference-thumb-card {
  flex-basis: 112px;
  width: 112px;
  min-height: 136px;
  padding: 5px;
  border: 1px solid rgba(31, 35, 32, 0.18);
  border-radius: 12px;
  background: #fffefa;
  box-shadow: 0 12px 24px rgba(31, 35, 32, 0.16);
  transform: rotate(var(--card-tilt, -3deg)) translateY(var(--card-rise, 0));
}

.reference-thumb-card + .reference-thumb-card {
  margin-left: -32px;
}

.reference-thumb-card:hover,
.reference-thumb-card:focus-within {
  z-index: 10;
  transform: rotate(0deg) translateY(-7px);
}

.reference-card-media {
  height: 126px;
  aspect-ratio: auto;
  border-radius: 10px;
}

.reference-add-card {
  flex-basis: 98px;
  width: 98px;
  min-height: 136px;
  margin-left: 8px;
  background: rgba(255, 255, 252, 0.52);
}

.preview-zone,
.video-player-shell {
  border-color: var(--ui-border);
  background:
    linear-gradient(90deg, rgba(31, 35, 32, 0.018) 1px, transparent 1px),
    linear-gradient(rgba(31, 35, 32, 0.014) 1px, transparent 1px),
    rgba(255, 255, 252, 0.58);
  background-size: 18px 18px, 18px 18px, auto;
}

.compact-preview {
  height: calc(100% - 52px);
  padding: 0;
}

.empty-state h3,
.video-player-shell h3 {
  font-size: 26px;
}

.task-list,
.video-task-list {
  gap: 16px;
}

.task-card {
  grid-template-columns: 76px minmax(0, 1fr);
  padding: 14px;
}

.task-card,
.video-task-card {
  border-radius: 8px;
  border-color: var(--ui-border);
  background: rgba(255, 255, 252, 0.72);
}

.task-card-actions,
.video-task-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.video-page.active-page {
  display: grid;
  grid-template-rows: minmax(0, 1fr);
  gap: 0;
  padding: 12px 14px 16px;
  overflow: hidden;
}

.video-workspace {
  grid-template-columns: minmax(390px, 0.92fr) minmax(520px, 1.32fr) minmax(340px, 0.82fr);
  gap: 12px;
}

.video-create-panel {
  gap: 18px;
}

.video-compact-layout,
.video-param-stack {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.video-toggle-grid.hidden {
  display: grid !important;
}

.video-toggle-grid {
  grid-column: 1 / -1;
  grid-template-columns: 1fr;
}

.video-toggle:nth-child(n + 2) {
  display: none;
}

.video-upload-board {
  padding-top: 0;
  border-top: 0;
}

.video-primary-actions {
  display: grid;
  gap: 8px;
  margin-top: auto;
}

.video-preview-panel .video-primary-actions {
  display: none;
}

.video-player-shell {
  min-height: 0;
  aspect-ratio: 16 / 10;
}

.video-summary-row {
  margin-top: 12px;
}

.team-page.active-page,
.account-page.active-page,
.history-panel.active-page,
.settings-page.active-page {
  padding: 16px 20px;
}

.team-page-head {
  align-items: center;
  justify-content: flex-end;
  margin-bottom: 14px;
}

.team-page-head > div:first-child {
  display: none;
}

.team-hero-band {
  grid-template-columns: minmax(280px, 0.5fr) minmax(0, 1.5fr);
  padding: 22px;
  background: var(--ui-surface);
}

.team-metric-grid {
  grid-template-columns: repeat(6, minmax(0, 1fr));
}

.account-hero-band .team-metric-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.team-metric {
  min-height: 98px;
  padding: 16px;
  background: rgba(255, 255, 252, 0.62);
}

.team-metric strong {
  font-size: 24px;
}

.account-layout,
.team-layout {
  gap: 14px;
}

.account-plan-card {
  min-height: 246px;
  padding: 18px;
}

.account-plan-card strong {
  font-size: 34px;
}

.account-order-box .team-empty {
  min-height: 170px;
  border-style: dashed;
}

.team-branch {
  grid-template-columns: minmax(360px, 0.95fr) minmax(0, 1.05fr);
  padding: 0;
  overflow: hidden;
  background: rgba(255, 255, 252, 0.62);
}

.team-branch-parent {
  border: 0;
  border-right: 1px solid var(--ui-border);
  border-radius: 0;
  background: transparent;
}

.team-child-list {
  padding: 12px;
}

.history-panel,
.settings-page {
  border: 0;
  background: transparent;
  box-shadow: none;
}

.history-panel > .panel-head,
.settings-page > .panel-head {
  align-items: center;
  padding: 18px;
  border: 1px solid var(--ui-border);
  border-radius: 8px;
  background: var(--ui-surface);
  box-shadow: 0 10px 30px rgba(31, 35, 32, 0.045);
}

.history-toolbar,
.settings-toolbar {
  align-items: center;
  justify-content: flex-end;
}

.history-selection-chip {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  border: 1px solid rgba(47, 108, 67, 0.18);
  border-radius: 8px;
  padding: 0 16px;
  color: var(--ui-green);
  background: var(--ui-green-soft);
  font-weight: 900;
}

.history-filter-row {
  display: grid;
  grid-template-columns: auto minmax(260px, 1fr) 160px;
  gap: 12px;
  align-items: center;
  margin: 12px 0 18px;
}

.history-tabs {
  display: flex;
  overflow: hidden;
  border: 1px solid var(--ui-border);
  border-radius: 8px;
  background: var(--ui-surface);
}

.history-tabs button {
  min-height: 44px;
  border: 0;
  border-right: 1px solid var(--ui-border);
  padding: 0 22px;
  color: var(--ui-text);
  background: transparent;
  cursor: pointer;
  font-weight: 800;
}

.history-tabs button.active {
  color: var(--ui-green);
  background: var(--ui-green-soft);
}

.history-search {
  position: relative;
  display: block;
}

.history-search span {
  position: absolute;
  color: transparent;
}

.history-search input {
  min-height: 44px;
  padding-left: 42px;
}

.history-search::before {
  content: "⌕";
  position: absolute;
  left: 16px;
  top: 50%;
  z-index: 1;
  color: var(--ui-muted);
  transform: translateY(-50%);
}

.history-sort {
  min-height: 44px;
}

.history-grid {
  display: block;
  column-width: 280px;
  column-gap: 14px;
  margin-top: 0;
}

.history-card {
  width: 100%;
  display: inline-block;
  break-inside: avoid;
  overflow: hidden;
  margin: 0 0 14px;
  vertical-align: top;
}

.history-media-shell {
  position: relative;
  overflow: hidden;
  background: #f2f1ec;
}

.history-media-shell img,
.history-media-shell video,
.history-placeholder {
  width: 100%;
  height: auto;
  display: block;
  aspect-ratio: auto;
  object-fit: contain;
}

.history-placeholder {
  min-height: 180px;
  display: grid;
  place-items: center;
}

.history-play-badge {
  position: absolute;
  inset: 50% auto auto 50%;
  width: 54px;
  height: 54px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  background: rgba(31, 35, 32, 0.68);
  transform: translate(-50%, -50%);
}

.history-media-tags {
  position: absolute;
  inset: 10px 10px auto auto;
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
  max-width: calc(100% - 58px);
}

.history-select-control {
  min-width: 28px;
  min-height: 28px;
  padding: 0;
}

.history-select-control span {
  display: none;
}

.history-prompt,
.history-meta {
  min-height: 0;
}

.history-prompt {
  -webkit-line-clamp: 2;
}

.history-actions {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0;
  border-top: 1px solid var(--ui-border);
}

.history-actions button {
  min-height: 38px;
  border: 0;
  border-right: 1px solid var(--ui-border);
  border-radius: 0;
  background: transparent;
  font-size: 12px;
}

.history-actions button:last-child {
  border-right: 0;
}

.settings-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.settings-key-note {
  color: var(--ui-muted);
  font-size: 13px;
  font-weight: 800;
}

.settings-page-grid {
  max-width: none;
  grid-template-columns: minmax(0, 1fr) 330px;
  gap: 14px;
}

.settings-main-column {
  display: grid;
  gap: 14px;
  min-width: 0;
}

.settings-tabs {
  display: flex;
  overflow: hidden;
  border: 1px solid var(--ui-border);
  border-radius: 8px;
  background: var(--ui-surface);
}

.settings-tabs button {
  min-height: 48px;
  border: 0;
  border-right: 1px solid var(--ui-border);
  padding: 0 28px;
  background: transparent;
  cursor: pointer;
  font-weight: 900;
}

.settings-tabs button.active {
  color: var(--ui-green);
  background: var(--ui-green-soft);
}

.model-settings-section,
.settings-summary-panel,
.local-save-section {
  padding: 18px;
  border: 1px solid var(--ui-border);
  border-radius: 8px;
  background: var(--ui-surface);
  box-shadow: 0 10px 30px rgba(31, 35, 32, 0.045);
}

.model-settings-grid {
  grid-template-columns: 1fr;
  gap: 12px;
}

.api-setting-card {
  grid-template-columns: 230px minmax(0, 1fr);
  gap: 16px;
  padding: 16px;
  background: rgba(255, 255, 252, 0.66);
}

.api-setting-head {
  align-content: start;
  gap: 12px;
}

.api-setting-head h3 {
  font-size: 19px;
}

.api-setting-badges,
.model-capability-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.api-setting-badges span,
.model-channel-head span,
.model-capability-row span {
  min-height: 24px;
  display: inline-flex;
  align-items: center;
  border: 1px solid rgba(47, 108, 67, 0.14);
  border-radius: 999px;
  padding: 0 8px;
  color: var(--ui-green);
  background: var(--ui-green-soft);
  font-size: 11px;
  font-weight: 900;
}

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

.model-channel-box {
  padding: 14px;
  border-radius: 8px;
  background: rgba(255, 255, 252, 0.72);
}

.model-channel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.model-capability-row {
  grid-column: 2;
}

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

.folder-picker-card {
  min-height: 78px;
  display: grid;
  gap: 6px;
  padding: 14px;
  border: 1px solid var(--ui-border);
  border-radius: 8px;
  color: var(--ui-text);
  background: rgba(255, 255, 252, 0.66);
  cursor: pointer;
  text-align: left;
}

.folder-picker-card span {
  color: var(--ui-muted);
  font-size: 12px;
  font-weight: 900;
}

.folder-picker-card strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.settings-summary-panel {
  display: grid;
  align-content: start;
  gap: 16px;
}

.settings-summary-panel h3 {
  margin: 0;
}

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

.settings-summary-grid div,
.settings-current-box {
  display: grid;
  gap: 6px;
  padding: 14px;
  border: 1px solid var(--ui-border);
  border-radius: 8px;
  background: rgba(255, 255, 252, 0.66);
}

.settings-summary-grid span,
.settings-current-box span {
  color: var(--ui-muted);
  font-size: 12px;
  font-weight: 900;
}

.settings-summary-grid strong {
  font-size: 28px;
}

.settings-check-list {
  display: grid;
  gap: 10px;
}

.settings-check-list span {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--ui-muted);
  font-size: 13px;
  font-weight: 800;
}

.settings-check-list strong {
  color: var(--ui-green);
}

.settings-security-note {
  margin: 0;
  padding: 14px;
  border: 1px solid rgba(166, 116, 34, 0.2);
  border-radius: 8px;
  color: var(--ui-amber);
  background: rgba(166, 116, 34, 0.08);
  font-size: 13px;
  line-height: 1.6;
}

.settings-current-box p {
  margin: 0;
  color: var(--ui-text);
  font-size: 13px;
}

.settings-save-card {
  grid-column: 1 / -1;
}

@media (max-width: 1320px) {
  .workspace-grid.active-page,
  .video-workspace {
    grid-template-columns: minmax(360px, 0.94fr) minmax(430px, 1.1fr) minmax(300px, 0.8fr);
  }

  .settings-page-grid {
    grid-template-columns: 1fr;
  }
}

/* 2026-05 UI refresh: compact creator console */
:root {
  --ui-bg: #f7f6f2;
  --ui-surface: rgba(255, 255, 252, 0.86);
  --ui-surface-solid: #fffefa;
  --ui-border: rgba(31, 35, 32, 0.1);
  --ui-border-strong: rgba(31, 35, 32, 0.18);
  --ui-text: #202321;
  --ui-muted: #787b75;
  --ui-green: #2f6c43;
  --ui-green-soft: #edf5ed;
  --ui-red: #c83f35;
  --ui-red-soft: #fff0ee;
  --ui-amber: #a67422;
}

body {
  background:
    linear-gradient(90deg, rgba(31, 35, 32, 0.015) 1px, transparent 1px),
    linear-gradient(rgba(31, 35, 32, 0.012) 1px, transparent 1px),
    linear-gradient(135deg, #fbfaf7 0%, #f1eee7 100%);
  background-size: 20px 20px, 20px 20px, auto;
}

body::before {
  opacity: 0.16;
}

.app-shell {
  grid-template-columns: 224px minmax(0, 1fr);
}

.sidebar {
  padding: 22px 18px 16px;
  gap: 22px;
  background: rgba(250, 249, 245, 0.9);
}

.brand {
  grid-template-columns: 44px minmax(0, 1fr);
}

.brand-mark {
  width: 44px;
  height: 44px;
}

.brand strong {
  font-size: 18px;
}

.brand span {
  display: none;
}

.side-nav {
  gap: 10px;
}

.side-nav a {
  min-height: 46px;
  gap: 10px;
  padding: 0 14px;
  font-weight: 800;
}

.side-nav a::before {
  width: 24px;
  color: var(--ui-muted);
  font-size: 18px;
  text-align: center;
}

.side-nav a:nth-child(1)::before { content: "⌁"; }
.side-nav a:nth-child(2)::before { content: "▱"; }
.side-nav a:nth-child(3)::before { content: "♙"; }
.side-nav a:nth-child(4)::before { content: "♧"; }
.side-nav a:nth-child(5)::before { content: "☻"; }
.side-nav a:nth-child(6)::before { content: "↺"; }
.side-nav a:nth-child(7)::before { content: "◌"; }

.side-nav a.active,
.side-nav a:hover {
  color: var(--ui-green);
  border-color: rgba(47, 108, 67, 0.12);
  background: linear-gradient(180deg, rgba(237, 245, 237, 0.92), rgba(255, 255, 252, 0.72));
}

.upgrade-card {
  padding: 16px;
  background: rgba(255, 255, 252, 0.72);
}

.cube {
  width: 48px;
  height: 48px;
  margin-bottom: 12px;
}

.main-shell {
  height: 100vh;
  overflow: hidden;
  padding: 0;
}

.topbar {
  height: 80px;
  margin: 0;
  padding: 0 28px;
  border-bottom: 1px solid var(--ui-border);
  background: rgba(255, 255, 252, 0.82);
  backdrop-filter: blur(18px);
}

.topbar h1 {
  margin: 0;
  color: var(--ui-text);
  font-size: 30px;
  letter-spacing: 0;
}

.top-actions {
  gap: 12px;
}

.glass-btn,
.secondary-btn,
.primary-btn,
.text-btn,
.chip-btn,
.history-actions button,
.remove-file-btn,
.inspiration-actions button {
  min-height: 40px;
  border-color: var(--ui-border-strong);
  color: var(--ui-text);
  background: rgba(255, 255, 252, 0.82);
}

.primary-btn {
  border-color: rgba(47, 108, 67, 0.38);
  color: #fff;
  background: linear-gradient(180deg, #4f855b, #2f6c43);
  box-shadow: 0 10px 22px rgba(47, 108, 67, 0.18);
}

.danger-btn,
.history-toolbar .danger-btn {
  color: var(--ui-red);
  border-color: rgba(200, 63, 53, 0.22);
  background: var(--ui-red-soft);
}

.status-pill {
  min-height: 40px;
  padding: 0 16px;
  border-radius: 999px;
  color: var(--ui-green);
  border-color: rgba(47, 108, 67, 0.16);
  background: rgba(255, 255, 252, 0.84);
  font-weight: 900;
}

.status-pill.ok {
  background: var(--ui-green-soft);
}

.status-pill.error {
  color: var(--ui-red);
  background: var(--ui-red-soft);
}

.user-avatar {
  width: 42px;
  height: 42px;
  border: 1px solid var(--ui-border);
  border-radius: 50%;
  background:
    radial-gradient(circle at 50% 34%, #f4d7c8 0 18%, transparent 19%),
    radial-gradient(circle at 50% 104%, #1f2722 0 38%, transparent 39%),
    linear-gradient(180deg, #ece4dc, #c8c1b8);
  box-shadow: var(--shadow-soft);
}

.app-page.active-page,
.workspace-grid.active-page,
.video-page.active-page {
  height: calc(100vh - 80px);
}

.workspace-grid {
  grid-template-columns: minmax(390px, 0.92fr) minmax(520px, 1.32fr) minmax(340px, 0.82fr);
  grid-template-rows: minmax(0, 1fr);
  gap: 12px;
  padding: 12px 14px 16px;
  height: calc(100vh - 80px);
}

.image-page-head,
.video-page-head {
  display: none !important;
}

.panel,
.task-board,
.history-card,
.inspiration-card,
.dialog-card,
.image-preview-card,
.metric-card {
  border-color: var(--ui-border);
  background: var(--ui-surface);
  box-shadow: 0 10px 30px rgba(31, 35, 32, 0.045);
}

.panel {
  padding: 22px;
}

.create-panel,
.video-create-panel {
  overflow: auto !important;
}

.panel-head h2 {
  color: var(--ui-text);
  font-size: 22px;
}

.panel-subtitle {
  font-size: 13px;
}

.compact-form {
  display: flex;
  flex-direction: column;
  min-height: 100%;
  gap: 18px;
}

.compact-form > .field-wide:first-child {
  order: 1;
}

#referenceUploadSection {
  order: 2;
}

.parameter-grid {
  order: 3;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.parameter-grid .field:last-child {
  grid-column: 1 / -1;
}

.sticky-actions {
  order: 4;
  margin-top: auto;
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

.sticky-actions .primary-btn {
  min-height: 52px;
  width: 100%;
  font-size: 18px;
}

#clearFormBtn {
  display: none;
}

.action-summary {
  margin: 0;
  color: var(--ui-muted);
  font-size: 14px;
  font-weight: 800;
  text-align: center;
}

.field-label-row span,
.field > span,
.video-upload-head strong {
  color: var(--ui-text);
  font-size: 14px;
}

.clear-prompt-btn,
.clear-reference-btn {
  color: var(--ui-green);
  font-size: 13px;
}

textarea,
input,
select {
  border-color: var(--ui-border);
  background: rgba(255, 255, 252, 0.78);
}

textarea {
  resize: none;
}

.create-panel textarea {
  min-height: 126px;
}

.dropzone {
  min-height: 118px;
  padding: 18px;
  border-style: dashed;
  border-color: rgba(31, 35, 32, 0.22);
  background: rgba(255, 255, 252, 0.58);
}

.dropzone.has-reference-files {
  min-height: 160px;
  padding: 8px 6px 10px;
  border-color: transparent;
  background: transparent;
}

.dropzone.has-reference-files > strong,
.dropzone.has-reference-files > p {
  display: none;
}

.dropzone.has-reference-files .reference-material-stack {
  min-height: 142px;
  max-height: 154px;
  margin-top: 0;
  padding: 12px 8px;
}

.reference-material-stack {
  align-items: flex-end;
}

.reference-thumb-card {
  flex-basis: 112px;
  width: 112px;
  min-height: 136px;
  padding: 5px;
  border: 1px solid rgba(31, 35, 32, 0.18);
  border-radius: 12px;
  background: #fffefa;
  box-shadow: 0 12px 24px rgba(31, 35, 32, 0.16);
  transform: rotate(var(--card-tilt, -3deg)) translateY(var(--card-rise, 0));
}

.reference-thumb-card + .reference-thumb-card {
  margin-left: -32px;
}

.reference-thumb-card:hover,
.reference-thumb-card:focus-within {
  transform: rotate(0deg) translateY(-7px);
  z-index: 10;
}

.reference-card-media {
  height: 126px;
  aspect-ratio: auto;
  border-radius: 10px;
}

.reference-add-card {
  flex-basis: 98px;
  width: 98px;
  min-height: 136px;
  margin-left: 8px;
  background: rgba(255, 255, 252, 0.52);
}

.preview-zone,
.video-player-shell {
  border-color: var(--ui-border);
  background:
    linear-gradient(90deg, rgba(31, 35, 32, 0.018) 1px, transparent 1px),
    linear-gradient(rgba(31, 35, 32, 0.014) 1px, transparent 1px),
    rgba(255, 255, 252, 0.58);
  background-size: 18px 18px, 18px 18px, auto;
}

.compact-preview {
  height: calc(100% - 52px);
  padding: 0;
}

.empty-state h3,
.video-player-shell h3 {
  font-size: 26px;
}

.task-list,
.video-task-list {
  gap: 16px;
}

.task-card,
.video-task-card {
  border-radius: 8px;
  border-color: var(--ui-border);
  background: rgba(255, 255, 252, 0.72);
}

.task-card {
  grid-template-columns: 76px minmax(0, 1fr);
  padding: 14px;
}

.task-card-actions,
.video-task-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.task-restart-btn,
.task-delete-btn,
.video-task-actions button {
  min-height: 38px;
  border-radius: 8px;
}

.video-page.active-page {
  grid-template-rows: minmax(0, 1fr);
  gap: 0;
  padding: 12px 14px 16px;
}

.video-workspace {
  grid-template-columns: minmax(390px, 0.92fr) minmax(520px, 1.32fr) minmax(340px, 0.82fr);
  gap: 12px;
}

.video-create-panel {
  gap: 18px;
}

.video-prompt-field {
  gap: 8px;
}

.video-prompt-field textarea {
  min-height: 126px;
}

.video-compact-layout,
.video-param-stack {
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.video-param-stack {
  display: grid;
}

.video-picker-card-ratio {
  grid-column: auto;
}

.video-toggle-grid.hidden {
  display: grid !important;
}

.video-toggle-grid {
  grid-column: 1 / -1;
  grid-template-columns: 1fr;
}

.video-toggle:nth-child(n + 2) {
  display: none;
}

.video-upload-board {
  order: 2;
  padding-top: 0;
  border-top: 0;
}

.video-primary-actions {
  margin-top: auto;
  display: grid;
  gap: 8px;
}

.video-primary-actions .primary-btn {
  width: 100%;
  min-height: 52px;
  font-size: 18px;
}

.video-preview-panel .video-primary-actions {
  display: none;
}

.video-player-shell {
  min-height: 0;
  aspect-ratio: 16 / 10;
}

.video-summary-row {
  margin-top: 12px;
}

.team-page.active-page,
.account-page.active-page,
.history-panel.active-page,
.settings-page.active-page {
  padding: 16px 20px;
}

.team-page-head {
  align-items: center;
  justify-content: flex-end;
  margin-bottom: 14px;
}

.team-page-head > div:first-child {
  display: none;
}

.team-hero-band {
  grid-template-columns: minmax(280px, 0.5fr) minmax(0, 1.5fr);
  padding: 22px;
  background: var(--ui-surface);
}

.team-metric-grid {
  grid-template-columns: repeat(6, minmax(0, 1fr));
}

.account-hero-band .team-metric-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.team-metric {
  min-height: 98px;
  padding: 16px;
  background: rgba(255, 255, 252, 0.62);
}

.team-metric strong {
  font-size: 24px;
}

.account-layout,
.team-layout {
  gap: 14px;
}

.account-plan-card {
  min-height: 246px;
  padding: 18px;
}

.account-plan-card strong {
  font-size: 34px;
}

.account-order-box .team-empty {
  min-height: 170px;
  border-style: dashed;
}

.team-tree-panel .panel-head,
.team-list-panel .panel-head {
  margin-bottom: 12px;
}

.team-branch {
  grid-template-columns: minmax(360px, 0.95fr) minmax(0, 1.05fr);
  padding: 0;
  overflow: hidden;
  background: rgba(255, 255, 252, 0.62);
}

.team-branch-parent {
  border: 0;
  border-right: 1px solid var(--ui-border);
  border-radius: 0;
  background: transparent;
}

.team-child-list {
  padding: 12px;
}

.history-panel {
  background: transparent;
  border: 0;
  box-shadow: none;
}

.history-panel > .panel-head {
  align-items: center;
  padding: 18px;
  border: 1px solid var(--ui-border);
  border-radius: 8px;
  background: var(--ui-surface);
  box-shadow: 0 10px 30px rgba(31, 35, 32, 0.045);
}

.history-toolbar {
  align-items: center;
  justify-content: flex-end;
}

.history-selection-chip {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  border: 1px solid rgba(47, 108, 67, 0.18);
  border-radius: 8px;
  padding: 0 16px;
  color: var(--ui-green);
  background: var(--ui-green-soft);
  font-weight: 900;
}

.history-filter-row {
  display: grid;
  grid-template-columns: auto minmax(260px, 1fr) 160px;
  gap: 12px;
  align-items: center;
  margin: 12px 0 18px;
}

.history-tabs {
  display: flex;
  align-items: center;
  overflow: hidden;
  border: 1px solid var(--ui-border);
  border-radius: 8px;
  background: var(--ui-surface);
}

.history-tabs button {
  min-height: 44px;
  border: 0;
  border-right: 1px solid var(--ui-border);
  padding: 0 22px;
  color: var(--ui-text);
  background: transparent;
  cursor: pointer;
  font-weight: 800;
}

.history-tabs button:last-child {
  border-right: 0;
}

.history-tabs button.active {
  color: var(--ui-green);
  background: var(--ui-green-soft);
}

.history-search {
  position: relative;
  display: block;
}

.history-search span {
  position: absolute;
  inset: 50% auto auto 14px;
  color: transparent;
  transform: translateY(-50%);
}

.history-search input {
  min-height: 44px;
  padding-left: 42px;
}

.history-search::before {
  content: "⌕";
  position: absolute;
  left: 16px;
  top: 50%;
  z-index: 1;
  color: var(--ui-muted);
  transform: translateY(-50%);
}

.history-sort {
  min-height: 44px;
}

.history-grid {
  display: block;
  column-width: 280px;
  column-gap: 14px;
  margin-top: 0;
}

.history-card {
  width: 100%;
  display: inline-block;
  break-inside: avoid;
  overflow: hidden;
  margin: 0 0 14px;
  vertical-align: top;
}

.history-media-shell {
  position: relative;
  overflow: hidden;
  background: #f2f1ec;
}

.history-media-shell img,
.history-media-shell video,
.history-placeholder {
  width: 100%;
  height: auto;
  display: block;
  aspect-ratio: auto;
  object-fit: contain;
}

.history-placeholder {
  min-height: 180px;
  display: grid;
  place-items: center;
}

.history-play-badge {
  position: absolute;
  inset: 50% auto auto 50%;
  width: 54px;
  height: 54px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  background: rgba(31, 35, 32, 0.68);
  transform: translate(-50%, -50%);
}

.history-media-tags {
  position: absolute;
  inset: 10px 10px auto auto;
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
  max-width: calc(100% - 58px);
}

.history-select-control {
  min-width: 28px;
  min-height: 28px;
  padding: 0;
}

.history-select-control span {
  display: none;
}

.history-prompt {
  min-height: 0;
  -webkit-line-clamp: 2;
}

.history-meta {
  min-height: 0;
}

.history-actions {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0;
  border-top: 1px solid var(--ui-border);
}

.history-actions button {
  min-height: 38px;
  border: 0;
  border-right: 1px solid var(--ui-border);
  border-radius: 0;
  background: transparent;
  font-size: 12px;
}

.history-actions button:last-child {
  border-right: 0;
}

.settings-page {
  background: transparent;
  border: 0;
  box-shadow: none;
}

.settings-page > .panel-head {
  align-items: center;
  padding: 18px;
  border: 1px solid var(--ui-border);
  border-radius: 8px;
  background: var(--ui-surface);
  box-shadow: 0 10px 30px rgba(31, 35, 32, 0.045);
}

.settings-toolbar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 12px;
}

.settings-key-note {
  color: var(--ui-muted);
  font-size: 13px;
  font-weight: 800;
}

.settings-page-grid {
  max-width: none;
  grid-template-columns: minmax(0, 1fr) 330px;
  gap: 14px;
}

.settings-main-column {
  display: grid;
  gap: 14px;
  min-width: 0;
}

.settings-tabs {
  display: flex;
  align-items: center;
  gap: 0;
  overflow: hidden;
  border: 1px solid var(--ui-border);
  border-radius: 8px;
  background: var(--ui-surface);
}

.settings-tabs button {
  min-height: 48px;
  border: 0;
  border-right: 1px solid var(--ui-border);
  padding: 0 28px;
  background: transparent;
  cursor: pointer;
  font-weight: 900;
}

.settings-tabs button.active {
  color: var(--ui-green);
  background: var(--ui-green-soft);
}

.model-settings-section,
.settings-summary-panel,
.local-save-section {
  padding: 18px;
  border: 1px solid var(--ui-border);
  border-radius: 8px;
  background: var(--ui-surface);
  box-shadow: 0 10px 30px rgba(31, 35, 32, 0.045);
}

.model-settings-grid {
  grid-template-columns: 1fr;
  gap: 12px;
}

.api-setting-card {
  grid-template-columns: 230px minmax(0, 1fr);
  gap: 16px;
  padding: 16px;
  background: rgba(255, 255, 252, 0.66);
}

.api-setting-head {
  align-content: start;
  gap: 12px;
}

.api-setting-head h3 {
  font-size: 19px;
}

.api-setting-badges,
.model-capability-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.api-setting-badges span,
.model-channel-head span,
.model-capability-row span {
  min-height: 24px;
  display: inline-flex;
  align-items: center;
  border: 1px solid rgba(47, 108, 67, 0.14);
  border-radius: 999px;
  padding: 0 8px;
  color: var(--ui-green);
  background: var(--ui-green-soft);
  font-size: 11px;
  font-weight: 900;
}

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

.model-channel-box {
  padding: 14px;
  border-radius: 8px;
  background: rgba(255, 255, 252, 0.72);
}

.model-channel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.model-capability-row {
  grid-column: 2;
}

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

.folder-picker-card {
  min-height: 78px;
  display: grid;
  gap: 6px;
  padding: 14px;
  border: 1px solid var(--ui-border);
  border-radius: 8px;
  color: var(--ui-text);
  background: rgba(255, 255, 252, 0.66);
  cursor: pointer;
  text-align: left;
}

.folder-picker-card span {
  color: var(--ui-muted);
  font-size: 12px;
  font-weight: 900;
}

.folder-picker-card strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.settings-summary-panel {
  display: grid;
  align-content: start;
  gap: 16px;
}

.settings-summary-panel h3 {
  margin: 0;
}

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

.settings-summary-grid div,
.settings-current-box {
  display: grid;
  gap: 6px;
  padding: 14px;
  border: 1px solid var(--ui-border);
  border-radius: 8px;
  background: rgba(255, 255, 252, 0.66);
}

.settings-summary-grid span,
.settings-current-box span {
  color: var(--ui-muted);
  font-size: 12px;
  font-weight: 900;
}

.settings-summary-grid strong {
  font-size: 28px;
}

.settings-check-list {
  display: grid;
  gap: 10px;
}

.settings-check-list span {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--ui-muted);
  font-size: 13px;
  font-weight: 800;
}

.settings-check-list strong {
  color: var(--ui-green);
}

.settings-security-note {
  margin: 0;
  padding: 14px;
  border: 1px solid rgba(166, 116, 34, 0.2);
  border-radius: 8px;
  color: var(--ui-amber);
  background: rgba(166, 116, 34, 0.08);
  font-size: 13px;
  line-height: 1.6;
}

.settings-current-box p {
  margin: 0;
  color: var(--ui-text);
  font-size: 13px;
}

.settings-save-card {
  grid-column: 1 / -1;
}

@media (max-width: 1320px) {
  .workspace-grid,
  .video-workspace {
    grid-template-columns: minmax(360px, 0.94fr) minmax(430px, 1.1fr) minmax(300px, 0.8fr);
  }

  .settings-page-grid {
    grid-template-columns: 1fr;
  }
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: auto;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: "Microsoft YaHei", "PingFang SC", "Segoe UI", sans-serif;
  background:
    linear-gradient(90deg, rgba(42, 42, 42, 0.018) 1px, transparent 1px),
    linear-gradient(rgba(42, 42, 42, 0.014) 1px, transparent 1px),
    radial-gradient(circle at 30% 12%, rgba(255, 255, 255, 0.78), transparent 34%),
    linear-gradient(135deg, #f5f4f0 0%, #ebe7dd 48%, #f8f6ef 100%);
  background-size: 22px 22px, 22px 22px, auto, auto;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.34;
  background-image:
    repeating-linear-gradient(0deg, rgba(42, 42, 42, 0.022) 0 1px, transparent 1px 4px),
    repeating-linear-gradient(90deg, rgba(42, 42, 42, 0.018) 0 1px, transparent 1px 5px);
  mix-blend-mode: multiply;
}

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

.hidden {
  display: none !important;
}

.app-shell {
  display: grid;
  grid-template-columns: 236px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 24px 18px;
  border-right: 1px solid var(--line);
  background: rgba(245, 244, 240, 0.88);
  backdrop-filter: blur(18px);
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.brand {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
}

.brand-mark {
  width: 48px;
  height: 48px;
  padding: 8px;
  display: grid;
  place-items: center;
  border-radius: var(--radius);
  background: var(--paper-solid);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-soft);
}

.brand-mark img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.brand strong,
.brand span {
  display: block;
}

.brand strong {
  color: var(--ink);
  font-size: 17px;
  line-height: 1.25;
}

.app-version {
  display: inline-flex;
  align-items: center;
  min-height: 18px;
  margin-left: 6px;
  padding: 2px 6px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: rgba(255, 255, 250, 0.72);
  font-size: 10px;
  font-weight: 800;
  vertical-align: middle;
}

.inline-version {
  transform: translateY(-2px);
}

.brand span,
.eyebrow {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.18em;
}

.side-nav {
  display: grid;
  gap: 8px;
}

.side-nav a {
  min-height: 44px;
  display: flex;
  align-items: center;
  color: var(--ink-soft);
  text-decoration: none;
  padding: 0 14px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  transition: background 0.18s ease, border-color 0.18s ease, color 0.18s ease;
}

.side-nav a.active,
.side-nav a:hover {
  color: var(--ink);
  border-color: var(--line-strong);
  background: rgba(255, 255, 250, 0.74);
}

.upgrade-card {
  margin-top: auto;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 250, 0.58);
  box-shadow: var(--shadow-soft);
}

.cube,
.preview-orbit {
  width: 58px;
  height: 58px;
  margin: 0 0 16px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--paper-solid) url("/assets/pangu-logo.png") center / 72% auto no-repeat;
  position: relative;
}

.cube::before,
.preview-orbit::before {
  content: none;
}

.upgrade-card p,
.panel-subtitle,
small,
.history-empty,
.dialog-copy {
  color: var(--muted);
  line-height: 1.7;
}

.upgrade-card p {
  margin-bottom: 0;
}

.history-cache-note {
  display: inline-flex;
  align-items: center;
  margin: 8px 0 0;
  padding: 6px 12px;
  border: 1px solid rgba(157, 122, 60, 0.28);
  border-radius: 999px;
  background: rgba(157, 122, 60, 0.08);
  color: var(--warning);
  font-size: 13px;
  font-weight: 800;
}

.main-shell {
  height: 100vh;
  overflow: hidden;
  padding: 22px 24px;
}

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

.topbar h1 {
  margin: 4px 0 0;
  font-size: 34px;
  letter-spacing: 0;
  line-height: 1.12;
}

.top-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.workspace-grid {
  display: none;
  grid-template-columns: minmax(360px, 0.9fr) minmax(520px, 1.45fr) minmax(300px, 0.72fr);
  grid-template-rows: auto minmax(0, 1fr);
  gap: 18px;
  align-items: start;
  height: calc(100vh - 120px);
}

.app-page {
  display: none;
  animation: pageIn 0.2s ease both;
}

.app-page.active-page {
  display: block;
  height: calc(100vh - 120px);
  overflow: auto;
}

.workspace-grid.active-page {
  display: grid;
  overflow: hidden;
}

.image-page-head {
  grid-column: 1 / -1;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
}

.image-page-head h2 {
  margin: 4px 0 6px;
  font-size: 34px;
  line-height: 1.08;
}

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

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

.team-page {
  display: none;
}

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

.team-page-head h2 {
  margin: 4px 0 6px;
  font-size: 34px;
  line-height: 1.08;
}

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

.team-status-row {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 10px;
}

.team-alert {
  margin-bottom: 14px;
  padding: 12px 14px;
  border: 1px solid rgba(163, 91, 79, 0.28);
  border-radius: var(--radius);
  color: var(--danger);
  background: rgba(163, 91, 79, 0.08);
  font-weight: 800;
}

.team-alert.ok {
  color: var(--green);
  border-color: rgba(111, 134, 108, 0.28);
  background: rgba(111, 134, 108, 0.09);
}

.team-hero-band {
  display: grid;
  grid-template-columns: minmax(280px, 0.78fr) minmax(0, 1.35fr);
  gap: 14px;
  margin-bottom: 18px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 250, 0.62);
  box-shadow: var(--shadow-soft);
}

.team-profile {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr);
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.team-avatar {
  width: 58px;
  height: 58px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(66, 92, 120, 0.22);
  border-radius: 50%;
  color: #fffefa;
  background: #425c78;
  font-size: 22px;
  font-weight: 900;
}

.team-profile span,
.team-metric span,
.team-child span,
.team-branch-parent span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.team-profile strong {
  display: block;
  margin: 3px 0;
  overflow: hidden;
  color: var(--ink);
  font-size: 24px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.team-profile small {
  display: block;
}

.team-metric-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
}

.team-metric {
  min-height: 78px;
  display: grid;
  align-content: center;
  gap: 4px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 250, 0.58);
}

.team-metric strong {
  overflow-wrap: anywhere;
  color: var(--ink);
  font-size: 20px;
  line-height: 1.15;
}

.team-layout {
  display: grid;
  grid-template-columns: minmax(520px, 1.34fr) minmax(320px, 0.66fr);
  gap: 18px;
  align-items: start;
}

.team-tree-panel,
.team-list-panel {
  min-height: 0;
}

.team-side-stack,
.team-tree-list,
.team-mini-list {
  display: grid;
  gap: 12px;
}

.team-branch {
  display: grid;
  grid-template-columns: minmax(230px, 0.78fr) minmax(0, 1.22fr);
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 250, 0.52);
}

.team-branch-parent {
  min-height: 108px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px;
  border: 1px solid rgba(66, 92, 120, 0.18);
  border-radius: var(--radius);
  background: rgba(232, 238, 242, 0.42);
}

.team-branch-parent div {
  min-width: 0;
}

.team-branch-parent strong {
  display: block;
  margin: 4px 0;
  overflow: hidden;
  color: var(--ink);
  font-size: 18px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.team-branch-parent small {
  display: block;
}

.team-branch-parent em {
  flex: none;
  min-height: 30px;
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 0 10px;
  color: #425c78;
  background: rgba(66, 92, 120, 0.1);
  font-style: normal;
  font-size: 12px;
  font-weight: 900;
}

.team-child-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px;
}

.team-child,
.team-child-empty,
.team-mini-row,
.team-empty {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 250, 0.58);
}

.team-child {
  min-height: 86px;
  display: grid;
  align-content: center;
  gap: 4px;
  padding: 12px;
}

.team-child strong {
  overflow: hidden;
  color: var(--ink);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.team-child small {
  line-height: 1.3;
}

.team-child-empty,
.team-empty {
  display: grid;
  place-items: center;
  min-height: 86px;
  padding: 14px;
  color: var(--muted);
  text-align: center;
  line-height: 1.6;
}

.team-mini-row {
  min-height: 70px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
}

.team-mini-row div {
  min-width: 0;
}

.team-mini-row strong,
.team-mini-row small {
  display: block;
}

.team-mini-row strong {
  overflow: hidden;
  color: var(--ink);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.team-tag {
  flex: none;
  min-height: 28px;
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 0 10px;
  color: var(--muted);
  border: 1px solid var(--line);
  background: rgba(255, 255, 250, 0.72);
  font-size: 12px;
  font-weight: 900;
}

.team-tag.pending,
.team-tag.unused {
  color: var(--warning);
  border-color: rgba(157, 122, 60, 0.28);
  background: rgba(157, 122, 60, 0.08);
}

.team-tag.settled,
.team-tag.used,
.team-tag.active {
  color: var(--green);
  border-color: rgba(111, 134, 108, 0.28);
  background: rgba(111, 134, 108, 0.1);
}

.team-tag.void,
.team-tag.banned,
.team-tag.failed {
  color: var(--danger);
  border-color: rgba(163, 91, 79, 0.28);
  background: rgba(163, 91, 79, 0.08);
}

.inline-input-action {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 132px;
  gap: 8px;
  align-items: stretch;
}

.inline-input-action .secondary-btn {
  min-height: 46px;
  height: 46px;
  padding: 0 12px;
  white-space: nowrap;
}

.account-hero-band .team-metric-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.account-layout {
  display: grid;
  grid-template-columns: minmax(560px, 1.12fr) minmax(360px, 0.88fr);
  gap: 18px;
  align-items: start;
}

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

.account-plan-card {
  min-height: 210px;
  display: grid;
  align-content: start;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 250, 0.58);
}

.account-plan-card span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.account-plan-card strong {
  color: var(--ink);
  font-size: 28px;
  line-height: 1.1;
}

.account-plan-card small {
  min-height: 46px;
}

.account-plan-card button {
  align-self: end;
  margin-top: auto;
}

.account-order-box {
  display: grid;
  gap: 12px;
}

.account-pay-code,
.account-qr-box {
  display: grid;
  gap: 8px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 250, 0.58);
}

.account-pay-code span,
.account-qr-box strong {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.account-pay-code strong {
  overflow-wrap: anywhere;
  color: var(--ink);
  font-size: 17px;
}

.account-qr-box {
  min-height: 180px;
  place-items: center;
  text-align: center;
  background:
    linear-gradient(90deg, rgba(42, 42, 42, 0.08) 1px, transparent 1px),
    linear-gradient(rgba(42, 42, 42, 0.08) 1px, transparent 1px),
    rgba(255, 255, 250, 0.72);
  background-size: 14px 14px;
}

.account-qr-box small {
  max-width: 100%;
  overflow-wrap: anywhere;
  color: var(--ink-soft);
}

.account-order-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.invite-code-row {
  align-items: center;
}

.invite-code-row strong {
  letter-spacing: 0.08em;
}

@keyframes pageIn {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.panel,
.task-board,
.history-card,
.inspiration-card,
.dialog-card,
.image-preview-card,
.metric-card {
  position: relative;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
  box-shadow: var(--shadow-soft);
}

.panel {
  padding: 22px;
}

.workspace-grid > .panel,
.workspace-grid > .task-board {
  height: 100%;
  overflow: hidden;
}

.create-panel {
  overflow: auto !important;
}

.result-panel,
.task-board {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.result-panel .panel-head,
.task-board-head {
  flex: none;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.compact-head {
  margin-bottom: 12px;
}

.panel-head h2 {
  margin: 0;
  font-size: 23px;
  line-height: 1.25;
}

.form-grid,
.settings-body,
.result-block,
.task-list,
.inspiration-form,
.reference-card-body,
.history-card-body,
.inspiration-card-body {
  display: grid;
  gap: 14px;
}

.compact-form {
  gap: 12px;
}

.parameter-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(138px, 1fr));
  gap: 12px;
  align-items: end;
}

.field {
  display: grid;
  gap: 8px;
}

.field-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.clear-reference-btn,
.clear-prompt-btn {
  min-height: 30px;
  padding: 0 8px;
  color: var(--muted);
  font-size: 12px;
}

.clear-prompt-btn {
  color: var(--danger);
}

.clear-reference-btn:disabled,
.clear-prompt-btn:disabled {
  cursor: default;
  opacity: 0.42;
  transform: none;
  box-shadow: none;
}

.resolved-size-hint {
  display: none;
  min-height: 18px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
  text-align: center;
}

.field span,
.info-label,
.upload-stat-label,
.metric-label {
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 800;
}

input,
textarea,
select {
  width: 100%;
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 11px 13px;
  color: var(--ink);
  background: rgba(255, 255, 250, 0.72);
  outline: none;
}

textarea {
  min-height: 144px;
  line-height: 1.6;
  resize: vertical;
}

select {
  text-align-last: center;
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--line-strong);
  box-shadow: 0 0 0 4px rgba(42, 42, 42, 0.06);
  background: var(--paper-solid);
}

.form-actions,
.result-actions,
.history-toolbar,
.dialog-actions,
.image-preview-actions,
.inspiration-actions,
.preset-list,
.reference-badges,
.inspiration-meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.glass-btn,
.secondary-btn,
.primary-btn,
.text-btn,
.chip-btn,
.history-actions button,
.remove-file-btn,
.inspiration-actions button {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  border-radius: var(--radius);
  border: 1px solid var(--line-strong);
  padding: 0 15px;
  cursor: pointer;
  text-decoration: none;
  color: var(--ink);
  background: rgba(255, 255, 250, 0.74);
  font-weight: 800;
  transition: transform 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
}

.glass-btn:hover,
.secondary-btn:hover,
.chip-btn:hover,
.history-actions button:hover,
.remove-file-btn:hover,
.inspiration-actions button:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-soft);
  background: var(--paper-solid);
}

.secondary-btn:disabled,
.primary-btn:disabled,
.history-actions button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
  transform: none;
  box-shadow: none;
}

.primary-btn {
  min-height: 54px;
  border-color: var(--ink);
  color: var(--canvas-soft);
  background: var(--ink);
  box-shadow: var(--shadow-soft);
}

.primary-btn:hover {
  transform: translateY(-1px);
  background: #111;
}

.text-btn {
  min-height: 34px;
  justify-self: center;
  border-color: transparent;
  padding: 0 6px;
  color: var(--muted);
  background: transparent;
  box-shadow: none;
}

.text-btn:hover {
  color: var(--ink);
  background: rgba(42, 42, 42, 0.04);
}

.danger-btn {
  border-color: var(--danger);
  color: #fff;
  background: var(--danger);
}

.status-pill {
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 0 14px;
  color: var(--ink);
  border: 1px solid var(--line);
  background: rgba(255, 255, 250, 0.64);
  font-size: 12px;
  font-weight: 800;
}

.status-pill.ok {
  color: #455f43;
  border-color: rgba(111, 134, 108, 0.36);
  background: var(--green-soft);
}

.status-pill.error {
  color: var(--danger);
  border-color: rgba(163, 91, 79, 0.34);
  background: rgba(163, 91, 79, 0.08);
}

.status-pill.busy {
  color: var(--warning);
  border-color: rgba(157, 122, 60, 0.36);
  background: rgba(157, 122, 60, 0.08);
}

.status-pill.neutral {
  color: var(--muted);
}

.dropzone {
  display: grid;
  gap: 8px;
  padding: 18px;
  border-radius: var(--radius);
  border: 1px dashed var(--line-strong);
  background: rgba(255, 255, 250, 0.5);
  cursor: pointer;
  text-align: center;
}

.dropzone input {
  display: none;
}

.compact-dropzone {
  padding: 14px;
}

.compact-dropzone p {
  margin: 0;
}

.dropzone.dragover,
.dropzone.edit-mode {
  border-color: var(--ink);
  background: rgba(255, 255, 250, 0.82);
}

.upload-stats,
.metric-row,
.info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(112px, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.compact-stats {
  grid-template-columns: 1fr;
}

.compact-info {
  width: min(460px, 100%);
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.upload-stat-card,
.info-card {
  min-height: 68px;
  display: grid;
  align-content: center;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px 12px;
  background: rgba(255, 255, 250, 0.56);
}

.upload-stat-card strong,
.info-card strong {
  color: var(--ink);
  overflow-wrap: anywhere;
}

.selected-files-grid,
.history-grid,
.inspiration-grid {
  display: grid;
  gap: 14px;
  margin-top: 14px;
}

.selected-files-grid {
  grid-template-columns: repeat(auto-fill, minmax(152px, 1fr));
}

.history-grid {
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  align-items: stretch;
}

.history-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

.history-pagination button {
  min-width: 42px;
  min-height: 36px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  color: var(--ink);
  background: rgba(255, 255, 250, 0.74);
  cursor: pointer;
  font-weight: 900;
}

.history-pagination button.active {
  color: #fff;
  background: var(--ink);
}

.history-pagination button:disabled {
  cursor: not-allowed;
  opacity: 0.42;
}

.history-page-buttons {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
}

.history-pagination span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.inspiration-grid {
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
}

.compact-reference-grid {
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  max-height: 104px;
  overflow: auto;
}

.reference-material-stack {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 0;
  max-height: 0;
  margin: 0;
  padding: 0;
  overflow-x: auto;
  overflow-y: hidden;
  transition: min-height 0.18s ease, max-height 0.18s ease, margin 0.18s ease;
}

.dropzone.has-reference-files {
  text-align: left;
}

.dropzone.has-reference-files .reference-material-stack {
  min-height: 112px;
  max-height: 126px;
  margin-top: 10px;
  padding: 10px 8px 12px;
}

.reference-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 250, 0.58);
}

.reference-thumb-card {
  position: relative;
  flex: 0 0 88px;
  width: 88px;
  min-height: 96px;
  overflow: hidden;
  background: var(--paper-solid);
  box-shadow: 0 10px 22px rgba(42, 42, 42, 0.14);
  transform: none;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
  z-index: 1;
}

.reference-thumb-card + .reference-thumb-card {
  margin-left: 0;
}

.reference-thumb-card:hover,
.reference-thumb-card:focus-within {
  transform: translateY(-3px);
  box-shadow: 0 16px 28px rgba(42, 42, 42, 0.18);
  z-index: 3;
}

.reference-add-card {
  flex: 0 0 82px;
  width: 82px;
  min-height: 96px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 4px;
  margin-left: 0;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  color: var(--ink);
  background: rgba(255, 255, 250, 0.72);
  box-shadow: var(--shadow-soft);
  cursor: pointer;
  font-weight: 900;
}

.reference-add-card:hover,
.reference-add-card:focus-visible {
  border-color: var(--ink);
  background: var(--paper-solid);
  transform: translateY(-3px);
}

.reference-add-icon {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--ink);
  color: var(--paper-solid);
  font-size: 22px;
  line-height: 1;
}

.reference-add-card small {
  color: var(--muted);
  font-size: 12px;
}

.reference-card-media {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius);
  aspect-ratio: 1 / 1;
  background: var(--canvas-soft);
}

.reference-card-media::after {
  content: "";
  position: absolute;
  z-index: 1;
  inset: auto 0 0;
  height: 54%;
  pointer-events: none;
  background: linear-gradient(180deg, transparent, rgba(17, 17, 17, 0.54));
}

.reference-card-type,
.reference-card-file-name {
  position: absolute;
  z-index: 8;
  display: inline-flex;
  align-items: center;
  max-width: calc(100% - 16px);
  border-radius: 999px;
  color: #fff;
  background: rgba(17, 17, 17, 0.96);
  box-shadow: 0 8px 16px rgba(42, 42, 42, 0.24);
  font-weight: 900;
  line-height: 1;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.55);
}

.reference-card-type {
  left: 6px;
  top: 6px;
  min-height: 20px;
  padding: 0 7px;
  font-size: 11px;
}

.reference-card-file-name {
  left: 6px;
  bottom: 6px;
  min-height: 20px;
  padding: 0 7px;
  overflow: hidden;
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.reference-card-remove {
  position: absolute;
  right: 4px;
  top: 4px;
  z-index: 12;
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.78);
  border-radius: 50%;
  color: #fff;
  background: rgba(17, 17, 17, 0.88);
  box-shadow: 0 6px 14px rgba(42, 42, 42, 0.24);
  cursor: pointer;
  font-size: 18px;
  font-weight: 900;
  line-height: 1;
}

.reference-card-remove:hover {
  transform: scale(1.04);
}

.history-card {
  min-height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.history-card-selected {
  border-color: rgba(111, 134, 108, 0.58);
  box-shadow: 0 0 0 3px rgba(111, 134, 108, 0.12), var(--shadow-soft);
}

.history-select-control {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 4;
  min-height: 30px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 10px;
  border: 1px solid rgba(42, 42, 42, 0.18);
  border-radius: 999px;
  color: var(--ink);
  background: rgba(255, 255, 250, 0.9);
  box-shadow: var(--shadow-soft);
  cursor: pointer;
  font-size: 12px;
  font-weight: 900;
}

.history-select-control input {
  width: 15px;
  height: 15px;
  accent-color: var(--green);
  cursor: pointer;
}

.reference-card img,
.history-card img,
.history-card video,
.inspiration-card img {
  width: 100%;
  display: block;
  object-fit: contain;
  background: var(--canvas-soft);
}

.reference-card img,
.history-card img,
.history-card video {
  aspect-ratio: 1 / 1;
}

.reference-card img {
  height: 100%;
  object-fit: cover;
}

.history-card video {
  background: #111;
}

.inspiration-card img {
  aspect-ratio: 4 / 3;
}

.reference-card-body,
.history-card-body,
.inspiration-card-body {
  padding: 12px;
}

.history-card-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.reference-badge,
.history-status,
.history-mode {
  min-height: 24px;
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 0 9px;
  color: var(--ink-soft);
  border: 1px solid var(--line);
  background: rgba(255, 255, 250, 0.62);
  font-size: 12px;
  font-weight: 800;
}

.history-status-saved {
  color: #455f43;
  background: var(--green-soft);
}

.history-status-remote {
  color: #596878;
  background: rgba(209, 220, 228, 0.48);
}

.history-status-preview {
  color: var(--warning);
  background: rgba(157, 122, 60, 0.08);
}

.history-prompt,
.reference-name,
.reference-meta,
.history-meta,
.inspiration-card-body p,
.task-card p,
.task-card small {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.history-prompt {
  min-height: 62px;
  display: -webkit-box;
  overflow: hidden;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
}

.history-status-row {
  min-height: 28px;
}

.history-meta {
  min-height: 58px;
}

.history-actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  margin-top: auto;
}

.history-actions button {
  width: 100%;
}

.preview-zone {
  flex: 1;
  min-height: 610px;
  display: grid;
  align-items: start;
  justify-items: center;
  overflow: auto;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.64), rgba(245, 244, 240, 0.4)),
    repeating-linear-gradient(90deg, rgba(42, 42, 42, 0.018) 0 1px, transparent 1px 9px);
}

.compact-preview {
  min-height: 0;
  height: calc(100% - 72px);
}

.empty-state {
  align-self: center;
  max-width: 420px;
  text-align: center;
  color: var(--muted);
}

.empty-state h3 {
  color: var(--ink);
  font-size: 24px;
  margin-bottom: 8px;
}

.preview-orbit {
  margin: 0 auto 18px;
  animation: floatMark 2.4s ease-in-out infinite alternate;
}

@keyframes floatMark {
  from {
    transform: translateY(3px);
  }
  to {
    transform: translateY(-5px);
  }
}

.result-block img {
  max-width: 100%;
  max-height: 52vh;
  object-fit: contain;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--canvas-soft);
}

#resultImage {
  cursor: zoom-in;
}

#resultImage:hover {
  box-shadow: var(--shadow-soft);
}

.result-block {
  width: 100%;
  justify-items: center;
}

.task-board {
  padding: 18px;
  border-radius: var(--radius);
}

.task-board-head,
.history-status-row,
.task-title-row,
.image-preview-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.task-board-head {
  margin-bottom: 12px;
}

.task-board-head span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.task-list {
  flex: 1;
  min-height: 0;
  max-height: none;
  overflow: auto;
  padding-right: 4px;
}

.task-card {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 250, 0.52);
  cursor: pointer;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

.task-card:hover,
.task-card:focus-visible {
  border-color: var(--line-strong);
  box-shadow: var(--shadow-soft);
  transform: translateY(-1px);
  outline: none;
}

.task-content {
  min-width: 0;
}

.task-card .task-title-row {
  align-items: flex-start;
}

.task-card .task-title-row strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.task-card .task-title-row span {
  flex: none;
  white-space: nowrap;
  text-align: right;
}

.task-meta-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin: 4px 0 6px;
}

.task-quality,
.task-wait-note {
  min-height: 24px;
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 3px 8px;
  font-size: 12px;
  font-weight: 800;
  line-height: 1;
}

.task-quality-budget {
  color: var(--warning);
  border: 1px solid rgba(157, 122, 60, 0.22);
  background: rgba(157, 122, 60, 0.08);
}

.task-quality-premium {
  color: var(--green);
  border: 1px solid rgba(111, 134, 108, 0.24);
  background: rgba(111, 134, 108, 0.1);
}

.task-wait-note {
  color: var(--muted);
  border: 1px solid var(--line);
  background: rgba(255, 255, 250, 0.48);
}

.task-card p,
.task-card small {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
}

.task-card p {
  -webkit-line-clamp: 2;
}

.task-card small {
  -webkit-line-clamp: 2;
}

.task-thumb {
  width: 56px;
  height: 56px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--canvas-soft);
  padding: 0;
  color: inherit;
  cursor: inherit;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

.task-thumb-ready {
  cursor: inherit;
}

.task-thumb-ready:hover {
  border-color: var(--line-strong);
  box-shadow: var(--shadow-soft);
  transform: translateY(-1px);
}

.task-thumb img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.task-orb {
  width: 34px;
  height: 34px;
  border-radius: 12px;
  border: 1px solid rgba(42, 42, 42, 0.08);
  background: linear-gradient(135deg, #f5f4f0 0%, #d1cdc5 48%, #2a2a2a 100%);
  box-shadow: 0 10px 22px rgba(42, 42, 42, 0.18);
}

.task-thumb-busy .task-orb,
.task-card-busy .task-orb {
  animation: calmBreath 1.8s ease-in-out infinite alternate;
}

@keyframes calmBreath {
  from {
    opacity: 0.62;
    transform: scale(0.94);
  }
  to {
    opacity: 1;
    transform: scale(1.05);
  }
}

.task-timer {
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 800;
}

.task-card-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-start;
  gap: 8px;
  margin-top: 8px;
}

.task-restart-btn,
.task-delete-btn {
  min-height: 30px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 11px;
  color: var(--ink);
  background: rgba(255, 255, 250, 0.78);
  cursor: pointer;
  font-size: 12px;
  font-weight: 800;
}

.task-delete-btn {
  color: var(--danger);
}

.task-restart-btn:hover:not(:disabled),
.task-delete-btn:hover:not(:disabled) {
  border-color: var(--line-strong);
  box-shadow: var(--shadow-soft);
}

.task-restart-btn:disabled,
.task-delete-btn:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

.task-card-ok {
  border-color: rgba(111, 134, 108, 0.38);
}

.task-card-error {
  border-color: rgba(163, 91, 79, 0.4);
}

.error-banner {
  margin-bottom: 14px;
  border: 1px solid rgba(157, 122, 60, 0.36);
  border-radius: var(--radius);
  padding: 12px 14px;
  color: var(--warning);
  background: rgba(157, 122, 60, 0.08);
}

.response-box {
  max-height: 260px;
  overflow: auto;
  border-radius: var(--radius);
  padding: 16px;
  background: #2a2a2a;
  color: var(--canvas-soft);
}

.sticky-actions {
  position: sticky;
  bottom: -1px;
  padding-top: 10px;
  background: linear-gradient(to top, rgba(245, 244, 240, 0.98), rgba(245, 244, 240, 0.72), transparent);
}

.inspiration-layout {
  display: grid;
  grid-template-columns: minmax(300px, 0.42fr) minmax(0, 1fr);
  gap: 18px;
}

.inspiration-tabs {
  display: inline-grid;
  grid-template-columns: repeat(2, minmax(120px, 1fr));
  gap: 0;
  overflow: hidden;
  margin: 0 0 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 250, 0.56);
}

.inspiration-tabs button {
  min-height: 42px;
  border: 0;
  border-right: 1px solid var(--line);
  color: var(--ink-soft);
  background: transparent;
  cursor: pointer;
  font-weight: 900;
}

.inspiration-tabs button:last-child {
  border-right: 0;
}

.inspiration-tabs button.active {
  color: var(--ink);
  background: linear-gradient(180deg, rgba(189, 166, 128, 0.2), rgba(255, 255, 250, 0.76));
}

.inspiration-kind-panel.active {
  display: block;
}

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

.inspiration-form {
  align-self: start;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 250, 0.58);
}

.inspiration-card-media {
  aspect-ratio: 4 / 3;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-bottom: 1px solid var(--line);
  background:
    linear-gradient(135deg, rgba(255, 255, 250, 0.6), rgba(209, 205, 197, 0.42)),
    repeating-linear-gradient(90deg, rgba(42, 42, 42, 0.018) 0 1px, transparent 1px 9px);
}

.inspiration-card-media img,
.inspiration-card-media video {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
}

.inspiration-card-media span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.08em;
}

.video-inspiration-grid .inspiration-card-body {
  min-height: 220px;
}

.history-panel {
  margin-top: 0;
}

.settings-page-grid {
  grid-template-columns: 1fr;
  align-items: stretch;
  max-width: 1120px;
}

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

.model-settings-title {
  display: grid;
  gap: 4px;
}

.model-settings-title h3 {
  margin: 0;
  font-size: 18px;
}

.model-settings-title p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

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

.api-setting-card {
  display: grid;
  gap: 16px;
  align-content: start;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 250, 0.56);
}

.model-channel-box {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 250, 0.58);
}

.model-channel-box strong {
  font-size: 13px;
}

.model-channel-box .field {
  gap: 5px;
}

.model-channel-box .field span {
  font-size: 12px;
}

.api-setting-head {
  display: grid;
  gap: 6px;
}

.api-setting-card h3 {
  margin: 0;
  font-size: 18px;
  line-height: 1.3;
}

.api-setting-head small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.settings-save-card {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 180px;
  gap: 14px;
  align-items: center;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 250, 0.56);
}

.settings-save-note {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  line-height: 1.5;
}

.settings-endpoints {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.settings-endpoints span {
  min-height: 32px;
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0 10px;
  color: var(--muted);
  background: rgba(255, 255, 250, 0.72);
  font-size: 12px;
  font-weight: 800;
}

.settings-save-card .primary-btn {
  width: 100%;
  min-height: 48px;
}

.dialog-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(42, 42, 42, 0.36);
  backdrop-filter: blur(6px);
}

.dialog-card {
  width: min(520px, 100%);
  padding: 24px;
}

.image-preview-overlay {
  z-index: 60;
}

.image-preview-card {
  width: min(1120px, 94vw);
  max-height: 92vh;
  padding: 18px;
  display: grid;
  gap: 14px;
}

.image-preview-head h3,
.image-preview-head p {
  margin: 0;
}

.image-preview-head p {
  color: var(--muted);
  margin-top: 6px;
}

.image-preview-stage {
  position: relative;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: var(--radius);
  background: var(--canvas-soft);
}

.image-preview-stage img {
  width: 100%;
  max-height: 70vh;
  object-fit: contain;
}

.image-preview-nav {
  position: absolute;
  top: 50%;
  z-index: 2;
  width: 54px;
  height: 92px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  color: var(--ink);
  background: rgba(255, 255, 250, 0.86);
  box-shadow: var(--shadow-soft);
  cursor: pointer;
  font-size: 38px;
  font-weight: 900;
  line-height: 1;
  transform: translateY(-50%);
}

.image-preview-nav:hover {
  background: var(--paper-solid);
}

.image-preview-nav:disabled {
  cursor: not-allowed;
  opacity: 0.3;
}

.image-preview-nav-prev {
  left: 12px;
}

.image-preview-nav-next {
  right: 12px;
}

.image-preview-actions {
  justify-content: flex-end;
}

.license-gate {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(42, 42, 42, 0.42);
  backdrop-filter: blur(12px);
}

.license-card {
  width: min(520px, 100%);
  display: grid;
  gap: 16px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper-solid);
  box-shadow: var(--shadow);
}

.license-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.license-view-tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(42, 42, 42, 0.04);
}

.license-view-tabs button {
  min-height: 38px;
  border: 1px solid transparent;
  border-radius: calc(var(--radius) - 2px);
  color: var(--muted);
  background: transparent;
  font-weight: 900;
}

.license-view-tabs button.active {
  border-color: var(--line);
  color: var(--ink);
  background: var(--paper-solid);
  box-shadow: 0 8px 20px rgba(42, 42, 42, 0.06);
}

.license-form {
  display: none;
  gap: 12px;
}

.license-form.active {
  display: grid;
}

.license-actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.license-actions.single-action {
  grid-template-columns: 1fr;
}

.license-form .primary-btn {
  min-height: 48px;
}

.license-form .text-btn {
  justify-self: center;
}

.license-message {
  min-height: 20px;
  margin: 0;
  color: var(--danger);
  font-size: 13px;
  line-height: 1.5;
}

.license-note {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}

.video-page.active-page {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 16px;
  height: calc(100vh - 120px);
  overflow: hidden;
}

.video-page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

.video-page-head h2 {
  margin: 4px 0 6px;
  font-size: 34px;
  line-height: 1.08;
}

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

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

.video-workspace {
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(360px, 0.9fr) minmax(480px, 1.18fr) minmax(320px, 0.86fr);
  gap: 18px;
}

.video-create-panel,
.video-preview-panel,
.video-task-panel {
  min-height: 0;
  overflow: hidden;
}

.video-create-panel,
.video-preview-panel {
  display: flex;
  flex-direction: column;
}

.video-create-panel {
  gap: 10px;
  overflow: auto;
}

.video-preview-panel {
  overflow: auto;
}

.video-task-panel {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.video-mode-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.video-compact-layout {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  align-items: start;
}

.video-picker-card {
  display: grid;
  gap: 8px;
}

.video-picker-card-mode {
  min-height: 0;
}

.video-duration-card {
  display: grid;
}

.video-picker-trigger {
  min-height: 58px;
  display: grid;
  grid-template-columns: auto 1fr 14px;
  align-items: center;
  gap: 10px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink);
  background: rgba(255, 255, 250, 0.62);
  cursor: pointer;
  text-align: left;
  transition: border-color 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
}

.video-picker-trigger span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.video-picker-trigger strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 16px;
}

.video-picker-trigger i {
  width: 10px;
  height: 10px;
  border-right: 2px solid var(--ink-soft);
  border-bottom: 2px solid var(--ink-soft);
  transform: rotate(45deg) translateY(-1px);
  transition: transform 0.16s ease;
}

.video-picker-trigger.active,
.video-picker-trigger:hover {
  border-color: rgba(157, 122, 60, 0.4);
  background: rgba(255, 255, 250, 0.88);
  box-shadow: var(--shadow-soft);
}

.video-picker-trigger.active i {
  transform: rotate(-135deg) translateX(-1px);
}

.video-picker-panel {
  display: grid;
  gap: 8px;
}

.video-mode-card {
  min-height: 56px;
  display: grid;
  place-items: center;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink-soft);
  background: rgba(255, 255, 250, 0.56);
  cursor: pointer;
  transition: border-color 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
}

.video-mode-card span {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--warning);
  font-weight: 900;
}

.video-mode-card strong {
  font-size: 12px;
  white-space: nowrap;
}

.video-mode-grid .video-mode-card.hidden {
  display: none !important;
}

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

.video-mode-card.active,
.video-mode-card:hover {
  border-color: rgba(157, 122, 60, 0.46);
  background: rgba(255, 255, 250, 0.86);
  box-shadow: var(--shadow-soft);
}

.video-prompt-field {
  position: relative;
}

.video-prompt-field textarea {
  min-height: 92px;
  resize: none;
}

.video-prompt-field small {
  position: absolute;
  right: 12px;
  bottom: 10px;
}

.video-param-stack {
  display: grid;
  gap: 9px;
}

.video-control-label,
.video-upload-head span {
  display: block;
  margin-bottom: 7px;
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 900;
}

.video-segment-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(72px, 1fr));
  gap: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 250, 0.52);
}

.video-segment-row button {
  min-height: 40px;
  border: 0;
  border-right: 1px solid var(--line);
  color: var(--ink-soft);
  background: transparent;
  cursor: pointer;
  font-weight: 800;
}

.video-segment-row button:last-child {
  border-right: 0;
}

.video-segment-row button.active {
  color: var(--ink);
  background: linear-gradient(180deg, rgba(189, 166, 128, 0.22), rgba(255, 255, 250, 0.76));
  box-shadow: inset 0 0 0 1px rgba(157, 122, 60, 0.28);
}

.video-ratio-row {
  grid-template-columns: repeat(6, minmax(0, 1fr));
}

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

.video-toggle {
  min-height: 54px;
  position: relative;
  display: grid;
  align-content: center;
  gap: 3px;
  padding: 10px 48px 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 250, 0.56);
}

.video-toggle span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.video-toggle strong {
  font-size: 13px;
}

.video-toggle input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.video-toggle i {
  position: absolute;
  right: 12px;
  top: 50%;
  width: 34px;
  height: 20px;
  border-radius: 999px;
  background: var(--sand);
  transform: translateY(-50%);
}

.video-toggle i::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 14px;
  height: 14px;
  border-radius: 999px;
  background: var(--paper-solid);
  box-shadow: 0 2px 6px rgba(42, 42, 42, 0.16);
  transition: transform 0.16s ease;
}

.video-toggle input:checked + i {
  background: #b79a69;
}

.video-toggle input:checked + i::after {
  transform: translateX(14px);
}

.video-upload-board {
  display: grid;
  gap: 8px;
  padding-top: 4px;
  border-top: 1px solid var(--line);
}

.video-upload-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.video-upload-head strong {
  color: var(--ink);
}

.video-upload-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
}

.video-frame-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.video-frame-card {
  position: relative;
  min-height: 196px;
  padding: 8px;
  align-content: start;
  transform: rotate(var(--frame-tilt, 0deg));
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.video-frame-card:first-child {
  --frame-tilt: -3deg;
}

.video-frame-card:last-child {
  --frame-tilt: 2.5deg;
}

.video-frame-card:hover {
  transform: rotate(0deg) translateY(-2px);
}

.video-frame-preview {
  width: 100%;
  height: 118px;
  overflow: hidden;
  border-radius: 12px;
  border: 3px solid rgba(255, 255, 250, 0.96);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.84), rgba(209, 205, 197, 0.58)),
    repeating-linear-gradient(90deg, rgba(42, 42, 42, 0.018) 0 1px, transparent 1px 9px);
  position: relative;
  box-shadow: 0 10px 22px rgba(42, 42, 42, 0.1);
}

.video-frame-preview img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
  object-position: center;
}

.video-frame-preview span {
  position: absolute;
  inset: 50% auto auto 50%;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(42, 42, 42, 0.18);
  border-radius: 999px;
  color: transparent;
  background: rgba(255, 255, 250, 0.9);
  transform: translate(-50%, -50%);
  box-shadow: 0 8px 18px rgba(42, 42, 42, 0.08);
}

.video-frame-preview span::before,
.video-frame-preview span::after {
  content: "";
  position: absolute;
  inset: 50% auto auto 50%;
  width: 16px;
  height: 2px;
  background: var(--ink-soft);
  transform: translate(-50%, -50%);
}

.video-frame-preview span::after {
  transform: translate(-50%, -50%) rotate(90deg);
}

.video-frame-card strong,
.video-frame-card small {
  width: 100%;
  text-align: left;
  padding: 0 2px;
}

.video-frame-remove {
  position: absolute;
  top: -8px;
  right: -8px;
  z-index: 2;
  width: 28px;
  height: 28px;
  border: 1px solid rgba(42, 42, 42, 0.22);
  border-radius: 999px;
  color: var(--ink);
  background: rgba(255, 255, 250, 0.98);
  box-shadow: 0 6px 14px rgba(42, 42, 42, 0.14);
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
}

.video-frame-remove:hover {
  background: #fff;
}

.video-frame-card.filled {
  border-color: rgba(42, 42, 42, 0.22);
  background: rgba(255, 255, 250, 0.92);
  box-shadow: 0 14px 28px rgba(42, 42, 42, 0.12);
}

.video-multimodal-board {
  display: grid;
  gap: 8px;
}

.video-asset-id-panel {
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 250, 0.58);
}

.video-asset-id-row {
  display: grid;
  grid-template-columns: minmax(120px, 0.8fr) minmax(180px, 1.2fr) auto;
  gap: 8px;
  align-items: end;
}

.video-asset-id-row label {
  display: grid;
  gap: 5px;
}

.video-asset-id-row span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.video-asset-id-row input {
  min-height: 38px;
}

.video-asset-id-row button,
.video-prompt-asset-hints button {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink);
  background: rgba(255, 255, 250, 0.9);
  font-weight: 900;
  cursor: pointer;
}

.video-asset-id-row button {
  padding: 0 14px;
}

.video-prompt-asset-hints {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.video-prompt-asset-hints.hidden {
  display: none;
}

.video-prompt-asset-hints button {
  min-height: 30px;
  padding: 0 10px;
  color: var(--accent-strong);
}

.video-material-stack {
  display: flex;
  align-items: flex-end;
  min-height: 132px;
  padding: 8px 4px 6px;
  overflow-x: auto;
  overflow-y: visible;
}

.video-material-stack.hidden {
  display: none;
}

.video-material-card {
  position: relative;
  flex: 0 0 92px;
  width: 92px;
  height: 122px;
  margin-left: -18px;
  padding: 4px;
  border: 1px solid rgba(42, 42, 42, 0.18);
  border-radius: 12px;
  background: rgba(255, 255, 250, 0.96);
  box-shadow: 0 10px 24px rgba(42, 42, 42, 0.12);
  transform: rotate(var(--card-tilt, -4deg));
}

.video-material-card:first-child {
  margin-left: 0;
}

.video-material-card:nth-child(even) {
  transform: rotate(var(--card-tilt, 3deg)) translateY(4px);
}

.video-material-card:nth-child(3n) {
  transform: rotate(var(--card-tilt, -2deg)) translateY(2px);
}

.video-material-card-media {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  border-radius: 10px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.84), rgba(209, 205, 197, 0.58)),
    repeating-linear-gradient(90deg, rgba(42, 42, 42, 0.018) 0 1px, transparent 1px 9px);
}

.video-material-card-media img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.video-material-card-badge,
.video-material-card-duration,
.video-material-card-name {
  position: absolute;
  z-index: 1;
  color: #fff;
  background: rgba(26, 26, 26, 0.72);
  backdrop-filter: blur(4px);
}

.video-material-card-badge {
  top: 6px;
  left: 6px;
  min-height: 22px;
  display: inline-flex;
  align-items: center;
  padding: 0 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.04em;
}

.video-material-card-duration {
  right: 6px;
  bottom: 30px;
  min-height: 22px;
  display: inline-flex;
  align-items: center;
  padding: 0 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 900;
}

.video-material-card-name {
  left: 6px;
  right: 6px;
  bottom: 6px;
  padding: 5px 8px;
  border-radius: 8px;
  font-size: 11px;
  font-weight: 800;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.video-material-card-token {
  position: absolute;
  inset: 50% auto auto 50%;
  max-width: calc(100% - 14px);
  padding: 5px 8px;
  border-radius: 999px;
  color: var(--ink);
  background: rgba(255, 255, 250, 0.9);
  font-size: 11px;
  font-weight: 900;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transform: translate(-50%, -50%);
}

.video-material-card-remove {
  position: absolute;
  top: -8px;
  right: -8px;
  z-index: 2;
  width: 28px;
  height: 28px;
  border: 1px solid rgba(42, 42, 42, 0.22);
  border-radius: 999px;
  color: var(--ink);
  background: rgba(255, 255, 250, 0.98);
  box-shadow: 0 6px 14px rgba(42, 42, 42, 0.14);
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
}

.video-material-card-remove:hover {
  background: #fff;
}

.video-material-card-audio .video-material-card-media {
  display: grid;
  place-items: center;
}

.video-material-card-audio .video-material-card-media::before {
  content: "♪";
  color: rgba(42, 42, 42, 0.56);
  font-size: 40px;
  font-weight: 900;
}

.video-upload-card {
  min-height: 76px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 4px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink);
  background: rgba(255, 255, 250, 0.54);
  cursor: pointer;
}

.video-upload-card input {
  display: none;
}

.video-upload-card-wide {
  min-height: 82px;
}

.video-upload-card span {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: transparent;
  position: relative;
}

.video-upload-card span::before,
.video-upload-card span::after {
  content: "";
  position: absolute;
  inset: 50% auto auto 50%;
  width: 12px;
  height: 2px;
  background: var(--ink-soft);
  transform: translate(-50%, -50%);
}

.video-upload-card span::after {
  transform: translate(-50%, -50%) rotate(90deg);
}

.video-upload-card strong {
  font-size: 12px;
  text-align: center;
}

.video-upload-card small {
  font-size: 11px;
  text-align: center;
}

.video-text-note {
  display: grid;
  gap: 3px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 250, 0.5);
}

.video-text-note span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

.video-material-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.video-material-metrics div {
  display: grid;
  gap: 2px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 250, 0.5);
}

.video-material-metrics span,
.video-material-metrics small {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.3;
}

.video-tip {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.65;
}

.compact-tip {
  line-height: 1.45;
}

.video-duration-stepper {
  min-height: 58px;
  display: grid;
  grid-template-columns: 42px minmax(64px, 1fr) 42px;
  align-items: center;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 250, 0.52);
}

.video-duration-stepper button {
  height: 100%;
  border: 0;
  color: var(--ink);
  background: transparent;
  cursor: pointer;
  font-weight: 900;
}

.video-duration-stepper strong {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  border-left: 1px solid var(--line);
  border-right: 1px solid var(--line);
  white-space: nowrap;
  font-size: 18px;
  font-weight: 900;
}

.video-player-shell {
  flex: 1;
  min-height: 0;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 10px;
  overflow: hidden;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.56), rgba(245, 244, 240, 0.72)),
    repeating-linear-gradient(90deg, rgba(42, 42, 42, 0.018) 0 1px, transparent 1px 9px);
}

.video-player-shell.has-video-result {
  grid-template-rows: minmax(0, 1fr);
  align-content: stretch;
  gap: 0;
}

.video-result-frame {
  width: 100%;
  height: 100%;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding: 10px;
}

.video-empty-mark {
  width: 96px;
  height: 96px;
  opacity: 0.2;
  background: url("/assets/pangu-logo.png") center / contain no-repeat;
}

.video-player-shell h3,
.video-player-shell p {
  margin: 0;
  text-align: center;
}

.video-player-shell p {
  color: var(--muted);
}

.video-player-controls {
  width: min(420px, 100%);
  display: grid;
  grid-template-columns: 22px auto 1fr;
  align-items: center;
  gap: 12px;
  margin-top: 16px;
  color: var(--muted);
}

.video-player-controls span {
  width: 0;
  height: 0;
  border-left: 12px solid var(--ink-soft);
  border-top: 8px solid transparent;
  border-bottom: 8px solid transparent;
}

.video-player-controls i {
  height: 4px;
  border-radius: 999px;
  background: var(--sand);
}

.video-primary-actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0;
  margin-top: 14px;
}

.video-summary-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0;
  margin-top: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 250, 0.56);
}

.video-summary-row div {
  min-height: 64px;
  display: grid;
  align-content: center;
  gap: 3px;
  padding: 10px 14px;
  border-right: 1px solid var(--line);
}

.video-summary-row div:last-child {
  border-right: 0;
}

.video-summary-row span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.video-task-panel {
  padding: 18px;
}

.video-task-list {
  flex: 1;
  display: grid;
  align-content: start;
  gap: 12px;
  overflow: auto;
  overflow-x: hidden;
  min-height: 0;
  max-height: none;
  padding-right: 4px;
}

.video-task-card {
  display: grid;
  grid-template-columns: 68px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 250, 0.54);
  cursor: pointer;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

.video-task-card:hover,
.video-task-card:focus-visible {
  border-color: var(--line-strong);
  box-shadow: var(--shadow-soft);
  transform: translateY(-1px);
  outline: none;
}

.video-task-thumb {
  width: 68px;
  height: 88px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background:
    linear-gradient(135deg, rgba(255, 255, 250, 0.48), rgba(209, 205, 197, 0.55)),
    radial-gradient(circle at 48% 50%, rgba(255, 255, 250, 0.74), transparent 30%);
  position: relative;
}

.video-task-thumb video {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
  border-radius: inherit;
  background: #111;
}

.video-task-thumb::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-35%, -50%);
  border-left: 16px solid rgba(42, 42, 42, 0.24);
  border-top: 11px solid transparent;
  border-bottom: 11px solid transparent;
}

.video-task-content {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.video-task-title {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
}

.video-task-title strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.video-task-title span {
  flex: none;
  min-height: 22px;
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 0 9px;
  font-size: 12px;
  font-weight: 900;
  background: rgba(209, 220, 228, 0.42);
}

.video-task-meta-row {
  margin: 2px 0 4px;
}

.video-task-meta-row .task-quality,
.video-task-meta-row .task-wait-note {
  min-height: 22px;
  font-size: 11px;
}

.video-task-card.ok .video-task-title span {
  color: var(--green);
  background: var(--green-soft);
}

.video-task-card.error .video-task-title span {
  color: var(--danger);
  background: rgba(163, 91, 79, 0.08);
}

.video-task-content p,
.video-task-content small,
.video-task-content em {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  margin: 0;
  color: var(--muted);
  font-style: normal;
  font-size: 12px;
  line-height: 1.45;
}

.video-task-content p {
  -webkit-line-clamp: 2;
}

.video-task-content small,
.video-task-content em {
  -webkit-line-clamp: 1;
}

.video-progress {
  display: none;
}

.video-progress i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: #b79a69;
}

.video-task-card.error .video-progress i {
  background: var(--danger);
}

.video-task-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 4px;
}

.video-task-actions button {
  min-height: 30px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0 12px;
  color: var(--ink);
  background: rgba(255, 255, 250, 0.74);
  cursor: pointer;
  font-weight: 800;
}

.video-result-player {
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 100%;
  display: block;
  object-fit: contain;
  border-radius: var(--radius);
  background: #111;
}

@media (max-width: 1380px) {
  .workspace-grid {
    grid-template-columns: minmax(340px, 0.9fr) minmax(480px, 1.3fr) minmax(270px, 0.72fr);
  }

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

  .video-workspace {
    grid-template-columns: minmax(340px, 0.95fr) minmax(440px, 1.05fr) minmax(300px, 0.82fr);
  }

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

  .video-compact-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 1180px) {
  .main-shell {
    height: auto;
    overflow: visible;
  }

  .workspace-grid,
  .workspace-grid.active-page,
  .app-page.active-page,
  .inspiration-layout,
  .team-hero-band,
  .team-layout {
    grid-template-columns: 1fr;
    height: auto;
    overflow: visible;
  }

  .workspace-grid > .panel,
  .workspace-grid > .task-board {
    height: auto;
    overflow: visible;
  }

  .compact-preview {
    min-height: 520px;
    height: auto;
  }

  .settings-page-grid {
    grid-template-columns: 1fr;
  }

  .model-settings-grid {
    grid-template-columns: 1fr;
  }

  .api-setting-card,
  .settings-save-card {
    grid-template-columns: 1fr;
  }

  .video-page.active-page,
  .video-workspace {
    display: grid;
    grid-template-columns: 1fr;
    height: auto;
    overflow: visible;
  }

  .video-task-list {
    max-height: none;
  }

  .video-asset-id-row {
    grid-template-columns: 1fr;
  }

  .team-branch {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
  }

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

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

  .top-actions {
    justify-content: flex-start;
  }

  .image-page-head,
  .video-page-head,
  .team-page-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .image-status-row,
  .video-status-row,
  .team-status-row {
    justify-content: flex-start;
  }

  .parameter-grid,
  .upload-stats,
  .info-grid,
    .settings-page-grid,
    .settings-save-card,
    .inspiration-mini-grid,
  .team-metric-grid,
  .team-child-list {
    grid-template-columns: 1fr;
  }

  .team-mini-row,
  .team-branch-parent {
    align-items: flex-start;
    flex-direction: column;
  }

  .inline-input-action {
    grid-template-columns: 1fr;
  }

  .inline-input-action .secondary-btn {
    width: 100%;
  }
}

/* Cascade lock for the approved 2026-05 UI direction. */
body {
  color: var(--ui-text);
  background:
    linear-gradient(90deg, rgba(31, 35, 32, 0.015) 1px, transparent 1px),
    linear-gradient(rgba(31, 35, 32, 0.012) 1px, transparent 1px),
    linear-gradient(135deg, #fbfaf7 0%, #f1eee7 100%);
  background-size: 20px 20px, 20px 20px, auto;
}

.app-shell {
  grid-template-columns: 224px minmax(0, 1fr);
}

.main-shell {
  height: 100vh;
  overflow: hidden;
  padding: 0;
}

.sidebar {
  padding: 22px 18px 16px;
  gap: 22px;
  background: rgba(250, 249, 245, 0.92);
}

.brand {
  grid-template-columns: 44px minmax(0, 1fr);
}

.brand-mark {
  width: 44px;
  height: 44px;
}

.brand span {
  display: none;
}

.side-nav a {
  min-height: 46px;
  gap: 10px;
  padding: 0 14px;
  font-weight: 800;
}

.side-nav a::before {
  width: 24px;
  color: var(--ui-muted);
  font-size: 18px;
  text-align: center;
}

.side-nav a:nth-child(1)::before { content: "AI"; font-size: 12px; font-weight: 900; }
.side-nav a:nth-child(2)::before { content: "▭"; }
.side-nav a:nth-child(3)::before { content: "○"; }
.side-nav a:nth-child(4)::before { content: "♢"; }
.side-nav a:nth-child(5)::before { content: "◎"; }
.side-nav a:nth-child(6)::before { content: "↺"; }
.side-nav a:nth-child(7)::before { content: "◌"; }

.side-nav a.active,
.side-nav a:hover {
  color: var(--ui-green);
  border-color: rgba(47, 108, 67, 0.12);
  background: linear-gradient(180deg, rgba(237, 245, 237, 0.92), rgba(255, 255, 252, 0.72));
}

.topbar {
  height: 80px;
  align-items: center;
  flex-direction: row;
  margin: 0;
  padding: 0 28px;
  border-bottom: 1px solid var(--ui-border);
  background: rgba(255, 255, 252, 0.84);
  backdrop-filter: blur(18px);
}

.topbar h1 {
  margin: 0;
  color: var(--ui-text);
  font-size: 30px;
  letter-spacing: 0;
  line-height: 1.1;
}

.topbar #openStorageFolderBtn,
.topbar #openVideoStorageFolderBtn {
  display: none;
}

.top-actions {
  justify-content: flex-end;
  gap: 12px;
}

.user-avatar {
  width: 42px;
  height: 42px;
  border: 1px solid var(--ui-border);
  border-radius: 50%;
  background:
    radial-gradient(circle at 50% 34%, #f4d7c8 0 18%, transparent 19%),
    radial-gradient(circle at 50% 104%, #1f2722 0 38%, transparent 39%),
    linear-gradient(180deg, #ece4dc, #c8c1b8);
  box-shadow: var(--shadow-soft);
}

.status-pill {
  min-height: 40px;
  padding: 0 16px;
  border-radius: 999px;
  color: var(--ui-green);
  border-color: rgba(47, 108, 67, 0.16);
  background: rgba(255, 255, 252, 0.84);
  font-weight: 900;
}

.status-pill.ok {
  background: var(--ui-green-soft);
}

.status-pill.error {
  color: var(--ui-red);
  background: var(--ui-red-soft);
}

.glass-btn,
.secondary-btn,
.primary-btn,
.text-btn,
.chip-btn,
.history-actions button,
.remove-file-btn,
.inspiration-actions button {
  min-height: 40px;
  border-color: var(--ui-border-strong);
  border-radius: 8px;
  color: var(--ui-text);
  background: rgba(255, 255, 252, 0.82);
}

.primary-btn {
  border-color: rgba(47, 108, 67, 0.38);
  color: #fff;
  background: linear-gradient(180deg, #4f855b, #2f6c43);
  box-shadow: 0 10px 22px rgba(47, 108, 67, 0.18);
}

.app-page.active-page,
.workspace-grid.active-page,
.video-page.active-page {
  height: calc(100vh - 80px);
}

.workspace-grid.active-page {
  display: grid;
  grid-template-columns: minmax(390px, 0.92fr) minmax(520px, 1.32fr) minmax(340px, 0.82fr);
  grid-template-rows: minmax(0, 1fr);
  gap: 12px;
  padding: 12px 14px 16px;
  overflow: hidden;
}

.image-page-head,
.video-page-head {
  display: none !important;
}

.panel,
.task-board,
.history-card,
.inspiration-card,
.dialog-card,
.image-preview-card,
.metric-card {
  border-color: var(--ui-border);
  background: var(--ui-surface);
  box-shadow: 0 10px 30px rgba(31, 35, 32, 0.045);
}

.workspace-grid > .panel,
.workspace-grid > .task-board,
.video-create-panel,
.video-preview-panel,
.video-task-panel {
  height: 100%;
  min-height: 0;
}

.create-panel,
.video-create-panel {
  overflow: auto !important;
}

.compact-form {
  display: flex;
  flex-direction: column;
  min-height: 100%;
  gap: 18px;
}

.compact-form > .field-wide:first-child {
  order: 1;
}

#referenceUploadSection {
  order: 2;
}

.parameter-grid {
  order: 3;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.parameter-grid .field:last-child {
  grid-column: 1 / -1;
}

.sticky-actions {
  order: 4;
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  margin-top: auto;
}

.sticky-actions .primary-btn,
.video-primary-actions .primary-btn {
  width: 100%;
  min-height: 52px;
  font-size: 18px;
}

#clearFormBtn {
  display: none;
}

.action-summary {
  margin: 0;
  color: var(--ui-muted);
  font-size: 14px;
  font-weight: 800;
  text-align: center;
}

.create-panel textarea,
.video-prompt-field textarea {
  min-height: 126px;
  resize: none;
}

.dropzone.has-reference-files {
  min-height: 160px;
  padding: 8px 6px 10px;
  border-color: transparent;
  background: transparent;
}

.dropzone.has-reference-files > strong,
.dropzone.has-reference-files > p {
  display: none;
}

.dropzone.has-reference-files .reference-material-stack {
  min-height: 142px;
  max-height: 154px;
  margin-top: 0;
  padding: 12px 8px;
}

.reference-material-stack {
  align-items: flex-end;
}

.reference-thumb-card {
  flex-basis: 112px;
  width: 112px;
  min-height: 136px;
  padding: 5px;
  border: 1px solid rgba(31, 35, 32, 0.18);
  border-radius: 12px;
  background: #fffefa;
  box-shadow: 0 12px 24px rgba(31, 35, 32, 0.16);
  transform: rotate(var(--card-tilt, -3deg)) translateY(var(--card-rise, 0));
}

.reference-thumb-card + .reference-thumb-card {
  margin-left: -32px;
}

.reference-thumb-card:hover,
.reference-thumb-card:focus-within {
  z-index: 10;
  transform: rotate(0deg) translateY(-7px);
}

.reference-card-media {
  height: 126px;
  aspect-ratio: auto;
  border-radius: 10px;
}

.reference-add-card {
  flex-basis: 98px;
  width: 98px;
  min-height: 136px;
  margin-left: 8px;
}

.preview-zone,
.video-player-shell {
  border-color: var(--ui-border);
  background:
    linear-gradient(90deg, rgba(31, 35, 32, 0.018) 1px, transparent 1px),
    linear-gradient(rgba(31, 35, 32, 0.014) 1px, transparent 1px),
    rgba(255, 255, 252, 0.58);
  background-size: 18px 18px, 18px 18px, auto;
}

.compact-preview {
  height: calc(100% - 52px);
  padding: 0;
}

.empty-state h3,
.video-player-shell h3 {
  font-size: 26px;
}

.task-card {
  grid-template-columns: 76px minmax(0, 1fr);
  padding: 14px;
}

.task-card,
.video-task-card {
  border-radius: 8px;
  border-color: var(--ui-border);
  background: rgba(255, 255, 252, 0.72);
}

.task-card-actions,
.video-task-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.video-page.active-page {
  display: grid;
  grid-template-rows: minmax(0, 1fr);
  gap: 0;
  padding: 12px 14px 16px;
  overflow: hidden;
}

.video-workspace {
  grid-template-columns: minmax(390px, 0.92fr) minmax(520px, 1.32fr) minmax(340px, 0.82fr);
  gap: 12px;
}

.video-compact-layout,
.video-param-stack {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.video-toggle-grid.hidden {
  display: grid !important;
}

.video-toggle-grid {
  grid-column: 1 / -1;
  grid-template-columns: 1fr;
}

.video-toggle:nth-child(n + 2) {
  display: none;
}

.video-upload-board {
  padding-top: 0;
  border-top: 0;
}

.video-primary-actions {
  display: grid;
  gap: 8px;
  margin-top: auto;
}

.video-preview-panel .video-primary-actions {
  display: none;
}

.video-player-shell {
  min-height: 0;
  aspect-ratio: 16 / 10;
}

.team-page.active-page,
.account-page.active-page,
.history-panel.active-page,
.settings-page.active-page {
  padding: 16px 20px;
}

.team-page-head {
  align-items: center;
  justify-content: flex-end;
  margin-bottom: 14px;
}

.team-page-head > div:first-child {
  display: none;
}

.team-hero-band {
  grid-template-columns: minmax(280px, 0.5fr) minmax(0, 1.5fr);
  padding: 22px;
  background: var(--ui-surface);
}

.team-metric-grid {
  grid-template-columns: repeat(6, minmax(0, 1fr));
}

.account-hero-band .team-metric-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.team-metric {
  min-height: 98px;
  padding: 16px;
  background: rgba(255, 255, 252, 0.62);
}

.team-metric strong {
  font-size: 24px;
}

.team-branch {
  grid-template-columns: minmax(360px, 0.95fr) minmax(0, 1.05fr);
  padding: 0;
  overflow: hidden;
}

.history-panel,
.settings-page {
  border: 0;
  background: transparent;
  box-shadow: none;
}

.history-panel > .panel-head,
.settings-page > .panel-head {
  align-items: center;
  padding: 18px;
  border: 1px solid var(--ui-border);
  border-radius: 8px;
  background: var(--ui-surface);
  box-shadow: 0 10px 30px rgba(31, 35, 32, 0.045);
}

.history-selection-chip {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  border: 1px solid rgba(47, 108, 67, 0.18);
  border-radius: 8px;
  padding: 0 16px;
  color: var(--ui-green);
  background: var(--ui-green-soft);
  font-weight: 900;
}

.history-filter-row {
  display: grid;
  grid-template-columns: auto minmax(260px, 1fr) 160px;
  gap: 12px;
  align-items: center;
  margin: 12px 0 18px;
}

.history-tabs {
  display: flex;
  overflow: hidden;
  border: 1px solid var(--ui-border);
  border-radius: 8px;
  background: var(--ui-surface);
}

.history-tabs button {
  min-height: 44px;
  border: 0;
  border-right: 1px solid var(--ui-border);
  padding: 0 22px;
  color: var(--ui-text);
  background: transparent;
  cursor: pointer;
  font-weight: 800;
}

.history-tabs button.active {
  color: var(--ui-green);
  background: var(--ui-green-soft);
}

.history-search {
  position: relative;
  display: block;
}

.history-search span {
  position: absolute;
  color: transparent;
}

.history-search input {
  min-height: 44px;
  padding-left: 42px;
}

.history-search::before {
  content: "⌕";
  position: absolute;
  left: 16px;
  top: 50%;
  z-index: 1;
  color: var(--ui-muted);
  transform: translateY(-50%);
}

.history-sort {
  min-height: 44px;
}

.history-grid {
  display: block;
  column-width: 280px;
  column-gap: 14px;
  margin-top: 0;
}

.history-card {
  width: 100%;
  display: inline-block;
  break-inside: avoid;
  overflow: hidden;
  margin: 0 0 14px;
  vertical-align: top;
}

.history-media-shell {
  position: relative;
  overflow: hidden;
  background: #f2f1ec;
}

.history-media-shell img,
.history-media-shell video,
.history-placeholder {
  width: 100%;
  height: auto;
  display: block;
  aspect-ratio: auto;
  object-fit: contain;
}

.history-placeholder {
  min-height: 180px;
  display: grid;
  place-items: center;
}

.history-play-badge {
  position: absolute;
  inset: 50% auto auto 50%;
  width: 54px;
  height: 54px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  background: rgba(31, 35, 32, 0.68);
  transform: translate(-50%, -50%);
}

.history-media-tags {
  position: absolute;
  inset: 10px 10px auto auto;
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
  max-width: calc(100% - 58px);
}

.history-select-control {
  min-width: 28px;
  min-height: 28px;
  padding: 0;
}

.history-select-control span {
  display: none;
}

.history-prompt,
.history-meta {
  min-height: 0;
}

.history-prompt {
  -webkit-line-clamp: 2;
}

.history-actions {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0;
  border-top: 1px solid var(--ui-border);
}

.history-actions button {
  min-height: 38px;
  border: 0;
  border-right: 1px solid var(--ui-border);
  border-radius: 0;
  background: transparent;
  font-size: 12px;
}

.settings-page-grid {
  max-width: none;
  grid-template-columns: minmax(0, 1fr) 330px;
  gap: 14px;
}

.settings-main-column {
  display: grid;
  gap: 14px;
  min-width: 0;
}

.settings-tabs {
  display: flex;
  overflow: hidden;
  border: 1px solid var(--ui-border);
  border-radius: 8px;
  background: var(--ui-surface);
}

.settings-tabs button {
  min-height: 48px;
  border: 0;
  border-right: 1px solid var(--ui-border);
  padding: 0 28px;
  background: transparent;
  cursor: pointer;
  font-weight: 900;
}

.settings-tabs button.active {
  color: var(--ui-green);
  background: var(--ui-green-soft);
}

.model-settings-section,
.settings-summary-panel,
.local-save-section {
  padding: 18px;
  border: 1px solid var(--ui-border);
  border-radius: 8px;
  background: var(--ui-surface);
  box-shadow: 0 10px 30px rgba(31, 35, 32, 0.045);
}

.model-settings-grid {
  grid-template-columns: 1fr;
  gap: 12px;
}

.api-setting-card {
  grid-template-columns: 230px minmax(0, 1fr);
  gap: 16px;
  padding: 16px;
  background: rgba(255, 255, 252, 0.66);
}

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

.model-channel-box {
  padding: 14px;
  border-radius: 8px;
  background: rgba(255, 255, 252, 0.72);
}

.model-channel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.api-setting-badges,
.model-capability-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.api-setting-badges span,
.model-channel-head span,
.model-capability-row span {
  min-height: 24px;
  display: inline-flex;
  align-items: center;
  border: 1px solid rgba(47, 108, 67, 0.14);
  border-radius: 999px;
  padding: 0 8px;
  color: var(--ui-green);
  background: var(--ui-green-soft);
  font-size: 11px;
  font-weight: 900;
}

.model-capability-row {
  grid-column: 2;
}

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

.folder-picker-card {
  min-height: 78px;
  display: grid;
  gap: 6px;
  padding: 14px;
  border: 1px solid var(--ui-border);
  border-radius: 8px;
  color: var(--ui-text);
  background: rgba(255, 255, 252, 0.66);
  cursor: pointer;
  text-align: left;
}

.settings-summary-panel {
  display: grid;
  align-content: start;
  gap: 16px;
}

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

.settings-summary-grid div,
.settings-current-box {
  display: grid;
  gap: 6px;
  padding: 14px;
  border: 1px solid var(--ui-border);
  border-radius: 8px;
  background: rgba(255, 255, 252, 0.66);
}

.settings-check-list {
  display: grid;
  gap: 10px;
}

.settings-check-list span {
  display: flex;
  justify-content: space-between;
  color: var(--ui-muted);
  font-size: 13px;
  font-weight: 800;
}

.settings-check-list strong {
  color: var(--ui-green);
}

.settings-security-note {
  margin: 0;
  padding: 14px;
  border: 1px solid rgba(166, 116, 34, 0.2);
  border-radius: 8px;
  color: var(--ui-amber);
  background: rgba(166, 116, 34, 0.08);
  font-size: 13px;
  line-height: 1.6;
}

.settings-save-card {
  grid-column: 1 / -1;
}

@media (max-width: 1320px) {
  .workspace-grid.active-page,
  .video-workspace {
    grid-template-columns: minmax(360px, 0.94fr) minmax(430px, 1.1fr) minmax(300px, 0.8fr);
  }

  .settings-page-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .app-shell,
  .workspace-grid.active-page,
  .video-workspace,
  .team-hero-band,
  .team-layout,
  .account-layout,
  .settings-page-grid,
  .history-filter-row,
  .api-setting-card,
  .model-channel-grid,
  .local-save-section {
    grid-template-columns: 1fr;
  }

  .main-shell,
  .app-page.active-page,
  .workspace-grid.active-page,
  .video-page.active-page {
    height: auto;
    overflow: visible;
  }

  .topbar {
    height: auto;
    align-items: flex-start;
    flex-direction: column;
    padding: 18px;
  }
}

.api-setting-card {
  cursor: pointer;
}

.api-setting-card:not(.settings-card-expanded) {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
}

.api-setting-card:not(.settings-card-expanded) .api-setting-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.api-setting-card:not(.settings-card-expanded) .model-channel-grid,
.api-setting-card:not(.settings-card-expanded) .model-capability-row {
  display: none;
}

.api-setting-card.settings-card-expanded {
  cursor: default;
}

.api-setting-card.settings-card-expanded .api-setting-head {
  cursor: pointer;
}

.settings-recommend-box {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid rgba(47, 108, 67, 0.18);
  border-radius: 8px;
  background: rgba(237, 245, 237, 0.58);
}

.settings-recommend-box summary {
  cursor: pointer;
  color: var(--ui-green);
  font-size: 14px;
  font-weight: 900;
  list-style: none;
}

.settings-recommend-box summary::-webkit-details-marker {
  display: none;
}

.settings-recommend-box summary::after {
  content: "+";
  float: right;
  color: var(--ui-muted);
}

.settings-recommend-box[open] summary::after {
  content: "-";
}

.settings-recommend-box div {
  display: grid;
  gap: 8px;
  padding-top: 10px;
  border-top: 1px solid rgba(47, 108, 67, 0.12);
}

.settings-recommend-box p {
  margin: 0;
  color: var(--ui-muted);
  font-size: 13px;
  line-height: 1.6;
  word-break: break-word;
}

.settings-recommend-box strong {
  color: var(--ui-text);
}

.video-ratio-row {
  grid-template-columns: repeat(3, minmax(64px, 1fr));
  gap: 8px;
  overflow: visible;
  border: 0;
  background: transparent;
}

.video-ratio-row button {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 250, 0.62);
  white-space: nowrap;
}

.video-ratio-row button:last-child {
  border-right: 1px solid var(--line);
}
.video-create-panel .video-prompt-field {
  order: 1;
}

.video-create-panel .video-upload-board {
  order: 2;
  padding-top: 0;
  border-top: 0;
}

.video-create-panel .video-compact-layout {
  order: 3;
}

.video-create-panel .video-param-stack {
  order: 4;
}

.video-create-panel .video-primary-actions {
  order: 9;
  margin-top: auto;
}

.video-multimodal-board .video-upload-card-wide.hidden {
  display: none;
}

.video-material-stack {
  align-items: center;
  min-height: 150px;
  gap: 14px;
  padding: 10px 4px 14px;
}

.video-material-card {
  flex-basis: 108px;
  width: 108px;
  height: 142px;
  margin-left: 0;
  border-radius: 16px;
}

.video-material-add-card {
  flex: 0 0 104px;
  width: 104px;
  height: 142px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 8px;
  border: 2px dashed rgba(42, 42, 42, 0.72);
  border-radius: 16px;
  color: var(--ink);
  background: rgba(255, 255, 250, 0.42);
  cursor: pointer;
  font-weight: 900;
}

.video-material-add-card span {
  width: 48px;
  height: 48px;
  position: relative;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: var(--ink);
}

.video-material-add-card span::before,
.video-material-add-card span::after {
  content: "";
  position: absolute;
  width: 14px;
  height: 2px;
  border-radius: 999px;
  background: rgba(255, 255, 250, 0.88);
}

.video-material-add-card span::after {
  transform: rotate(90deg);
}

.video-material-add-card strong {
  font-size: 20px;
  line-height: 1;
}

.video-material-add-card small {
  color: var(--muted);
  font-size: 16px;
}

.video-prompt-field .video-prompt-asset-hints {
  position: absolute;
  left: 14px;
  bottom: 42px;
  z-index: 20;
  width: min(260px, calc(100% - 28px));
  display: grid;
  gap: 4px;
  padding: 8px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  color: rgba(255, 255, 255, 0.92);
  background: rgba(29, 32, 36, 0.94);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.22);
}

.video-prompt-field .video-prompt-asset-hints.hidden {
  display: none;
}

.video-prompt-field .video-prompt-asset-hints p {
  margin: 0;
  color: rgba(255, 255, 255, 0.44);
  font-size: 11px;
  font-weight: 800;
  line-height: 1.2;
  padding: 0 4px 2px;
}

.video-prompt-field .video-prompt-asset-hints button {
  width: 100%;
  min-height: 42px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border: 0;
  border-radius: 9px;
  color: rgba(255, 255, 255, 0.94);
  background: transparent;
  cursor: pointer;
  text-align: left;
}

.video-prompt-field .video-prompt-asset-hints button:hover {
  background: rgba(255, 255, 255, 0.08);
}

.video-prompt-field .video-prompt-asset-hints img,
.video-prompt-field .video-prompt-asset-hints button > span {
  width: 30px;
  height: 30px;
  flex: 0 0 30px;
  border-radius: 7px;
  object-fit: cover;
}

.video-prompt-field .video-prompt-asset-hints button > span {
  display: grid;
  place-items: center;
  color: rgba(255, 255, 255, 0.9);
  background: rgba(255, 255, 255, 0.1);
  font-size: 18px;
  font-weight: 300;
}

.video-prompt-field .video-prompt-asset-hints strong {
  font-size: 13px;
  line-height: 1.1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
