:root {
  --bg: #0a0f2a;
  --bg-2: #111734;
  --panel: rgba(35, 45, 74, 0.92);
  --panel-soft: rgba(28, 36, 62, 0.88);
  --line: rgba(53, 203, 255, 0.28);
  --line-strong: rgba(53, 203, 255, 0.72);
  --cyan: #1ce5ff;
  --pink: #ff4274;
  --violet: #7a64ff;
  --text: #eef3ff;
  --muted: #9ba8cf;
  --success: #5df9a5;
  --danger: #ff5c83;
  --shadow: 0 16px 36px rgba(0, 0, 0, 0.28);
  --radius: 18px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background:
    linear-gradient(rgba(42, 70, 131, 0.12) 1px, transparent 1px),
    linear-gradient(90deg, rgba(42, 70, 131, 0.12) 1px, transparent 1px),
    radial-gradient(circle at top, rgba(64, 94, 180, 0.24), transparent 34%),
    linear-gradient(180deg, #111633 0%, #090d24 100%);
  background-size: 32px 32px, 32px 32px, auto, auto;
}

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

.page-shell {
  min-height: 100vh;
  padding: 12px 16px 20px;
}

.boot-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.boot-card {
  color: var(--muted);
  font-size: 14px;
}

.auth-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.auth-card {
  width: min(420px, 100%);
  padding: 26px;
  display: grid;
  gap: 16px;
}

.auth-title {
  font-size: 28px;
  font-weight: 700;
}

.auth-subtitle {
  color: var(--muted);
}

.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.auth-tab {
  padding: 10px 14px;
  border: 0;
  border-radius: 12px;
  cursor: pointer;
  color: var(--text);
  background: rgba(51, 62, 94, 0.84);
}

.auth-tab.active {
  background: linear-gradient(135deg, #24e6ff, #188ecf);
  color: #071323;
  font-weight: 700;
}

.auth-field {
  display: grid;
  gap: 8px;
  color: #d5ddfa;
  font-weight: 600;
}

.auth-field input {
  width: 100%;
  padding: 14px 16px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  color: var(--text);
  background: rgba(26, 34, 58, 0.96);
  outline: none;
}

.password-change-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  padding: 24px;
}

.password-change-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(3, 7, 18, 0.78);
  backdrop-filter: blur(8px);
}

.password-change-card {
  position: relative;
  width: min(440px, 100%);
  display: grid;
  gap: 14px;
  padding: 24px;
  border: 1px solid rgba(53, 203, 255, 0.34);
  border-radius: 16px;
  background: rgba(16, 24, 48, 0.98);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.44);
}

.password-change-title {
  font-size: 22px;
  font-weight: 800;
}

.password-change-subtitle {
  color: var(--muted);
  line-height: 1.6;
}

.image-preview-modal {
  position: fixed;
  inset: 0;
  z-index: 990;
  display: grid;
  place-items: center;
  padding: 24px;
}

.image-preview-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(3, 7, 18, 0.78);
  backdrop-filter: blur(8px);
}

.image-preview-card {
  position: relative;
  width: min(80vw, 1280px);
  height: min(80vh, 900px);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 14px;
  padding: 16px;
  border: 1px solid rgba(53, 203, 255, 0.34);
  border-radius: 16px;
  background: rgba(16, 24, 48, 0.98);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.44);
}

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

.image-preview-title {
  font-size: 18px;
  font-weight: 800;
}

.image-preview-body {
  min-height: 0;
  display: grid;
  place-items: center;
  overflow: auto;
  border-radius: 12px;
  background: #0f172a;
}

.image-preview-body img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  background: #fff;
}

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

.header {
  height: 56px;
  padding: 0 24px;
  background: #0f172a;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  position: sticky;
  top: 0;
  z-index: 100;
  border: 1px solid rgba(255, 255, 255, 0.06);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.04), 0 8px 24px rgba(15, 23, 42, 0.18);
}

.header-left,
.header-right {
  display: flex;
  align-items: center;
  gap: 16px;
  height: 100%;
}

.logo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.2px;
  color: #fff;
  white-space: nowrap;
}

.logo::before {
  content: "";
  width: 22px;
  height: 22px;
  border-radius: 7px;
  background: linear-gradient(135deg, #3b82f6 0%, #6366f1 100%);
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.45);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 4px;
  height: 100%;
}

