:root {
  --bg: #111315;
  --panel: #202322;
  --panel-2: #2a2d2c;
  --panel-3: #17191a;
  --line: #454a4a;
  --line-soft: #343938;
  --text: #f7faf8;
  --muted: #a8b0ae;
  --blue: #1688ff;
  --blue-2: #0e6bd8;
  --green: #28c76f;
  --amber: #ffb02e;
  --purple: #7b3ff2;
  --danger: #ff5f57;
  --radius: 8px;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.28);
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
}

body {
  margin: 0;
  color: var(--text);
  background: var(--bg);
  font-family: "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
  line-height: 1.5;
}

button,
input,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

a {
  color: inherit;
  text-decoration: none;
}

img {
  display: block;
  max-width: 100%;
}

[hidden] {
  display: none !important;
}

.workbench-app {
  min-height: 100vh;
  overflow: hidden;
}

body.member-locked {
  overflow: hidden;
}

body.member-locked .topbar,
body.member-locked .workbench-layout {
  display: none;
}

.login-gate {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 28px;
  background: #f3f6fa;
  color: #1f2937;
}

.login-gate-shell {
  display: grid;
  width: min(332px, 100%);
}

.login-gate-copy,
.login-gate-card {
  border: 1px solid #d8e5ef;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.97);
  box-shadow: 0 18px 46px rgba(15, 45, 73, 0.13);
}

.login-gate-copy {
  display: grid;
  align-content: center;
  gap: 16px;
  min-height: 460px;
  padding: 38px;
}

.login-gate-logo {
  width: 54px;
  height: 54px;
  border-radius: 10px;
}

.login-gate-copy span {
  color: #0789d4;
  font-size: 13px;
  font-weight: 900;
}

.login-gate-copy h1 {
  max-width: 620px;
  margin: 0;
  font-size: 38px;
  line-height: 1.15;
  color: #102033;
}

.login-gate-copy p {
  max-width: 560px;
  margin: 0;
  color: #5b7180;
  font-size: 15px;
}

.login-gate-points {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.login-gate-points b {
  min-width: 0;
  border: 1px solid #cde5f3;
  border-radius: var(--radius);
  padding: 10px;
  color: #164254;
  background: #f8fcff;
  font-size: 13px;
  text-align: center;
}

.login-gate-card {
  display: grid;
  align-content: start;
  justify-items: center;
  min-height: auto;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.login-gate-title {
  margin: 0;
  color: #1f2937;
  font-size: 28px;
  font-weight: 500;
  line-height: 1.25;
}

.login-gate-subtitle {
  margin: 6px 0 16px;
  color: #4b5563;
  font-size: 14px;
}

.gate-qr {
  width: 260px;
  height: 260px;
  margin-bottom: 52px;
  background-size: 230px 230px;
}

.gate-qr img {
  width: 230px;
  height: 230px;
}

.topbar,
.site-header {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 66px;
  padding: 0 14px;
  border-bottom: 1px solid var(--line);
  background: #242726;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 178px;
  flex: 0 0 auto;
}

.brand-mark {
  width: 44px;
  height: 44px;
  border-radius: 8px;
}

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  font-size: 22px;
  line-height: 1.1;
}

.brand small {
  color: #7ec4ff;
  font-size: 12px;
}

.top-tabs {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex: 1;
}

.top-tab,
.mode-button,
.support-link,
.member-chip,
.recharge-button,
.avatar-button,
.account-logout,
.stage-actions button,
.rail-button,
.module-pill,
.choice-pill,
.generate-button,
.batch-generate-button,
.auth-actions .btn {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--text);
  background: #262928;
}

.top-tab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 1 1 96px;
  min-height: 44px;
  min-width: 96px;
  max-width: 136px;
  padding: 0 12px;
  color: #cfd6d4;
  font-size: 15px;
  font-weight: 800;
  white-space: nowrap;
}

.top-tab.active {
  border-color: #2294ff;
  color: #fff;
  background: linear-gradient(180deg, #1688ff, #0f73df);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.18);
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
}

.mode-switch,
.account-switch {
  position: relative;
}

.mode-button,
.support-link,
.member-chip,
.recharge-button,
.avatar-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 38px;
  padding: 0 11px;
  white-space: nowrap;
  font-weight: 800;
}

.support-link {
  border-color: #0e4b7f;
  color: #75c3ff;
  font-size: 13px;
}

.member-chip {
  border-color: #5b5140;
  background: #1c1d1c;
}

.member-chip span {
  color: var(--amber);
  font-size: 12px;
}

.member-chip strong {
  font-size: 16px;
}

.recharge-button {
  border-color: #2d8bff;
  color: #fff;
  background: linear-gradient(180deg, #1688ff, #0f73df);
  font-size: 13px;
}

.recharge-button:disabled {
  cursor: default;
  opacity: 0.55;
}

.avatar-button img {
  width: 30px;
  height: 30px;
  border-radius: 50%;
}

.account-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 55;
  display: grid;
  gap: 10px;
  width: 258px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px;
  color: var(--text);
  background: #252827;
  box-shadow: var(--shadow);
}

.account-menu-head {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
}

.account-menu-head img {
  width: 38px;
  height: 38px;
  border-radius: 9px;
}

.account-menu-head span,
.account-menu-stat span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.account-menu-head strong,
.account-menu-stat strong {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-menu-stat {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  padding: 10px;
  background: #171a19;
}

.account-menu-stat strong {
  color: var(--amber);
  font-size: 18px;
}

.account-logout {
  min-height: 36px;
  border-color: rgba(255, 95, 87, 0.44);
  color: #ffd5d2;
  background: rgba(255, 95, 87, 0.12);
  font-size: 13px;
  font-weight: 900;
}

.account-logout:hover {
  border-color: var(--danger);
  color: #fff;
  background: var(--danger);
}

.mode-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 50;
  width: 180px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px;
  background: #252827;
  box-shadow: var(--shadow);
}

.mode-menu button {
  display: grid;
  grid-template-columns: 1fr;
  width: 100%;
  border: 0;
  border-radius: 8px;
  padding: 10px 12px;
  color: var(--text);
  background: transparent;
  text-align: left;
  font-weight: 800;
}

.mode-menu button:hover {
  background: #383d3b;
}

.mode-menu span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 400;
}

.workbench-layout {
  display: grid;
  grid-template-columns: 116px minmax(344px, 372px) minmax(0, 1fr);
  gap: 14px;
  height: calc(100vh - 66px);
  padding: 8px;
}

.function-rail,
.settings-column,
.stage-panel {
  min-height: 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.03);
}

.function-rail {
  display: grid;
  align-content: start;
  gap: 8px;
  padding: 12px 10px;
  overflow: auto;
}

.rail-button {
  display: grid;
  gap: 5px;
  min-height: 58px;
  padding: 8px 7px;
  color: #c9d0ce;
  background: #303331;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.04);
}

.rail-button strong {
  font-size: 14px;
}