.nav-link {
  position: relative;
  padding: 0 14px;
  height: 100%;
  display: inline-flex;
  align-items: center;
  color: rgba(255, 255, 255, 0.62);
  font-size: 13.5px;
  font-weight: 500;
  text-decoration: none;
  transition: color 0.15s;
  white-space: nowrap;
}

.nav-link:hover,
.nav-link.active {
  color: #fff;
}

.nav-link.active {
  font-weight: 600;
}

.nav-link.active::after {
  content: "";
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: -1px;
  height: 2px;
  background: linear-gradient(90deg, #3b82f6, #6366f1);
  border-radius: 2px 2px 0 0;
}

.local-user-badge,
.btn-logout {
  display: inline-flex;
  align-items: center;
  height: 32px;
  padding: 0 12px;
  border-radius: 8px;
  font-size: 13px;
}

.local-user-badge {
  color: #dbeafe;
  background: rgba(37, 99, 235, 0.2);
  border: 1px solid rgba(147, 197, 253, 0.26);
}

.btn-logout {
  color: rgba(255, 255, 255, 0.78);
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.03);
  transition: all 0.15s;
}

.btn-logout:hover {
  background: rgba(255, 255, 255, 0.10);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.28);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 12px 18px;
  border: 1px solid rgba(92, 118, 210, 0.28);
  border-radius: 20px;
  background: rgba(16, 22, 49, 0.96);
  box-shadow: var(--shadow);
}

.brand-wrap,
.user-wrap,
.top-nav {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-wrap {
  flex-wrap: wrap;
}

.tool-nav {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.tool-nav a {
  color: rgba(226, 232, 240, 0.78);
  text-decoration: none;
  font-weight: 800;
  font-size: 13px;
  padding: 8px 11px;
  border: 1px solid rgba(148, 163, 184, 0.22);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
}

.tool-nav a:hover,
.tool-nav a.active {
  color: #ffffff;
  border-color: rgba(125, 211, 252, 0.46);
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.58), rgba(14, 165, 233, 0.34));
  box-shadow: 0 10px 24px rgba(37, 99, 235, 0.2);
}

.hidden-tool {
  display: none !important;
}

.brand {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: 1px;
}

.nav-pill,
.switch-tab,
.ghost-btn,
.danger-outline,
.logout-btn,
.danger-btn {
  border: 0;
  border-radius: 12px;
  cursor: pointer;
}

.nav-pill,
.switch-tab {
  padding: 10px 18px;
  background: rgba(51, 62, 94, 0.84);
  color: var(--text);
}

.nav-pill.active,
.switch-tab.active {
  background: linear-gradient(135deg, #24e6ff, #188ecf);
  color: #071323;
  font-weight: 700;
}

.switch-tab.disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.user-badge {
  padding: 10px 18px;
  border-radius: 999px;
  background: rgba(33, 48, 92, 0.96);
  color: var(--text);
}

.logout-btn,
.danger-btn {
  padding: 11px 18px;
  background: linear-gradient(135deg, #ff5f7f, #ff2f68);
  color: #fff;
  font-weight: 700;
}

.workspace {
  display: grid;
  grid-template-columns: 376px minmax(360px, 420px) minmax(0, 1fr);
  gap: 16px;
  margin-top: 16px;
  min-height: calc(100vh - 160px);
}

.left-panel,
.center-panel,
.right-panel {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.card {
  background: linear-gradient(180deg, rgba(39, 50, 81, 0.94), rgba(28, 36, 62, 0.9));
  border: 1px solid rgba(72, 118, 214, 0.24);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.panel,
.mode-card,
.upload-card,
.prompt-panel,
.result-panel,
.history-panel,
.queue-bar {
  padding: 16px;
}

.switch-card {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.field-card label,
.mode-card label {
  display: block;
  margin-bottom: 10px;
  color: #d5ddfa;
  font-weight: 600;
}

select,
textarea,
#quantityInput {
  width: 100%;
  padding: 14px 16px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  color: var(--text);
  background: rgba(26, 34, 58, 0.96);
  outline: none;
}

select:disabled,
textarea:disabled {
  opacity: 0.68;
}

textarea {
  resize: vertical;
  min-height: 108px;
}

.quantity-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  align-items: center;
}

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

.submit-btn {
  width: 100%;
  padding: 16px;
  border: 0;
  border-radius: 14px;
  cursor: pointer;
  background: linear-gradient(90deg, #3877ff, #8460ff);
  color: #fff;
  font-size: 18px;
  font-weight: 700;
}

.upload-card-header,
.result-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.upload-slots {
  display: grid;
  gap: 14px;
}

.upload-slot {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.upload-label {
  color: var(--muted);
  font-size: 14px;
}

.upload-dropzone {
  display: block;
  border: 1px dashed rgba(69, 155, 255, 0.42);
  border-radius: 16px;
  min-height: 154px;
  padding: 20px;
  background: rgba(39, 51, 85, 0.62);
  cursor: pointer;
}

.upload-dropzone.is-dragover {
  border-color: rgba(28, 229, 255, 0.85);
  background: rgba(43, 62, 106, 0.8);
}

.upload-dropzone input {
  display: none;
}

.upload-content {
  min-height: 112px;
  display: grid;
  place-items: center;
  gap: 12px;
  color: var(--muted);
  text-align: center;
}

.folder-icon {
  font-size: 40px;
}

.add-image-btn {
  padding: 10px 18px;
  border: 1px solid rgba(28, 229, 255, 0.55);
  border-radius: 999px;
  background: linear-gradient(135deg, rgba(28, 229, 255, 0.2), rgba(122, 100, 255, 0.28));
  color: var(--text);
  cursor: pointer;
}

.add-image-btn:hover {
  border-color: rgba(28, 229, 255, 0.8);
  background: linear-gradient(135deg, rgba(28, 229, 255, 0.28), rgba(122, 100, 255, 0.36));
}

.upload-preview {
  padding: 12px;
  border: 1px solid rgba(92, 118, 210, 0.24);
  border-radius: 16px;
  background: rgba(17, 25, 48, 0.72);
  display: grid;
  gap: 12px;
}

.upload-preview img {
  display: block;
  width: 100%;
  max-height: 228px;
  object-fit: contain;
  border-radius: 12px;
  background: rgba(8, 11, 26, 0.8);
}

.upload-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 10px;
  color: var(--muted);
  font-size: 13px;
}

.upload-preview-item + .upload-preview-item {
  padding-top: 12px;
  border-top: 1px solid rgba(92, 118, 210, 0.2);
}

.option-fields {
  display: grid;
  gap: 14px;
}

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

.option-field-label,
.dynamic-option-title {
  color: #d5ddfa;
  font-weight: 600;
}

.option-field input[type="text"] {
  width: 100%;
  padding: 14px 16px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  color: var(--text);
  background: rgba(26, 34, 58, 0.96);
  outline: none;
}

.option-range-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
}

.option-range-value {
  min-width: 32px;
  color: var(--cyan);
  text-align: right;
}

.option-checkbox-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.option-checkbox-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border: 1px solid rgba(92, 118, 210, 0.24);
  border-radius: 999px;
  background: rgba(17, 25, 48, 0.72);
  cursor: pointer;
}

.option-checkbox-item input {
  margin: 0;
}

.tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.tab-btn {
  padding: 12px 18px;
  background: transparent;
  color: var(--muted);
  border: 0;
  border-bottom: 2px solid transparent;
  cursor: pointer;
}

.tab-btn.active {
  color: var(--cyan);
  border-color: var(--cyan);
}

.tab-panel {
  display: none;
  min-height: 100%;
}

.tab-panel.active {
  display: block;
  height: 100%;
}

.prompt-preview {
  margin: 0;
  white-space: pre-wrap;
  line-height: 1.6;
  color: #dbe3ff;
}

.status-text {
  color: var(--cyan);
}

.result-grid {
  min-height: 420px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
}

.result-item,
.history-item {
  padding: 12px;
  border: 1px solid rgba(92, 118, 210, 0.2);
  border-radius: 14px;
  background: rgba(17, 25, 48, 0.72);
}

.result-item img,
.history-item img,
.history-item video {
  width: 100%;
  border-radius: 12px;
  object-fit: cover;
  background: rgba(7, 11, 28, 0.9);
}

.upload-preview video,
.upload-preview-item video {
  width: 100%;
  max-height: 180px;
  border-radius: 12px;
  background: rgba(7, 11, 28, 0.9);
}

.result-item img {
  height: 220px;
}

.result-item video {
  display: block;
  width: 100%;
  aspect-ratio: 9 / 16;
  max-height: 420px;
  border-radius: 12px;
  background: rgba(7, 11, 28, 0.9);
}

.video-result-item {
  max-width: 340px;
}

.host-script-panel {
  grid-column: 1 / -1;
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid rgba(92, 118, 210, 0.2);
  border-radius: 14px;
  background: rgba(17, 25, 48, 0.72);
}

.host-meta-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
}

.host-meta-grid > div {
  display: grid;
  gap: 4px;
  min-width: 0;
}

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

.host-meta-grid strong,
.host-background-note {
  color: var(--text);
  overflow-wrap: anywhere;
}

.host-script-text {
  margin: 0;
  padding: 12px;
  max-height: 220px;
  overflow: auto;
  white-space: pre-wrap;
  color: #dbe3ff;
  line-height: 1.6;
  border-radius: 12px;
  background: rgba(7, 11, 28, 0.55);
}

.clip-draft-panel {
  display: grid;
  gap: 16px;
}

.clip-result-panel {
  display: grid;
  gap: 12px;
}

.clip-result-videos {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 340px));
  gap: 14px;
}