.rail-button span {
  color: var(--muted);
  font-size: 10px;
}

.rail-button.active {
  border-color: #1e9aff;
  color: #fff;
  background: radial-gradient(circle at 50% 10%, #28a6ff, #096bd1);
}

.rail-button.active span {
  color: #dff2ff;
}

.settings-column {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.settings-head {
  padding: 12px 14px 8px;
  border-bottom: 1px solid var(--line-soft);
}

.settings-head span,
.stage-toolbar span {
  color: #82c8ff;
  font-size: 11px;
  font-weight: 800;
}

.settings-head h1 {
  margin: 3px 0 5px;
  font-size: 18px;
  line-height: 1.12;
}

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

.settings-title-row h1 {
  min-width: 0;
  margin-right: auto;
}

.batch-mode-switch {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 28px;
  flex: 0 0 auto;
  color: #eaf5ff;
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}

.batch-mode-switch.is-on {
  color: #1688ff;
}

.batch-mode-switch input {
  appearance: none;
  position: relative;
  width: 38px;
  height: 20px;
  border: 1px solid #56605d;
  border-radius: 999px;
  background: #303432;
  transition: background 160ms ease, border-color 160ms ease;
}

.batch-mode-switch input::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #dce6e2;
  transition: transform 160ms ease, background 160ms ease;
}

.batch-mode-switch input:checked {
  border-color: #1688ff;
  background: #1688ff !important;
  box-shadow: 0 0 0 3px rgba(22, 136, 255, 0.16);
}

.batch-mode-switch input:checked::after {
  transform: translateX(18px);
  background: #fff;
}

.batch-mode-switch input:disabled {
  cursor: default;
  opacity: 0.55;
}

.settings-head p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.module-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  padding: 10px 14px;
  overflow: visible;
  border-bottom: 1px solid var(--line-soft);
}

.module-pill {
  display: grid;
  gap: 2px;
  min-width: 0;
  min-height: 36px;
  align-content: center;
  padding: 7px 8px;
  text-align: left;
  background: #2b2e2d;
}

.module-pill strong {
  font-size: 12px;
  white-space: nowrap;
}

.module-pill span {
  max-width: 160px;
  overflow: hidden;
  color: var(--muted);
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.source-panel,
.history-sidebar,
.function-rail,
.result-grid,
.history-grid {
  scrollbar-color: #6d7471 transparent;
  scrollbar-width: thin;
}

.source-panel::-webkit-scrollbar,
.history-sidebar::-webkit-scrollbar,
.function-rail::-webkit-scrollbar,
.result-grid::-webkit-scrollbar,
.history-grid::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

.source-panel::-webkit-scrollbar-thumb,
.history-sidebar::-webkit-scrollbar-thumb,
.function-rail::-webkit-scrollbar-thumb,
.result-grid::-webkit-scrollbar-thumb,
.history-grid::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: #626966;
}

.module-pill.active {
  border-color: var(--blue);
  background: #0f75dc;
}

.module-pill.active span {
  color: #dbefff;
}

.source-panel,
.history-sidebar {
  display: grid;
  gap: 10px;
  padding: 12px 14px;
  overflow: auto;
}

.upload-section {
  padding: 10px 14px;
  border-bottom: 1px solid var(--line-soft);
}

.upload-zone {
  display: grid;
  place-items: center;
  min-height: 68px;
  border: 2px dashed #5b6260;
  border-radius: 10px;
  padding: 10px;
  color: #d8e4e0;
  background: #202321;
  text-align: center;
}

.upload-zone.is-dragging {
  border-color: var(--blue);
  background: #172d3f;
}

.upload-zone input {
  display: none;
}

.upload-zone span {
  font-size: 14px;
  font-weight: 900;
}

.upload-zone small {
  max-width: 260px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
}

.prompt-box {
  display: grid;
  gap: 6px;
}

.prompt-box span,
.parameter-group strong {
  color: #e9f1ee;
  font-size: 12px;
  font-weight: 900;
}

.prompt-box textarea {
  width: 100%;
  min-height: 88px;
  resize: vertical;
  border: 1px solid #49504e;
  border-radius: 8px;
  padding: 10px;
  color: var(--text);
  background: #171918;
}

.parameter-input {
  width: 100%;
  min-height: 32px;
  border: 1px solid #49504e;
  border-radius: 8px;
  padding: 0 10px;
  color: var(--text);
  background: #171918;
  font-size: 12px;
}

.parameter-panel {
  display: grid;
  gap: 10px;
}

.parameter-group {
  display: grid;
  gap: 6px;
}

.choice-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.choice-pill {
  min-height: 30px;
  padding: 0 10px;
  color: #d0d8d5;
  background: #2b2f2d;
  font-size: 12px;
}

.choice-pill.active {
  border-color: #ffd13c;
  color: #211b03;
  background: #ffd13c;
}

.generate-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 8px;
}

.generate-button,
.batch-generate-button {
  min-height: 40px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 900;
}

.generate-button {
  border-color: #1688ff;
  color: #fff;
  background: linear-gradient(180deg, #1897ff, #0875dd);
}

.batch-generate-button {
  min-width: 94px;
  border-color: #4f5a58;
  color: #dce7e3;
  background: #303432;
}

.generate-button:disabled,
.batch-generate-button:disabled {
  cursor: default;
  opacity: 0.65;
}

.cost-line {
  margin: 0;
  color: var(--amber);
  font-size: 12px;
}

.history-sidebar h2 {
  margin: 0;
}

.history-sidebar p {
  margin: 0;
  color: var(--muted);
}

.stage-panel {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: #121414;
}

body.static-page-active .workbench-layout {
  display: block;
  height: calc(100vh - 66px);
  padding: 0;
}

body.static-page-active .function-rail,
body.static-page-active .settings-column,
body.static-page-active .stage-toolbar,
body.static-page-active .task-status,
body.static-page-active .result-grid,
body.static-page-active .history-grid {
  display: none;
}

body.static-page-active .stage-panel {
  width: 100%;
  height: 100%;
  border: 0;
  border-radius: 0;
  background: #fff;
  box-shadow: none;
}

body.static-page-active .tutorial-stage {
  display: block;
  width: 100%;
  height: 100%;
  padding: 0;
  overflow: hidden;
  background: #fff;
}

.embedded-page-frame {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
  background: #fff;
}

.stage-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 52px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--line);
  background: #191b1b;
}

.stage-toolbar strong {
  display: block;
  margin-top: 2px;
  font-size: 14px;
}

.stage-actions {
  display: flex;
  gap: 8px;
}

.stage-actions button {
  min-height: 32px;
  padding: 0 10px;
  color: #d6dcda;
  background: #262929;
  font-size: 12px;
}

.result-stage {
  position: relative;
  display: grid;
  place-items: center;
  min-height: clamp(360px, 54vh, 620px);
  flex: 1 1 auto;
  border-bottom: 1px solid var(--line);
  background: #111313;
  padding: 18px;
}