.clip-agent-steps {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.clip-agent-steps span {
  padding: 8px 10px;
  border-radius: 999px;
  color: #dbe3ff;
  background: rgba(58, 88, 176, 0.36);
}

.clip-source-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}

.clip-source-card {
  display: grid;
  gap: 8px;
}

.clip-source-card video {
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 12px;
  background: rgba(7, 11, 28, 0.9);
}

.clip-editor {
  display: grid;
  gap: 12px;
}

.clip-editor-header,
.clip-segment-row {
  padding: 12px;
  border: 1px solid rgba(92, 118, 210, 0.2);
  border-radius: 12px;
  background: rgba(17, 25, 48, 0.72);
}

.clip-editor-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
}

.clip-segment-row {
  display: grid;
  grid-template-columns: 36px 120px 1.4fr 0.7fr 0.7fr 0.8fr;
  gap: 10px;
  align-items: end;
}

.clip-segment-index {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: rgba(58, 88, 176, 0.42);
}

.clip-segment-row label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
}

.clip-segment-row input {
  width: 100%;
}

.clip-segment-thumb {
  width: 120px;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: 10px;
  background: rgba(7, 11, 28, 0.9);
}

.clip-segment-note {
  grid-column: 2 / -1;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 12px;
}

.clip-segment-note strong {
  color: var(--cyan);
}

@media (max-width: 720px) {
  .clip-editor-header,
  .clip-segment-row {
    grid-template-columns: 1fr;
  }

  .clip-editor-header {
    display: grid;
  }

  .clip-segment-thumb {
    width: 100%;
  }

  .clip-segment-note {
    grid-column: 1;
  }
}

.history-item {
  display: grid;
  grid-template-columns: 96px 1fr;
  gap: 12px;
  align-items: start;
}

.history-item img {
  height: 96px;
}

.history-item video {
  height: 96px;
}

.history-list {
  min-height: 420px;
  display: grid;
  gap: 12px;
}