.empty-state {
  display: grid;
  justify-items: center;
  gap: 12px;
  color: #f7fbfa;
  text-align: center;
}

.empty-icon {
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  border: 4px solid #858b89;
  color: #858b89;
  font-size: 13px;
  font-weight: 900;
}

.empty-state p {
  max-width: 540px;
  margin: 0;
  color: var(--muted);
}

.compare-preview {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  width: 100%;
  height: 100%;
  min-height: 0;
}

.compare-pane {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  min-width: 0;
  min-height: 0;
  border: 1px solid #343939;
  border-radius: var(--radius);
  overflow: hidden;
  background: #171a19;
}

.compare-pane header {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  padding: 0 12px;
  border-bottom: 1px solid #343939;
  background: #202322;
}

.compare-pane header span {
  font-size: 13px;
  font-weight: 900;
}

.compare-pane header small {
  min-width: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.compare-canvas {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 0;
  overflow: hidden;
  padding: 14px;
  touch-action: none;
  user-select: none;
  background:
    linear-gradient(45deg, rgba(255, 255, 255, 0.035) 25%, transparent 25%) 0 0 / 28px 28px,
    linear-gradient(45deg, transparent 75%, rgba(255, 255, 255, 0.035) 75%) 0 0 / 28px 28px,
    #101211;
}

.compare-canvas.is-panning {
  cursor: grabbing;
}

.preview-tools {
  display: flex;
  align-items: center;
  gap: 4px;
}

.preview-download-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  border-radius: 7px;
  padding: 0 12px;
  color: #fff;
  background: linear-gradient(180deg, #1897ff, #0875dd);
  font-size: 12px;
  font-weight: 900;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.16);
}

.preview-download-button:hover {
  background: linear-gradient(180deg, #2aa4ff, #0c7ee8);
}

.preview-tools button {
  display: grid;
  place-items: center;
  min-width: 26px;
  height: 24px;
  border: 1px solid #49504e;
  border-radius: 5px;
  color: #dce5e2;
  background: #2a2e2c;
  font-size: 12px;
  font-weight: 900;
}

.preview-tools button:hover {
  border-color: var(--blue);
  color: #ffffff;
  background: #0f75dc;
}

.compare-placeholder {
  display: grid;
  justify-items: center;
  gap: 7px;
  color: #edf4f1;
  text-align: center;
}

.compare-placeholder span {
  font-weight: 900;
}

.compare-placeholder small {
  max-width: 280px;
  color: var(--muted);
}

.preview-image {
  max-width: 100%;
  max-height: 100%;
  border-radius: 8px;
  object-fit: contain;
  pointer-events: none;
  transform-origin: center center;
  transition: transform 120ms ease;
  will-change: transform;
  box-shadow: var(--shadow);
}

.task-status {
  min-height: 40px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  background: #1c1f1e;
  font-size: 13px;
}

.result-grid,
.history-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(112px, 128px));
  gap: 8px;
  max-height: 126px;
  overflow: auto;
  padding: 10px 14px;
  background: #171919;
}

.result-grid {
  align-content: start;
  border-bottom: 1px solid var(--line);
}

body.history-page-active .history-grid {
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  align-content: start;
  max-height: none;
  flex: 1;
}

body.current-task-list-active .history-grid {
  grid-template-columns: repeat(auto-fill, minmax(190px, 220px));
  max-height: 178px;
}

body.current-task-list-active .history-grid .task-card {
  grid-template-columns: 44px minmax(0, 1fr) auto;
  gap: 7px;
  min-height: 62px;
  padding: 7px;
}

body.current-task-list-active .history-grid .task-actions {
  grid-column: auto;
  flex-direction: column;
  gap: 4px;
  justify-content: center;
}

body.current-task-list-active .history-grid .task-actions button,
body.current-task-list-active .history-grid .task-actions a {
  min-height: 22px;
  padding: 0 7px;
  font-size: 11px;
}

body.current-task-list-active .history-grid .task-main small {
  display: none;
}

.task-list-title,
.history-pager {
  grid-column: 1 / -1;
}

.task-list-title {
  color: var(--text);
  font-size: 14px;
  font-weight: 900;
}

.result-card,
.task-card {
  border: 1px solid #343939;
  border-radius: var(--radius);
  overflow: hidden;
  background: #232625;
}

.history-grid .task-card {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  min-height: 66px;
}

.history-grid .task-card.empty {
  display: block;
  grid-column: 1 / -1;
}

.result-card img {
  width: 100%;
  height: 62px;
  object-fit: cover;
  background: #111;
}

.result-card div,
.task-card {
  padding: 8px;
}

.result-card strong,
.task-card h3 {
  display: block;
  margin: 0 0 4px;
  font-size: 12px;
  line-height: 1.25;
}

.result-card a,
.result-card button,
.task-card button,
.task-card a {
  border: 0;
  padding: 0;
  color: #87cfff;
  background: transparent;
  font-size: 12px;
  font-weight: 800;
}

.result-card div {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 4px 8px;
}

.result-card strong {
  grid-column: 1 / -1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.task-card span {
  color: var(--blue);
  font-size: 11px;
  font-weight: 900;
}

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

.task-card small {
  display: block;
  color: #d5ddda;
  font-size: 11px;
}

.task-thumb {
  position: relative;
  width: 44px;
  height: 44px;
  border: 1px solid #4a5350;
  border-radius: 7px;
  overflow: hidden;
  background: #111615;
}

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

.task-thumb span {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
}

.task-thumb i {
  position: absolute;
  right: 4px;
  bottom: 4px;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.72);
  border-top-color: #1688ff;
  border-radius: 50%;
  background: rgba(17, 22, 21, 0.62);
  animation: task-spin 820ms linear infinite;
}

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

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

.task-main h3,
.task-main p,
.task-main small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.task-actions {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: flex-end;
  flex: 0 0 auto;
}

.task-actions button,
.task-actions a {
  min-height: 26px;
  border: 1px solid #3d7197;
  border-radius: 7px;
  padding: 0 8px;
  background: #17334a;
}

.task-actions a {
  color: #fff;
  background: #0f75dc;
}

.history-grid .history-record-card {
  display: block;
  min-height: 0;
  padding: 0;
}

.history-record-preview {
  display: grid;
  place-items: center;
  width: 100%;
  aspect-ratio: 4 / 3;
  border-bottom: 1px solid #343939;
  background:
    linear-gradient(45deg, rgba(255, 255, 255, 0.035) 25%, transparent 25%) 0 0 / 24px 24px,
    linear-gradient(45deg, transparent 75%, rgba(255, 255, 255, 0.035) 75%) 0 0 / 24px 24px,
    #111615;
}

.history-record-preview img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.history-record-preview span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.history-record-body {
  display: grid;
  gap: 5px;
  padding: 10px;
}

.history-record-body span {
  color: var(--blue);
  font-size: 12px;
  font-weight: 900;
}

.history-record-body p,
.history-record-body small {
  margin: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.history-record-body .task-actions {
  grid-column: auto;
  justify-content: flex-start;
  margin-top: 4px;
}

.history-pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 8px 0 2px;
}

.history-pager button {
  min-height: 32px;
  border: 1px solid #3d7197;
  border-radius: 7px;
  padding: 0 14px;
  color: #87cfff;
  background: #17334a;
  font-size: 13px;
  font-weight: 900;
}

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

.history-pager span {
  color: var(--muted);
  font-size: 13px;
}

.tutorial-stage {
  display: grid;
  align-content: start;
  justify-items: start;
  gap: 16px;
  min-height: 0;
  flex: 1;
  overflow: auto;
  padding: 18px;
  border-bottom: 1px solid var(--line);
  background: #111313;
}

.auth-modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(15, 23, 42, 0.28);
}

.auth-dialog {
  position: relative;
  width: min(380px, 100%);
  border: 1px solid #dde5ef;
  border-radius: 8px;
  padding: 28px;
  color: #101828;
  background: #fff;
  box-shadow: var(--shadow);
}

.recharge-modal {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(0, 0, 0, 0.72);
}

.recharge-dialog {
  position: relative;
  display: grid;
  gap: 16px;
  width: min(820px, 100%);
  max-height: calc(100vh - 48px);
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px;
  color: var(--text);
  background: #171a19;
  box-shadow: var(--shadow);
}

.recharge-head {
  display: grid;
  gap: 6px;
  padding-right: 34px;
}

.recharge-head span {
  color: #5fd7ff;
  font-size: 12px;
  font-weight: 900;
}

.recharge-head h2 {
  margin: 0;
  font-size: 24px;
}

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

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

.recharge-summary > div {
  min-width: 0;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  padding: 12px;
  background: #202322;
}

.recharge-summary span,
.payment-product-card span,
.payment-order-card span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.recharge-summary strong {
  display: block;
  margin-top: 4px;
  overflow: hidden;
  font-size: 18px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pay-type-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.recharge-products {
  display: grid;
  gap: 14px;
}

.payment-product-group {
  display: grid;
  gap: 10px;
}

.payment-product-group h3 {
  margin: 0;
  font-size: 16px;
}

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

.payment-product-card,
.payment-order-card {
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  padding: 14px;
  background: #202322;
}

.payment-product-card strong {
  display: block;
  margin-top: 5px;
  font-size: 16px;
}

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

.payment-product-card div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.payment-product-card b {
  color: var(--amber);
  font-size: 22px;
}

.payment-order-card {
  display: grid;
  grid-template-columns: 1.1fr 1fr 0.7fr auto;
  align-items: center;
  gap: 10px;
}

.payment-order-card strong {
  display: block;
  margin-top: 4px;
  overflow-wrap: anywhere;
  font-size: 14px;
}

.desktop-payment-dialog {
  width: min(598px, calc(100vw - 28px));
  min-height: 486px;
  gap: 10px;
  border: 1px solid #d6e4ee;
  border-radius: 8px;
  padding: 20px;
  color: #0f4a52;
  background: #fff;
}

.desktop-payment-head {
  padding-right: 34px;
}

.desktop-payment-head h2 {
  color: #0b4d55;
  font-size: 20px;
}

.payment-tabs {
  display: flex;
  gap: 10px;
  margin-bottom: 0;
}

.payment-tab {
  min-width: 122px;
  min-height: 38px;
  border: 1px solid #78dfd5;
  border-radius: 4px;
  color: #076866;
  background: #e9fffc;
  font-weight: 800;
}

.payment-tab.active {
  border-color: #cf6a00;
  color: #fff;
  background: #dd7600;
}

.desktop-products {
  min-height: 250px;
}

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

.desktop-product-card {
  position: relative;
  display: grid;
  align-content: start;
  min-height: 156px;
  border: 1px solid #70c7ff;
  border-radius: 6px;
  padding: 12px 12px 46px;
  color: #104b61;
  background: #eef8ff;
  text-align: left;
}

.desktop-product-card.active,
.desktop-product-card:hover {
  border-color: #0099ff;
  background: #e2f4ff;
}

.desktop-product-card strong {
  margin: 0;
  color: #0d5261;
  font-size: 15px;
  line-height: 1.35;
}

.desktop-product-card span {
  margin-top: 2px;
  color: #5c6b7b;
  font-size: 12px;
}

.desktop-product-card b {
  position: absolute;
  right: 12px;
  bottom: 12px;
  color: #08786e;
  font-size: 20px;
}

.payment-method-panel[hidden] {
  display: none;
}

.payment-method-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid #b8d9ed;
  border-radius: 6px;
  padding: 12px;
  background: #f8fcff;
}

.payment-method-card span,
.payment-method-card small {
  display: block;
  color: #5c6b7b;
  font-size: 12px;
}

.payment-method-card strong {
  display: block;
  margin: 3px 0;
  color: #0d5261;
  font-size: 15px;
}

.payment-method-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.payment-method-button {
  min-height: 34px;
  border-color: #2f9cff;
  border-radius: 5px;
  padding: 0 14px;
  color: #fff;
  background: #1688ff;
  font-weight: 800;
}

.desktop-payment-dialog .payment-order-card {
  grid-template-columns: 1fr;
  gap: 8px;
  border-color: #b8d9ed;
  background: #f8fcff;
}

.desktop-payment-dialog .auth-status {
  margin: 4px 0 0;
  color: #5c6b7b;
  text-align: center;
}

.upload-zone.has-files {
  place-items: start;
  min-height: 116px;
  border-style: solid;
  border-color: #8fcde3;
  padding: 8px;
  background: #172322;
  text-align: left;
}

.upload-zone.has-files > span,
.upload-zone.has-files > small {
  display: none;
}

.upload-file-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  width: 100%;
}

.upload-file-card {
  position: relative;
  width: 70px;
  height: 80px;
  border: 1px solid #6daec3;
  border-radius: 7px;
  background: #0f1717;
}

.upload-file-card img {
  width: 100%;
  height: 100%;
  border-radius: 6px;
  object-fit: cover;
}

.upload-file-card button {
  position: absolute;
  top: -8px;
  right: -8px;
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border: 2px solid #fff;
  border-radius: 50%;
  color: #fff;
  background: #e92b2b;
  font-size: 14px;
  font-weight: 900;
  line-height: 1;
}

.auth-close {
  position: absolute;
  top: 10px;
  right: 12px;
  border: 0;
  color: #667085;
  background: transparent;
  font-size: 24px;
}

.wechat-title {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 18px;
}

.wechat-title h2 {
  margin: 0;
  font-size: 18px;
}

.wechat-badge {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 7px;
  color: #fff;
  background: #19c15f;
  font-size: 10px;
  font-weight: 900;
}