.inline-history-panel {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.history-list.compact {
  min-height: 120px;
  max-height: 360px;
  overflow: auto;
}

.history-list.compact .history-item {
  grid-template-columns: 72px 1fr;
}

.history-list.compact .history-item img,
.history-list.compact .history-item video,
.history-thumb-placeholder {
  width: 72px;
  height: 72px;
  border-radius: 10px;
  object-fit: cover;
}

.history-thumb-placeholder {
  display: grid;
  place-items: center;
  color: #64748b;
  background: #f1f5f9;
  border: 1px dashed #cbd5e1;
  font-size: 12px;
}

.history-pager {
  margin-top: 12px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  color: var(--muted);
  font-size: 13px;
}

.history-pager.compact {
  justify-content: space-between;
}

.history-pager button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.history-meta,
.result-meta {
  display: grid;
  gap: 8px;
}

.result-links {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 8px;
}

.link-btn {
  padding: 8px 10px;
  border: 0;
  border-radius: 10px;
  color: var(--text);
  text-decoration: none;
  background: rgba(58, 88, 176, 0.42);
  cursor: pointer;
}

.queue-bar {
  margin-top: 16px;
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 14px;
  align-items: center;
}

.queue-list {
  color: var(--muted);
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.queue-item {
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(17, 25, 48, 0.72);
  border: 1px solid rgba(92, 118, 210, 0.24);
  font-size: 13px;
}

.queue-item.running {
  color: var(--cyan);
}

.queue-item.success {
  color: var(--success);
}

.queue-item.failed {
  color: var(--danger);
}

.ghost-btn,
.danger-outline {
  padding: 10px 14px;
  background: rgba(33, 48, 92, 0.92);
  color: var(--text);
}

.danger-outline {
  background: rgba(255, 66, 116, 0.14);
  border: 1px solid rgba(255, 66, 116, 0.42);
  color: #ff88a8;
}

.small {
  padding: 8px 12px;
  font-size: 13px;
}

.empty-state {
  display: grid;
  place-items: center;
  color: var(--muted);
}

.hidden {
  display: none !important;
}

.error-box {
  margin-top: 12px;
  padding: 12px 14px;
  border-radius: 12px;
  background: rgba(255, 66, 116, 0.12);
  color: #ff9bb7;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 12px;
  background: rgba(58, 88, 176, 0.36);
  color: #cfe3ff;
}

@media (max-width: 1400px) {
  .workspace {
    grid-template-columns: 320px 360px minmax(0, 1fr);
  }
}

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

  .queue-bar {
    grid-template-columns: 1fr;
  }

  .header {
    height: auto;
    min-height: 56px;
    align-items: flex-start;
    flex-direction: column;
    padding: 12px 14px;
  }

  .header-left,
  .header-right,
  .nav-links {
    height: auto;
    flex-wrap: wrap;
  }

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

  .brand-wrap,
  .user-wrap {
    justify-content: space-between;
  }
}

/* =====================================================================
   AI生图工作台 · 统一浅色模板覆盖
   ===================================================================== */
:root {
  --bg: #f4f6fb;
  --bg-2: #eef2f7;
  --panel: #ffffff;
  --panel-soft: #f8fafc;
  --line: #e2e8f0;
  --line-strong: #cbd5e1;
  --cyan: #2563eb;
  --pink: #ef4444;
  --violet: #6366f1;
  --text: #0f172a;
  --muted: #64748b;
  --success: #10b981;
  --danger: #ef4444;
  --shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 8px 24px rgba(15, 23, 42, .06);
  --radius: 16px;
}

body {
  color: var(--text);
  background: var(--bg);
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI",
    "PingFang SC", "Microsoft YaHei", "Hiragino Sans GB",
    "Helvetica Neue", Arial, sans-serif;
  font-size: 14px;
  line-height: 1.5;
}

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

.page-shell {
  width: 100%;
  min-height: 100vh;
  padding: 0 0 24px;
  background: var(--bg);
}

.boot-shell {
  background: var(--bg);
}

.boot-card {
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  box-shadow: var(--shadow);
}

.auth-shell {
  background:
    radial-gradient(circle at top right, rgba(37, 99, 235, .10), transparent 34%),
    var(--bg);
}

.auth-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
}

.auth-title {
  color: var(--text);
  font-size: 24px;
}

.auth-subtitle,
.auth-field {
  color: var(--muted);
}

.auth-tab {
  color: #475569;
  background: #f1f5f9;
  border: 1px solid transparent;
}