.wechat-qr {
  display: grid;
  place-items: center;
  width: 180px;
  height: 180px;
  margin: 0 auto 16px;
  border: 10px solid #fff;
  background: #f8fafc url("assets/wechat-login-qr.svg") center / 150px 150px no-repeat;
  box-shadow: 0 0 0 1px #e5e7eb;
}

.wechat-qr img {
  width: 150px;
  height: 150px;
  object-fit: contain;
}

.auth-status {
  margin: 0 0 12px;
  color: #475467;
  text-align: center;
}

.login-gate .auth-status,
.recharge-dialog .auth-status {
  color: var(--muted);
}

.login-gate .wechat-title h2 {
  color: #102033;
}

.login-gate .wechat-qr {
  border: 1px solid #d7dee8;
  border-radius: 8px;
  background-color: #ffffff;
  box-shadow: none;
}

.login-gate .auth-status {
  margin: 0 0 14px;
  color: #1f2937;
  font-weight: 800;
}

.login-gate .btn-primary {
  border-color: #b8c6d4;
  color: #344054;
  background: #ffffff;
}

.login-gate .btn-primary:hover {
  border-color: #1688ff;
  color: #0e6bd8;
  background: #eef8ff;
}

.login-gate-actions {
  gap: 14px;
  margin-top: 0;
}

.login-gate-actions .btn {
  min-width: 96px;
  min-height: 34px;
  border-color: #d8dee8;
  border-radius: 5px;
  color: #1f2937;
  background: #ffffff;
  font-size: 13px;
  font-weight: 500;
}

.login-gate-actions .btn:hover {
  border-color: #b7c2ce;
  color: #0f172a;
  background: #f9fafb;
}

.qr-path {
  display: block;
  overflow-wrap: anywhere;
  color: #667085;
  text-align: center;
  font-size: 12px;
}

.login-gate .qr-path {
  color: #697c88;
}

.auth-actions,
.admin-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin-top: 18px;
}

.btn,
.auth-actions .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  border-radius: var(--radius);
  padding: 0 16px;
  font-weight: 900;
}

.btn-primary {
  border-color: var(--blue);
  color: #fff;
  background: var(--blue);
}

.btn-secondary {
  border-color: #d0d5dd;
  color: #344054;
  background: #fff;
}

.admin-page {
  min-height: 100vh;
  color: #101828;
  background: #eef3f9;
}

.product-page {
  min-height: 100vh;
  color: var(--text);
  background: var(--bg);
}

.product-shell {
  width: min(1180px, calc(100% - 36px));
  margin: 0 auto;
  padding: 34px 0 56px;
}

.product-hero {
  display: grid;
  grid-template-columns: minmax(0, 0.82fr) minmax(360px, 1fr);
  gap: 28px;
  align-items: stretch;
}

.product-copy,
.product-preview,
.product-points article {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
}

.product-copy {
  display: grid;
  align-content: center;
  gap: 16px;
  padding: 34px;
}

.product-copy span {
  color: #82c8ff;
  font-size: 13px;
  font-weight: 900;
}

.product-copy h1 {
  margin: 0;
  font-size: 42px;
  line-height: 1.12;
}

.product-copy p {
  margin: 0;
  color: var(--muted);
  font-size: 16px;
}

.static-page-card {
  width: min(760px, 100%);
  align-content: start;
}

.product-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 8px;
}

.product-preview {
  display: grid;
  place-items: center;
  min-height: 420px;
  overflow: hidden;
  padding: 18px;
  background: #121414;
}

.product-preview img {
  width: 100%;
  border-radius: 8px;
  object-fit: contain;
  box-shadow: var(--shadow);
}

.product-points {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-top: 16px;
}

.tutorial-stage .product-points {
  width: min(760px, 100%);
  margin-top: 0;
}

.product-points article {
  padding: 20px;
}

.product-points strong {
  display: block;
  margin-bottom: 8px;
  font-size: 18px;
}

.product-points p {
  margin: 0;
  color: var(--muted);
}

.admin-page .site-header {
  color: #101828;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(14px);
}

.admin-page .brand small {
  color: #667085;
}

.main-nav {
  display: flex;
  gap: 18px;
  color: #344054;
  font-weight: 800;
}

.admin-shell {
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto;
  padding: 32px 0 56px;
}

.admin-hero,
.admin-layout,
.admin-section-title {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 20px;
  align-items: start;
}

.admin-hero {
  margin-bottom: 22px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--blue-2);
  font-size: 13px;
  font-weight: 900;
}

.admin-hero h1 {
  max-width: 760px;
  margin: 0 0 10px;
  font-size: 32px;
  line-height: 1.25;
}

.admin-hero p {
  margin: 0;
  color: #667085;
}

.admin-layout {
  grid-template-columns: minmax(0, 1.2fr) minmax(320px, 0.8fr);
  margin-bottom: 22px;
}

.admin-card {
  border: 1px solid #d7e0eb;
  border-radius: var(--radius);
  padding: 22px;
  background: #fff;
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.08);
}

.admin-card h2 {
  margin: 0 0 6px;
  font-size: 20px;
}

.admin-card p {
  margin: 0 0 16px;
  color: #667085;
}

.admin-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.admin-form-grid > div {
  grid-column: 1 / -1;
}

.admin-form-grid label {
  display: grid;
  gap: 6px;
  color: #344054;
  font-size: 13px;
  font-weight: 900;
}

.admin-form-grid input,
.admin-form-grid textarea {
  width: 100%;
  border: 1px solid #cbd8e7;
  border-radius: 7px;
  padding: 10px 12px;
  color: #101828;
  background: #fff;
}

.admin-preview {
  position: sticky;
  top: 96px;
}

.admin-preview pre {
  max-height: 520px;
  overflow: auto;
  border-radius: 7px;
  padding: 14px;
  background: #0f172a;
  color: #dbeafe;
  font-size: 12px;
  line-height: 1.55;
  white-space: pre-wrap;
}

.config-list {
  display: grid;
  gap: 14px;
}

.config-item {
  border: 1px solid #dbe4f0;
  border-radius: var(--radius);
  padding: 16px;
  background: #f8fbff;
}

.config-item-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.module-config-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 10px;
}

.module-toggle {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  border: 1px solid #dbe4f0;
  border-radius: 8px;
  padding: 10px;
  background: #fff;
}

.module-toggle span {
  display: grid;
  gap: 3px;
}

.module-toggle small {
  color: #667085;
  overflow-wrap: anywhere;
}

body[data-theme="light"] {
  --bg: #eef3f7;
  --panel: #ffffff;
  --panel-2: #f6f8fb;
  --panel-3: #ffffff;
  --line: #cfd8e3;
  --line-soft: #e1e7ee;
  --text: #101828;
  --muted: #667085;
  --shadow: 0 18px 46px rgba(15, 23, 42, 0.12);
}

body[data-theme="light"] .topbar,
body[data-theme="light"] .site-header {
  background: #ffffff;
}

body[data-theme="light"] .brand small,
body[data-theme="light"] .settings-head span,
body[data-theme="light"] .stage-toolbar span {
  color: #0e7fd3;
}

body[data-theme="light"] .top-tab,
body[data-theme="light"] .mode-button,
body[data-theme="light"] .avatar-button,
body[data-theme="light"] .batch-generate-button,
body[data-theme="light"] .stage-actions button {
  color: #344054;
  background: #f8fafc;
}

body[data-theme="light"] .top-tab {
  color: #475467;
}

body[data-theme="light"] .top-tab.active {
  color: #ffffff;
  background: linear-gradient(180deg, #1688ff, #0f73df);
}

body[data-theme="light"] .support-link {
  border-color: #b8defb;
  color: #0e6bd8;
  background: #eef8ff;
}

body[data-theme="light"] .batch-mode-switch {
  color: #344054;
}

body[data-theme="light"] .batch-mode-switch input {
  border-color: #cfd8e3;
  background: #eef2f6;
}

body[data-theme="light"] .batch-mode-switch.is-on {
  color: #0f73df;
}

body[data-theme="light"] .batch-mode-switch input:checked {
  border-color: #1688ff;
  background: #1688ff !important;
}

body[data-theme="light"] .upload-zone.has-files {
  border-color: #9bd7ea;
  background: #f7fcff;
}

body[data-theme="light"] .upload-file-card {
  border-color: #a8d8e8;
  background: #ffffff;
}

body[data-theme="light"] .task-card small {
  color: #475467;
}

body[data-theme="light"] .task-actions button {
  border-color: #c7e1f8;
  background: #eef8ff;
}

body[data-theme="light"] .member-chip {
  border-color: #f3d38a;
  background: #fff8e8;
}

body[data-theme="light"] .account-menu {
  border-color: #d5dde8;
  color: #101828;
  background: #ffffff;
}

body[data-theme="light"] .account-menu-stat {
  border-color: #edf0f4;
  background: #f8fafc;
}

body[data-theme="light"] .account-logout {
  border-color: #f5b5b1;
  color: #b42318;
  background: #fff3f2;
}

body[data-theme="light"] .account-logout:hover {
  border-color: #d92d20;
  color: #ffffff;
  background: #d92d20;
}

body[data-theme="light"] .mode-menu {
  background: #ffffff;
}

body[data-theme="light"] .mode-menu button {
  color: #101828;
}

body[data-theme="light"] .mode-menu button:hover {
  background: #eef4fb;
}

body[data-theme="light"] .function-rail,
body[data-theme="light"] .settings-column,
body[data-theme="light"] .stage-panel {
  background: #ffffff;
  box-shadow: inset 0 0 0 1px rgba(15, 23, 42, 0.02);
}

body[data-theme="light"] .settings-head,
body[data-theme="light"] .module-list,
body[data-theme="light"] .upload-section,
body[data-theme="light"] .stage-toolbar,
body[data-theme="light"] .task-status {
  border-color: var(--line-soft);
}

body[data-theme="light"] .rail-button {
  color: #344054;
  background: #f6f8fb;
  box-shadow: none;
}

body[data-theme="light"] .rail-button.active {
  color: #ffffff;
  background: linear-gradient(180deg, #1688ff, #0e6bd8);
}

body[data-theme="light"] .rail-button.active span {
  color: #e7f4ff;
}

body[data-theme="light"] .module-pill {
  color: #253044;
  background: #f7fafc;
}

body[data-theme="light"] .module-pill.active {
  color: #ffffff;
  background: #0f75dc;
}

body[data-theme="light"] .module-pill.active span {
  color: #e8f5ff;
}

body[data-theme="light"] .upload-zone {
  border-color: #aab9c8;
  color: #253044;
  background: #f8fbff;
}

body[data-theme="light"] .upload-zone.is-dragging {
  background: #e7f4ff;
}

body[data-theme="light"] .prompt-box span,
body[data-theme="light"] .parameter-group strong {
  color: #253044;
}

body[data-theme="light"] .prompt-box textarea {
  border-color: #cbd8e7;
  color: #101828;
  background: #ffffff;
}

body[data-theme="light"] .parameter-input {
  border-color: #cbd8e7;
  color: #101828;
  background: #ffffff;
}

body[data-theme="light"] .choice-pill {
  color: #344054;
  background: #f8fafc;
}

body[data-theme="light"] .choice-pill.active {
  color: #ffffff;
  background: #1688ff;
}

body[data-theme="light"] .stage-toolbar,
body[data-theme="light"] .task-status {
  background: #f9fbfd;
}

body[data-theme="light"] .result-stage {
  background: #f2f6fa;
}

body[data-theme="light"] .empty-state,
body[data-theme="light"] .compare-placeholder {
  color: #101828;
}

body[data-theme="light"] .empty-icon {
  border-color: #8da1b6;
  color: #8da1b6;
}

body[data-theme="light"] .compare-pane {
  border-color: #d5dde8;
  background: #ffffff;
}

body[data-theme="light"] .compare-pane header {
  border-color: #d5dde8;
  background: #f8fafc;
}

body[data-theme="light"] .compare-canvas {
  background:
    linear-gradient(45deg, rgba(16, 24, 40, 0.05) 25%, transparent 25%) 0 0 / 28px 28px,
    linear-gradient(45deg, transparent 75%, rgba(16, 24, 40, 0.05) 75%) 0 0 / 28px 28px,
    #ffffff;
}

body[data-theme="light"] .result-grid,
body[data-theme="light"] .history-grid {
  background: #f6f8fb;
}

body[data-theme="light"] .result-card,
body[data-theme="light"] .task-card {
  border-color: #d5dde8;
  background: #ffffff;
}

body[data-theme="light"] .tutorial-stage {
  background: #f2f6fa;
}

body[data-theme="light"] .result-card img {
  background: #eef3f8;
}

body[data-theme="light"] .product-copy,
body[data-theme="light"] .product-preview,
body[data-theme="light"] .product-points article {
  border-color: #d5dde8;
  background: #ffffff;
}

body[data-theme="light"] .product-preview {
  background: #f4f7fb;
}

body[data-theme="light"] .product-copy span {
  color: #0e7fd3;
}

body[data-theme="light"] .source-panel,
body[data-theme="light"] .history-sidebar,
body[data-theme="light"] .function-rail,
body[data-theme="light"] .result-grid,
body[data-theme="light"] .history-grid {
  scrollbar-color: #aab8c6 transparent;
}

body[data-theme="light"] .source-panel::-webkit-scrollbar-thumb,
body[data-theme="light"] .history-sidebar::-webkit-scrollbar-thumb,
body[data-theme="light"] .function-rail::-webkit-scrollbar-thumb,
body[data-theme="light"] .result-grid::-webkit-scrollbar-thumb,
body[data-theme="light"] .history-grid::-webkit-scrollbar-thumb {
  background: #aab8c6;
}

body[data-theme="blue"] {
  --bg: #061b28;
  --panel: #0e2a36;
  --panel-2: #143845;
  --panel-3: #071822;
  --line: #28586a;
  --line-soft: #1f4656;
  --text: #e8fbff;
  --muted: #9fc6d2;
  --blue: #16b8e8;
  --blue-2: #0b8ab5;
  --green: #27d19b;
  --amber: #ffd166;
  --shadow: 0 18px 54px rgba(0, 18, 36, 0.42);
}

body[data-theme="blue"] .topbar,
body[data-theme="blue"] .site-header {
  background: #0b2633;
}

body[data-theme="blue"] .brand small,
body[data-theme="blue"] .settings-head span,
body[data-theme="blue"] .stage-toolbar span {
  color: #62d6ff;
}

body[data-theme="blue"] .top-tab,
body[data-theme="blue"] .mode-button,
body[data-theme="blue"] .avatar-button,
body[data-theme="blue"] .batch-generate-button,
body[data-theme="blue"] .stage-actions button {
  color: #d5f5ff;
  background: #123442;
}

body[data-theme="blue"] .top-tab.active {
  color: #ffffff;
  background: linear-gradient(180deg, #18b9e9, #0b7fac);
}

body[data-theme="blue"] .support-link {
  border-color: #246781;
  color: #75ddff;
  background: #0b3142;
}

body[data-theme="blue"] .batch-mode-switch {
  color: #d5f5ff;
}

body[data-theme="blue"] .batch-mode-switch input {
  border-color: #2e6c7f;
  background: #123442;
}

body[data-theme="blue"] .batch-mode-switch.is-on {
  color: #62d6ff;
}

body[data-theme="blue"] .batch-mode-switch input:checked {
  border-color: #16b8e8;
  background: #16b8e8 !important;
}

body[data-theme="blue"] .upload-zone.has-files {
  border-color: #56c9e8;
  background: #092431;
}

body[data-theme="blue"] .task-card small {
  color: #b8dbe6;
}

body[data-theme="blue"] .task-actions button {
  border-color: #246781;
  background: #0b3142;
}

body[data-theme="blue"] .member-chip {
  border-color: #4f6c58;
  background: #102d2f;
}

body[data-theme="blue"] .account-menu {
  border-color: #28586a;
  color: #e8fbff;
  background: #0e2a36;
}

body[data-theme="blue"] .account-menu-stat {
  border-color: #1f4656;
  background: #071822;
}

body[data-theme="blue"] .account-logout {
  border-color: rgba(255, 95, 87, 0.5);
  color: #ffd5d2;
  background: rgba(255, 95, 87, 0.14);
}

body[data-theme="blue"] .mode-menu {
  background: #0e2a36;
}

body[data-theme="blue"] .mode-menu button:hover {
  background: #194455;
}

body[data-theme="blue"] .function-rail,
body[data-theme="blue"] .settings-column,
body[data-theme="blue"] .stage-panel {
  background: #0e2a36;
  box-shadow: inset 0 0 0 1px rgba(117, 221, 255, 0.06);
}

body[data-theme="blue"] .settings-head,
body[data-theme="blue"] .module-list,
body[data-theme="blue"] .upload-section,
body[data-theme="blue"] .stage-toolbar,
body[data-theme="blue"] .task-status {
  border-color: var(--line-soft);
}

body[data-theme="blue"] .rail-button {
  color: #d8f6ff;
  background: #123442;
  box-shadow: inset 0 0 0 1px rgba(117, 221, 255, 0.04);
}

body[data-theme="blue"] .rail-button.active {
  color: #ffffff;
  background: radial-gradient(circle at 50% 10%, #1ed0f5, #076990);
}

body[data-theme="blue"] .rail-button.active span {
  color: #d7f8ff;
}

body[data-theme="blue"] .module-pill {
  color: #d8f6ff;
  background: #12313e;
}

body[data-theme="blue"] .module-pill.active {
  color: #ffffff;
  background: #0b83b5;
}

body[data-theme="blue"] .module-pill.active span {
  color: #dcf8ff;
}

body[data-theme="blue"] .upload-zone {
  border-color: #3a7488;
  color: #d8f6ff;
  background: #0a2430;
}

body[data-theme="blue"] .upload-zone.is-dragging {
  background: #0d374c;
}

body[data-theme="blue"] .prompt-box span,
body[data-theme="blue"] .parameter-group strong {
  color: #e4fbff;
}

body[data-theme="blue"] .prompt-box textarea {
  border-color: #2b6175;
  color: #e8fbff;
  background: #061a24;
}

body[data-theme="blue"] .parameter-input {
  border-color: #2b6175;
  color: #e8fbff;
  background: #061a24;
}

body[data-theme="blue"] .choice-pill {
  color: #d4f5ff;
  background: #102f3b;
}

body[data-theme="blue"] .choice-pill.active {
  color: #10202c;
  background: #ffd166;
}

body[data-theme="blue"] .stage-toolbar {
  background: #0b222d;
}

body[data-theme="blue"] .result-stage {
  background: #071924;
}

body[data-theme="blue"] .empty-state,
body[data-theme="blue"] .compare-placeholder {
  color: #e8fbff;
}

body[data-theme="blue"] .empty-icon {
  border-color: #5791a4;
  color: #5791a4;
}

body[data-theme="blue"] .compare-pane {
  border-color: #28586a;
  background: #0a1e29;
}

body[data-theme="blue"] .compare-pane header {
  border-color: #28586a;
  background: #0e2b38;
}

body[data-theme="blue"] .compare-canvas {
  background:
    linear-gradient(45deg, rgba(117, 221, 255, 0.065) 25%, transparent 25%) 0 0 / 28px 28px,
    linear-gradient(45deg, transparent 75%, rgba(117, 221, 255, 0.065) 75%) 0 0 / 28px 28px,
    #061823;
}

body[data-theme="blue"] .task-status {
  background: #092330;
}

body[data-theme="blue"] .result-grid,
body[data-theme="blue"] .history-grid {
  background: #071b25;
}

body[data-theme="blue"] .result-card,
body[data-theme="blue"] .task-card {
  border-color: #28586a;
  background: #0f2a36;
}

body[data-theme="blue"] .tutorial-stage {
  background: #071924;
}

body[data-theme="blue"] .result-card img {
  background: #061823;
}

body[data-theme="blue"] .product-copy,
body[data-theme="blue"] .product-preview,
body[data-theme="blue"] .product-points article {
  border-color: #28586a;
  background: #0e2a36;
}

body[data-theme="blue"] .product-preview {
  background: #071b25;
}

body[data-theme="blue"] .product-copy span {
  color: #62d6ff;
}

body[data-theme="blue"] .source-panel,
body[data-theme="blue"] .history-sidebar,
body[data-theme="blue"] .function-rail,
body[data-theme="blue"] .result-grid,
body[data-theme="blue"] .history-grid {
  scrollbar-color: #397287 transparent;
}

body[data-theme="blue"] .source-panel::-webkit-scrollbar-thumb,
body[data-theme="blue"] .history-sidebar::-webkit-scrollbar-thumb,
body[data-theme="blue"] .function-rail::-webkit-scrollbar-thumb,
body[data-theme="blue"] .result-grid::-webkit-scrollbar-thumb,
body[data-theme="blue"] .history-grid::-webkit-scrollbar-thumb {
  background: #397287;
}

.referral-register-overlay {
  position: fixed;
  inset: 0;
  z-index: 3000;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(15, 23, 42, 0.72);
}

.result-card .result-file-icon {
  display: grid;
  place-items: center;
  width: 100%;
  aspect-ratio: 4 / 3;
  padding: 0;
  background: #151818;
  color: #b8c3c1;
  font-size: 22px;
  font-weight: 700;
}

.feature-gate {
  position: fixed;
  z-index: 25;
  top: 50%;
  left: 50%;
  width: min(100% - 40px, 520px);
  padding: 34px 28px;
  color: #f4fbff;
  text-align: center;
  background: #0a2030;
  border: 1px solid #2c6377;
  border-radius: 8px;
  box-shadow: 0 28px 70px rgba(0, 10, 18, .48);
  transform: translate(-50%, -50%);
}

.feature-gate[hidden] { display: none; }

.feature-gate span {
  color: #58d9df;
  font-size: 11px;
  font-weight: 800;
}

.feature-gate strong {
  display: block;
  margin-top: 12px;
  font-size: 27px;
}

.feature-gate p {
  margin: 9px 0 0;
  color: #9ab3bf;
  font-size: 13px;
}

body.web-ai-checking .workbench-layout,
body.web-ai-disabled .workbench-layout {
  pointer-events: none;
  user-select: none;
  opacity: .3;
}

body.web-ai-checking [data-auth-open],
body.web-ai-disabled [data-auth-open] {
  display: none;
}

.referral-register-dialog {
  position: relative;
  width: min(420px, 100%);
  padding: 28px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #ffffff;
  color: #172033;
  box-shadow: 0 24px 64px rgba(15, 23, 42, 0.28);
  text-align: center;
}

.referral-register-close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 0;
  background: transparent;
  color: #475569;
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
}

.referral-register-heading span {
  color: #0f766e;
  font-size: 13px;
  font-weight: 700;
}

.referral-register-heading h2 {
  margin: 6px 34px 6px;
  font-size: 24px;
  line-height: 1.25;
}

.referral-register-heading p,
.referral-register-status {
  margin: 0;
  color: #64748b;
  line-height: 1.6;
}

.referral-register-qr {
  display: grid;
  place-items: center;
  width: 220px;
  height: 220px;
  margin: 22px auto 14px;
  border: 1px solid #d8dee8;
  background: #f8fafc;
}

.referral-register-qr img {
  width: 204px;
  height: 204px;
  object-fit: contain;
}

.referral-register-refresh {
  min-height: 38px;
  margin-top: 18px;
  padding: 0 18px;
  border: 0;
  border-radius: 6px;
  background: #0f766e;
  color: #ffffff;
  font-weight: 700;
  cursor: pointer;
}

.referral-register-overlay.is-complete .referral-register-refresh {
  display: none;
}

@media (max-width: 480px) {
  .referral-register-dialog {
    padding: 24px 16px;
  }

  .referral-register-heading h2 {
    font-size: 21px;
  }

  .referral-register-qr {
    width: 200px;
    height: 200px;
  }

  .referral-register-qr img {
    width: 184px;
    height: 184px;
  }
}


@media (max-width: 1180px) {
  .topbar {
    gap: 10px;
    padding: 0 12px;
  }

  .brand {
    min-width: 160px;
  }

  .brand-mark {
    width: 40px;
    height: 40px;
  }

  .brand strong {
    font-size: 20px;
  }

  .top-tab {
    min-width: 86px;
    padding: 0 10px;
    font-size: 14px;
  }

  .mode-button,
  .support-link,
  .member-chip,
  .avatar-button {
    padding: 0 9px;
    font-size: 13px;
  }

  .avatar-button span {
    display: none;
  }

  .member-chip strong {
    font-size: 14px;
  }

  .workbench-layout {
    grid-template-columns: 108px minmax(332px, 352px) minmax(0, 1fr);
  }
}

@media (max-width: 1080px) {
  .topbar {
    position: static;
    flex-wrap: wrap;
    height: auto;
    padding: 12px;
  }

  .top-tabs {
    order: 3;
    flex-basis: 100%;
    overflow-x: auto;
  }

  .workbench-layout {
    grid-template-columns: 104px minmax(260px, 320px) minmax(420px, 1fr);
    height: calc(100vh - 122px);
  }
}

@media (max-width: 900px) {
  .workbench-app {
    overflow: auto;
  }

  .workbench-layout {
    grid-template-columns: 1fr;
    height: auto;
  }

  .function-rail {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .settings-column,
  .stage-panel {
    min-height: 520px;
  }

  .compare-preview {
    grid-template-columns: 1fr;
    min-height: 620px;
  }

  .admin-layout,
  .admin-hero,
  .admin-section-title,
  .product-hero,
  .product-points {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .topbar {
    align-items: stretch;
  }

  .brand {
    width: 100%;
  }

  .top-tabs {
    order: 2;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    width: 100%;
    flex-basis: auto;
    overflow: visible;
  }

  .top-tab {
    width: 100%;
    max-width: none;
    min-width: 0;
    padding: 0 6px;
    font-size: 13px;
  }

  .top-actions,
  .function-rail,
  .stage-toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .top-actions {
    order: 3;
    width: 100%;
  }

  .account-switch,
  .member-chip,
  .recharge-button,
  .avatar-button {
    width: 100%;
  }

  .account-menu {
    position: static;
    width: 100%;
    margin-top: 8px;
  }

  .login-gate {
    padding: 16px;
  }

  .login-gate-shell {
    width: min(304px, 100%);
  }

  .login-gate-card {
    min-height: auto;
    padding: 0;
  }

  .login-gate-title {
    font-size: 26px;
  }

  .gate-qr {
    width: 236px;
    height: 236px;
    margin-bottom: 46px;
    background-size: 210px 210px;
  }

  .gate-qr img {
    width: 210px;
    height: 210px;
  }

  .login-gate-points,
  .recharge-summary,
  .payment-product-grid,
  .payment-order-card {
    grid-template-columns: 1fr;
  }

  .avatar-button span {
    display: inline;
  }

  .function-rail {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .admin-form-grid {
    grid-template-columns: 1fr;
  }

  .product-shell {
    width: calc(100% - 24px);
    padding: 18px 0 36px;
  }

  .product-copy {
    padding: 24px;
  }

  .product-copy h1 {
    font-size: 32px;
  }

  .product-preview {
    min-height: 260px;
  }

}