.auth-tab.active {
  color: #fff;
  background: linear-gradient(135deg, #2563eb, #6366f1);
}

.auth-field input {
  color: var(--text);
  background: #fff;
  border-color: var(--line-strong);
}

.header {
  border: 0;
  border-bottom: 1px solid rgba(255, 255, 255, .06);
  border-radius: 0;
  background: #0f172a;
}

.workspace {
  width: min(1500px, calc(100vw - 32px));
  margin: 16px auto 0;
  display: grid;
  grid-template-columns: minmax(230px, 260px) minmax(320px, 390px) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
  min-height: auto;
}

.left-panel,
.center-panel,
.right-panel {
  gap: 12px;
}

.card {
  color: var(--text);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.panel,
.mode-card,
.upload-card,
.prompt-panel,
.result-panel,
.history-panel,
.queue-bar {
  padding: 14px;
}

.switch-card {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 10px;
  background: #fff;
}

.switch-tab,
.nav-pill {
  min-height: 38px;
  padding: 9px 12px;
  border: 1px solid transparent;
  border-radius: 10px;
  color: #475569;
  background: #f1f5f9;
  font-size: 13px;
  font-weight: 700;
}

.switch-tab.active,
.nav-pill.active {
  color: #fff;
  background: linear-gradient(135deg, #2563eb, #6366f1);
  box-shadow: 0 8px 18px rgba(37, 99, 235, .18);
}

.switch-tab.disabled {
  opacity: .55;
}

.field-card label,
.mode-card label,
.option-field-label,
.dynamic-option-title {
  margin-bottom: 8px;
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
}

select,
textarea,
#quantityInput,
.option-field input[type="text"],
.clip-segment-row input {
  width: 100%;
  padding: 11px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  color: var(--text);
  background: #fff;
  outline: none;
  font-size: 13px;
  transition: border-color .15s, box-shadow .15s;
}

select:focus,
textarea:focus,
#quantityInput:focus,
.option-field input[type="text"]:focus,
.clip-segment-row input:focus {
  border-color: rgba(37, 99, 235, .68);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .10);
}

select:disabled,
textarea:disabled {
  color: #94a3b8;
  background: #f8fafc;
}

textarea {
  min-height: 96px;
}

input[type="range"] {
  accent-color: #2563eb;
}

.submit-btn {
  min-height: 44px;
  padding: 12px 16px;
  border-radius: 12px;
  background: linear-gradient(90deg, #2563eb, #6366f1);
  color: #fff;
  font-size: 15px;
  box-shadow: 0 10px 22px rgba(37, 99, 235, .20);
}

.submit-btn:disabled {
  opacity: .68;
  cursor: wait;
}

.upload-card-header,
.result-toolbar {
  margin-bottom: 12px;
  color: var(--text);
  font-weight: 700;
}

.upload-card-header span,
.result-toolbar > div:first-child {
  min-width: 0;
}

.upload-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.upload-dropzone {
  min-height: 150px;
  padding: 18px;
  border: 1px dashed #bfdbfe;
  border-radius: 14px;
  background:
    linear-gradient(135deg, rgba(37, 99, 235, .05), transparent 44%),
    #fff;
}

.upload-dropzone:hover,
.upload-dropzone.is-dragover {
  border-color: rgba(37, 99, 235, .72);
  background:
    linear-gradient(135deg, rgba(37, 99, 235, .08), transparent 46%),
    #fff;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .10);
}

.upload-content {
  min-height: 108px;
  color: #475569;
}

.folder-icon {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  color: #2563eb;
  background: #eff6ff;
  font-size: 26px;
  line-height: 1;
}

.add-image-btn {
  padding: 8px 12px;
  border: 1px solid rgba(37, 99, 235, .30);
  border-radius: 999px;
  color: #1d4ed8;
  background: #eff6ff;
  font-size: 12px;
  font-weight: 700;
}

.add-image-btn:hover {
  color: #1e40af;
  border-color: rgba(37, 99, 235, .44);
  background: #dbeafe;
}

.upload-text {
  color: var(--muted);
  font-size: 12px;
}

.upload-preview {
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #f8fafc;
}

.upload-preview img,
.upload-preview video,
.upload-preview-item video,
.clip-source-card video,
.clip-segment-thumb,
.result-item img,
.history-item img,
.history-item video,
.result-item video {
  background: #f1f5f9;
}

.upload-preview img {
  max-height: 220px;
}

.upload-meta {
  color: var(--muted);
}

.upload-preview-item + .upload-preview-item {
  border-top-color: var(--line);
}

.upload-preview-item {
  position: relative;
}

.upload-preview .upload-remove-icon {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 24px;
  height: 24px;
  min-width: 24px;
  min-height: 24px;
  box-sizing: border-box;
  padding: 0;
  display: grid;
  place-items: center;
  border-radius: 999px;
  border: 1px solid rgba(244, 63, 94, .28);
  background: rgba(255, 255, 255, .94);
  color: #be123c;
  font-size: 17px;
  line-height: 1;
  box-shadow: 0 8px 20px rgba(15, 23, 42, .16);
  z-index: 2;
}

.upload-preview .upload-remove-icon:hover {
  background: #fff1f2;
  border-color: rgba(244, 63, 94, .52);
}

.option-checkbox-item {
  border-color: var(--line);
  background: #f8fafc;
  color: #334155;
}

.option-range-value {
  color: #2563eb;
  font-weight: 700;
}

.watermark-editor {
  display: grid;
  gap: 10px;
  padding-top: 6px;
}

.watermark-editor-title {
  color: var(--text);
  font-weight: 800;
}

.watermark-editor-empty,
.watermark-position-text {
  color: var(--muted);
  font-size: 12px;
}

.watermark-stage {
  position: relative;
  overflow: hidden;
  width: 100%;
  aspect-ratio: 1 / 1;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #f8fafc;
}

.watermark-base {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.watermark-overlay {
  position: absolute;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 42px;
  max-width: 80%;
  padding: 4px 6px;
  color: #fff;
  font-weight: 800;
  text-shadow: 0 1px 4px rgba(0, 0, 0, .45);
  transform: translate(-50%, -50%);
  cursor: grab;
  touch-action: none;
  user-select: none;
}

.watermark-overlay:active {
  cursor: grabbing;
}

.watermark-overlay img {
  width: 100%;
  max-height: 92px;
  object-fit: contain;
}

.watermark-overlay span {
  white-space: nowrap;
  font-size: clamp(12px, 2.4vw, 22px);
}

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

.tab-btn {
  padding: 12px 14px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.tab-btn.active {
  color: #2563eb;
  border-color: #2563eb;
}

.prompt-panel,
.result-panel,
.history-panel {
  min-height: 600px;
}

.prompt-preview,
.host-script-text {
  color: #334155;
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
}

.status-text {
  color: #2563eb;
  font-weight: 700;
}

.result-grid {
  min-height: 520px;
}

.result-item,
.history-item,
.host-script-panel,
.clip-editor-header,
.clip-segment-row {
  border-color: var(--line);
  background: #f8fafc;
}

.result-item img {
  height: 220px;
}

.video-result-item {
  max-width: 340px;
}

.host-meta-grid span,
.clip-editor-header,
.clip-segment-row label,
.clip-segment-note {
  color: var(--muted);
}

.host-meta-grid strong,
.host-background-note {
  color: var(--text);
}

.host-background-note {
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}

.clip-agent-steps span,
.clip-segment-index,
.badge,
.queue-item,
.link-btn {
  color: #1d4ed8;
  background: #eff6ff;
  border: 1px solid rgba(37, 99, 235, .18);
}

.clip-segment-note strong {
  color: #2563eb;
}

.history-list {
  min-height: 520px;
}

.result-links {
  gap: 8px;
}

.link-btn {
  text-decoration: none;
  font-size: 12px;
  font-weight: 700;
}

.queue-bar {
  width: min(1500px, calc(100vw - 32px));
  margin: 16px auto 0;
  grid-template-columns: auto 1fr auto;
  color: var(--text);
}

.queue-title {
  font-weight: 700;
}

.queue-list {
  color: var(--muted);
}

.queue-item.running {
  color: #2563eb;
  border-color: rgba(37, 99, 235, .30);
}

.queue-item.success {
  color: #047857;
  background: #ecfdf5;
  border-color: rgba(16, 185, 129, .24);
}

.queue-item.failed {
  color: #b91c1c;
  background: #fef2f2;
  border-color: rgba(239, 68, 68, .24);
}

.ghost-btn,
.danger-outline,
.danger-btn,
.logout-btn {
  border-radius: 9px;
  font-size: 12px;
  font-weight: 700;
}

.ghost-btn {
  color: #1d4ed8;
  background: #eff6ff;
  border: 1px solid rgba(37, 99, 235, .22);
}

.danger-outline {
  color: #be123c;
  background: #fff1f2;
  border: 1px solid rgba(244, 63, 94, .24);
}

.danger-btn,
.logout-btn {
  color: #fff;
  background: linear-gradient(135deg, #ef4444, #f43f5e);
}

.small {
  padding: 7px 10px;
}

.empty-state {
  color: var(--muted);
}

.error-box {
  color: #b91c1c;
  background: #fef2f2;
  border: 1px solid rgba(239, 68, 68, .20);
}

.hidden {
  display: none !important;
}

@media (max-width: 1400px) {
  .workspace {
    grid-template-columns: minmax(230px, 252px) minmax(300px, 360px) minmax(0, 1fr);
  }
}

@media (max-width: 1120px) {
  .workspace,
  .queue-bar {
    width: min(100% - 24px, 760px);
    grid-template-columns: 1fr;
  }

  .prompt-panel,
  .result-panel,
  .history-panel {
    min-height: 420px;
  }

  .result-grid,
  .history-list {
    min-height: 340px;
  }

  .header {
    padding: 12px 14px;
  }
}
