:root {
  --ink: #101820;
  --muted: #62707f;
  --line: #eaded5;
  --paper: #fbfaf8;
  --panel: #ffffff;
  --accent: #ff7214;
  --accent-deep: #2a211c;
  --accent-2: #ff9f55;
  --accent-3: #ffe3ca;
  --shadow: 0 16px 36px rgba(92, 62, 40, 0.08);
  --soft-shadow: 0 8px 22px rgba(92, 62, 40, 0.06);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
  background:
    linear-gradient(180deg, #fff8f1 0, #fbfaf8 300px),
    var(--paper);
}

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

button {
  cursor: pointer;
}

.app {
  display: block;
  min-height: 100vh;
}

.sidebar {
  display: none;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 30px;
}

.brand-mark {
  display: grid;
  width: 46px;
  height: 46px;
  place-items: center;
  border-radius: 8px;
  color: #17242d;
  font-weight: 800;
  background: var(--accent-3);
}

.brand h1,
.brand p,
.topbar h2,
.topbar p,
.panel-head h3,
.section-head h3,
.result-card h4,
.result-card p {
  margin: 0;
}

.brand h1 {
  font-size: 22px;
}

.brand p {
  margin-top: 4px;
  color: #aab8c3;
  font-size: 13px;
}

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

.nav-item {
  width: 100%;
  padding: 12px 14px;
  border: 0;
  border-radius: 8px;
  color: #d8e1e8;
  text-align: left;
  background: transparent;
}

.nav-item.active,
.nav-item:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.1);
}

.mini-panel {
  margin-top: 28px;
  padding: 18px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
}

.mini-label,
.mini-panel small {
  display: block;
  color: #aab8c3;
  font-size: 13px;
}

.mini-panel strong {
  display: block;
  margin: 8px 0 2px;
  color: var(--accent-3);
  font-size: 38px;
}

.workspace {
  width: min(1540px, calc(100vw - 40px));
  margin: 0 auto;
  padding: 14px 0 22px;
  overflow: visible;
}

.topbar,
.builder,
.section-head,
.panel-head,
.actions,
.card-body {
  display: flex;
  align-items: center;
}

.topbar {
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 12px;
  padding: 12px 16px;
  border: 1px solid rgba(255, 114, 20, 0.18);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: var(--soft-shadow);
  backdrop-filter: blur(10px);
}

.topbar h2 {
  font-size: 22px;
  line-height: 1.15;
}

.topbar p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

.eyebrow {
  display: block;
  margin-bottom: 4px;
  color: #d75d0d;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

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

.primary-btn,
.generate-btn,
.small-btn,
.icon-btn,
.chip {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.primary-btn,
.generate-btn {
  padding: 10px 16px;
  border-color: transparent;
  color: #fff;
  font-weight: 700;
  background: linear-gradient(135deg, #ff7214, #f2a45e);
}

.primary-btn.secondary {
  color: #9a4e15;
  border-color: rgba(255, 114, 20, 0.24);
  background: #fff7ef;
}

.icon-btn {
  width: 38px;
  height: 38px;
  color: var(--ink);
  font-size: 20px;
}

.account-box {
  display: flex;
  align-items: center;
  min-height: 38px;
}

.auth-inline,
.user-inline {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px;
  border: 1px solid rgba(255, 114, 20, 0.2);
  border-radius: 8px;
  background: #fffaf5;
}

.auth-inline input {
  width: 150px;
  height: 32px;
}

.auth-inline .small-btn,
.user-inline .small-btn {
  min-height: 32px;
}

.recharge-link {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  min-width: 64px;
  min-height: 38px;
  height: 38px;
  padding-inline: 14px;
  box-sizing: border-box;
  border-color: transparent;
  border-radius: 8px;
  color: #ffffff !important;
  font-size: 14px;
  font-weight: 800;
  line-height: 1;
  text-decoration: none;
  background: linear-gradient(135deg, #ff6b1a, #ff9d4d);
  white-space: nowrap;
}

.recharge-link:hover {
  color: #ffffff !important;
  text-decoration: none;
  border-color: transparent;
  background: linear-gradient(135deg, #ff6b1a, #ff9d4d);
}

.recharge-top-btn {
  box-shadow: 0 10px 24px rgba(255, 114, 20, 0.18);
}

.recharge-panel {
  scroll-margin-top: 16px;
  border-color: rgba(255, 114, 20, 0.32);
  box-shadow: 0 22px 60px rgba(124, 45, 18, 0.1);
}

.user-inline span {
  max-width: 180px;
  overflow: hidden;
  color: var(--muted);
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-inline strong {
  padding: 7px 10px;
  border-radius: 999px;
  color: #8b4b1d;
  font-size: 13px;
  background: #fff1e4;
}

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

.control-panel,
.results-area,
.ai-chat-panel,
.chat-client-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.control-panel {
  grid-column: 2;
  grid-row: 1;
  position: relative;
  padding: 14px;
}

.chat-client-panel {
  grid-column: 1;
  display: grid;
  min-height: 660px;
  padding: 16px;
  align-content: space-between;
  gap: 14px;
}

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

label,
.segment {
  display: grid;
  gap: 7px;
}

label span,
.segment > span {
  color: var(--muted);
  font-size: 13px;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid #e7dcd3;
  border-radius: 8px;
  color: var(--ink);
  background: #fff;
}

input,
select {
  height: 38px;
  padding: 0 12px;
}

textarea {
  min-height: 96px;
  padding: 12px;
  resize: vertical;
}

.wide-field,
.asset-settings-grid,
.segment,
.api-settings,
.range-row {
  margin-top: 12px;
}

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

.text-tool {
  min-height: 28px;
  padding: 0 10px;
  border: 1px solid rgba(255, 114, 20, 0.24);
  border-radius: 999px;
  color: #d75d0d;
  font-size: 12px;
  font-weight: 700;
  background: #fff4e9;
}

.ai-chat-panel {
  display: grid;
  gap: 10px;
  padding: 12px;
}

.prompt-chat-log {
  display: grid;
  align-content: start;
  gap: 8px;
  min-height: 420px;
  max-height: 560px;
  padding: 12px;
  overflow: auto;
  border-radius: 8px;
  background: #fff;
}

.chat-message {
  display: grid;
  gap: 4px;
  max-width: 92%;
  padding: 6px 2px;
  border: 0;
  border-radius: 8px;
  background: transparent;
}

.chat-message.user {
  padding: 9px 11px;
  justify-self: end;
  border: 1px solid rgba(255, 114, 20, 0.24);
  border-color: rgba(255, 114, 20, 0.24);
  background: #fff4e9;
}

.chat-message strong {
  color: #8b4b1d;
  font-size: 12px;
}

.chat-message span {
  color: var(--ink);
  font-size: 13px;
  line-height: 1.55;
}

.plan-review-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.plan-review-editor {
  width: min(100%, 960px);
  min-height: 280px;
  padding: 12px;
  border: 1px solid #eaded5;
  border-radius: 8px;
  background: #fffaf5;
  color: var(--ink);
  font: inherit;
  font-size: 13px;
  line-height: 1.6;
  resize: vertical;
}

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

.asset-group {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid #eaded5;
  border-radius: 8px;
  background: #fffaf5;
}

.asset-title {
  display: grid;
  gap: 2px;
}

.asset-title strong {
  font-size: 14px;
}

.asset-title span {
  color: var(--muted);
  font-size: 12px;
}

.upload-pair {
  display: grid;
  grid-template-columns: 124px minmax(110px, 1fr);
  gap: 10px;
}

.generation-settings {
  grid-column: span 2;
}

.generation-settings .extra-controls {
  margin-top: 0;
}

.attachment-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.attachment-card {
  display: grid;
  grid-template-columns: 72px 92px;
  align-items: center;
  gap: 8px;
  padding: 8px;
  border: 1px solid #eaded5;
  border-radius: 8px;
  background: #fffaf5;
}

.attachment-card strong {
  font-size: 13px;
}

.attachment-card .image-preview {
  min-height: 56px;
}

.attachment-card .image-preview img {
  max-height: 58px;
}

.chat-format-row {
  display: grid;
  grid-template-columns: minmax(120px, 0.9fr) minmax(120px, 0.9fr) minmax(130px, 0.8fr) 86px;
  align-items: end;
  gap: 8px;
  padding: 0 2px;
  border: 0;
  border-radius: 8px;
  background: transparent;
}

.chat-format-row label {
  width: 100%;
}

.chat-format-row span {
  font-size: 12px;
}

.chat-format-row select,
.chat-format-row input {
  min-height: 34px;
  padding: 0 10px;
  font-size: 13px;
}

.chat-composer {
  position: relative;
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) 104px 92px;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  padding: 10px 12px;
  border: 1px solid #eaded5;
  border-radius: 24px;
  background: #fff;
  box-shadow: 0 14px 36px rgba(33, 24, 15, 0.08);
}

.upload-thumbs {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0 0 4px 2px;
}

.upload-thumb {
  position: relative;
  width: 58px;
  height: 58px;
  overflow: hidden;
  border: 1px solid #eaded5;
  border-radius: 8px;
  background: #fffaf5;
}

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

.upload-thumb button {
  position: absolute;
  top: 3px;
  right: 3px;
  display: grid;
  width: 18px;
  height: 18px;
  place-items: center;
  border: 0;
  border-radius: 50%;
  color: #fff;
  font-size: 13px;
  line-height: 1;
  background: rgba(0, 0, 0, 0.72);
  cursor: pointer;
}

.upload-thumb span {
  position: absolute;
  left: 4px;
  bottom: 3px;
  padding: 1px 4px;
  border-radius: 999px;
  color: #fff;
  font-size: 10px;
  background: rgba(0, 0, 0, 0.52);
}

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

.attach-menu-wrap {
  position: relative;
}

.attach-btn {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border: 1px solid #eaded5;
  border-radius: 50%;
  color: #8b4b1d;
  font-size: 22px;
  background: #fffaf5;
  cursor: pointer;
}

.attach-menu {
  position: absolute;
  top: 48px;
  left: 0;
  z-index: 5;
  display: grid;
  min-width: 150px;
  gap: 6px;
  padding: 8px;
  border: 1px solid #eaded5;
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
}

.attach-menu[hidden] {
  display: none !important;
}

.attach-menu label {
  display: block;
  padding: 8px 10px;
  border-radius: 8px;
  color: var(--ink);
  font-size: 13px;
  cursor: pointer;
}

.attach-menu label:hover {
  background: #fff4e9;
}

.attach-menu input {
  display: none;
}

.chat-input {
  min-height: 46px;
  max-height: 110px;
  padding: 11px 12px;
  border: 0;
  outline: none;
  resize: vertical;
}

.composer-btn {
  min-height: 40px;
  padding: 0 12px;
  border: 0;
  border-radius: 999px;
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  background: linear-gradient(135deg, var(--accent), #ff9f4a);
  cursor: pointer;
  white-space: nowrap;
}

.composer-btn.secondary {
  border: 1px solid rgba(255, 114, 20, 0.24);
  color: #d75d0d;
  background: #fff4e9;
}

.upload-box,
.image-preview {
  min-height: 78px;
  border: 1px dashed #decabe;
  border-radius: 8px;
}

.upload-box {
  display: grid;
  place-items: center;
  align-content: center;
  gap: 8px;
  cursor: pointer;
  background: #fbfdfe;
}

.upload-box small {
  color: var(--muted);
  font-size: 11px;
}

.upload-box input {
  display: none;
}

.upload-icon {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  font-size: 20px;
  background: var(--accent);
}

.image-preview {
  display: grid;
  place-items: center;
  overflow: hidden;
  color: var(--muted);
  background: linear-gradient(135deg, #fff4ea, #fff);
}

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

.range-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 64px;
  align-items: end;
  gap: 14px;
}

.api-settings {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(170px, 0.85fr) 96px 96px;
  align-items: end;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffaf5;
}

.operator-settings {
  margin-top: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffaf5;
}

.operator-settings summary {
  padding: 10px 12px;
  color: #8b4b1d;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.operator-settings .api-settings {
  margin-top: 0;
  border: 0;
  border-top: 1px solid var(--line);
  border-radius: 0 0 8px 8px;
}

.api-settings label:first-child {
  grid-column: span 2;
}

.api-settings label:nth-child(3) {
  grid-column: span 2;
}

.save-key {
  min-height: 38px;
  white-space: nowrap;
}

input[type="range"] {
  padding: 0;
  accent-color: var(--accent);
}

output {
  display: grid;
  height: 38px;
  place-items: center;
  border-radius: 8px;
  color: #fff;
  font-weight: 700;
  background: var(--accent-deep);
}

.generate-btn {
  width: 100%;
  height: 42px;
  margin-top: 12px;
  font-size: 16px;
}

.panel-head,
.section-head {
  justify-content: space-between;
  gap: 12px;
}

.results-area {
  grid-column: 1 / -1;
  grid-row: auto;
  min-height: 360px;
  margin: 0;
  padding: 18px;
}

.generation-account-panel {
  display: grid;
  grid-template-columns: repeat(3, minmax(104px, 1fr));
  gap: 8px;
  margin: 0;
}

.generation-account-panel div,
.generation-account-panel a {
  min-height: 44px;
  padding: 8px 10px;
  border: 1px solid #eaded5;
  border-radius: 8px;
  background: #fffaf5;
}

.generation-account-panel span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.generation-account-panel strong {
  display: block;
  margin-top: 2px;
  color: #8b4b1d;
  font-size: 16px;
}

.profile-stats {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  margin-top: 14px;
}

.profile-stats div {
  padding: 12px;
  border: 1px solid #eaded5;
  border-radius: 8px;
  background: #fffaf5;
}

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

.profile-stats span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.profile-stats strong {
  display: block;
  margin-top: 6px;
  color: #8b4b1d;
  font-size: 24px;
}

.profile-block {
  margin-top: 16px;
}

.profile-block h4 {
  margin: 0 0 10px;
  font-size: 15px;
}

.server-info {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.status {
  padding: 7px 10px;
  border-radius: 999px;
  max-width: 460px;
  color: #8b4b1d;
  font-size: 13px;
  background: #fff1e4;
}

.results-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 280px));
  justify-content: start;
  gap: 14px;
  margin-top: 18px;
}

.results-grid:empty {
  min-height: 390px;
  display: grid;
  place-items: center;
}

.results-grid:empty::before {
  width: 100%;
  max-width: 360px;
  padding: 78px 24px;
  border: 1px dashed #dfcbbd;
  border-radius: 8px;
  color: var(--muted);
  text-align: center;
  background: #fffaf5;
  content: "暂无生成结果";
}

.result-card {
  width: 100%;
  max-width: 280px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--soft-shadow);
}

.mock-image {
  position: relative;
  display: grid;
  min-height: 0;
  aspect-ratio: 1 / 1;
  padding: 18px;
  align-content: end;
  overflow: hidden;
  color: #fff;
  background: #0f8b8d;
  cursor: zoom-in;
}

.mock-image > img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  cursor: zoom-in;
}

.mock-fallback {
  display: grid;
  position: relative;
  z-index: 1;
  min-height: 210px;
  align-content: end;
}

.mock-image::before {
  position: absolute;
  inset: 20px 18px auto auto;
  width: 86px;
  height: 86px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.18);
  content: "";
}

.mock-image strong,
.mock-image span {
  position: relative;
  z-index: 1;
}

.mock-image strong {
  font-size: 24px;
  line-height: 1.2;
}

.mock-image span {
  margin-top: 8px;
  font-size: 15px;
}

.mock-badge {
  position: absolute;
  top: 16px;
  left: 16px;
  width: 52px;
  height: 26px;
  border-radius: 999px;
  background: #ffd05e;
}

.card-body {
  justify-content: space-between;
  gap: 10px;
  padding: 13px;
}

.result-card h4 {
  font-size: 16px;
}

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

.result-message {
  width: min(920px, 100%);
  max-width: 100%;
  padding: 0;
}

.chat-result-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(136px, 160px));
  gap: 12px;
  margin-top: 0;
}

.chat-result-thumb {
  display: block;
  padding: 0;
  border: 0;
  border-radius: 8px;
  color: var(--ink);
  background: transparent;
  box-shadow: none;
}

.chat-result-thumb img {
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 8px;
  object-fit: cover;
  background: #f6eee6;
}

.progress-message {
  width: min(560px, 100%);
  margin: 18px auto;
  padding: 12px;
  background: #fff7ef;
  text-align: left;
}

.progress-message.planning-progress {
  width: min(390px, 92%);
  padding: 10px 12px;
  text-align: center;
}

.progress-message .progress-copy {
  display: block;
  margin-top: 8px;
  color: #8b4b1d;
  font-weight: 700;
}

.progress-message small {
  display: block;
  margin-top: 8px;
  color: var(--muted);
}

.planning-progress small {
  font-size: 12px;
}

.progress-bar {
  height: 9px;
  margin-top: 12px;
  overflow: hidden;
  border-radius: 999px;
  background: #f2dfcf;
}

.progress-bar i {
  display: block;
  width: 3%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #ff7214, #f2a45e);
  transition: width 0.35s ease;
}

.small-btn {
  min-width: 64px;
  min-height: 34px;
  color: var(--accent);
}

.commerce-panel {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
}

.plans-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 14px;
}

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

.plans-grid.compact .plan-card {
  padding: 12px;
}

.plans-grid.compact .plan-card strong {
  margin: 6px 0 2px;
  font-size: 22px;
}

.plan-card {
  padding: 14px;
  border: 1px solid #eaded5;
  border-radius: 8px;
  background: #fffaf5;
}

.plan-card h4,
.plan-card p {
  margin: 0;
}

.plan-card h4 {
  font-size: 16px;
}

.plan-card strong {
  display: block;
  margin: 10px 0 4px;
  color: #8b4b1d;
  font-size: 26px;
}

.plan-card p {
  color: var(--muted);
  font-size: 13px;
}

.plan-card button {
  width: 100%;
  margin-top: 12px;
}

.history-list {
  display: grid;
  gap: 8px;
  max-height: 260px;
  margin-top: 14px;
  overflow: auto;
}

.history-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid #eaded5;
  border-radius: 8px;
  background: #fffaf5;
}

.history-item span {
  color: var(--muted);
  font-size: 12px;
}

.history-item strong {
  font-size: 13px;
}

.order-history-item > div:first-child {
  display: grid;
  gap: 4px;
}

.inline-actions {
  display: inline-flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.admin-tools {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 120px 90px;
  gap: 10px;
  margin-top: 14px;
}

.system-settings {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  align-items: end;
  margin-top: 14px;
}

.model-settings-split {
  display: grid;
  gap: 12px;
  margin-top: 14px;
}

.model-setting-box {
  padding: 12px;
  border: 1px solid #eaded5;
  border-radius: 8px;
  background: #fffaf5;
}

.model-setting-box h4,
.model-pool-grid h4 {
  margin: 0;
  font-size: 15px;
}

.model-pool-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-top: 14px;
}

.model-form {
  display: grid;
  grid-template-columns: 1.2fr 120px 120px 1fr 1.2fr 1.2fr 90px 100px;
  gap: 10px;
  align-items: end;
  margin-top: 14px;
}

.model-add-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 14px;
}

.model-add-card {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid #eaded5;
  border-radius: 8px;
  background: #fffaf5;
}

.model-add-card h4 {
  margin: 0;
  font-size: 16px;
}

.model-add-card p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

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

.profit-cell {
  display: grid;
  gap: 3px;
  min-width: 168px;
}

.profit-cell strong {
  font-size: 13px;
}

.profit-cell span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.profit-cell.profit-good strong {
  color: #157347;
}

.profit-cell.profit-bad strong {
  color: #b53535;
}

.payment-settings,
.sms-settings {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  align-items: end;
  margin-top: 14px;
}

.payment-settings textarea,
.sms-settings textarea {
  min-height: 74px;
  resize: vertical;
}

.wide-setting {
  grid-column: span 3;
}

.pay-actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  margin-top: 12px;
}

.payment-box {
  display: grid;
  gap: 12px;
  margin-top: 16px;
  padding: 16px;
  border: 1px solid #eaded5;
  border-radius: 8px;
  background: #fffaf5;
}

.payment-box[hidden],
.payment-box.is-hidden {
  display: none !important;
}

.custom-recharge {
  display: grid;
  gap: 12px;
  margin-top: 16px;
  padding: 16px;
  border: 1px solid #eaded5;
  border-radius: 8px;
  background: #fffaf5;
}

.custom-recharge h4,
.custom-recharge p {
  margin: 0;
}

.custom-recharge-row {
  display: grid;
  grid-template-columns: 130px minmax(90px, 1fr) 110px;
  gap: 10px;
  align-items: center;
}

.custom-recharge-row span {
  color: #8b4b1d;
  font-weight: 700;
}

.payment-box h4,
.payment-box p {
  margin: 0;
}

.payment-qr {
  display: grid;
  place-items: center;
  min-height: 132px;
  margin: 0;
  padding: 16px;
  border: 1px dashed #d9b99c;
  border-radius: 8px;
  background: #fff;
  color: #3b2a20;
  text-align: center;
  white-space: pre-wrap;
  font-family: Consolas, "Microsoft YaHei", monospace;
  line-height: 1.6;
}

.payment-qr img {
  display: block;
  width: min(240px, 100%);
  height: auto;
  margin: 0 auto;
}

.admin-panel {
  margin-top: 16px;
}

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

.auth-card {
  display: grid;
  width: min(420px, 100%);
  gap: 14px;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
}

.register-card {
  width: min(480px, 100%);
}

.auth-card h1,
.auth-card p {
  margin: 0;
}

.reset-panel {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid #eaded5;
  border-radius: 8px;
  background: #fffaf5;
}

.security-tools {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 110px;
}

.auth-card h1 {
  font-size: 26px;
}

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

.code-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 112px;
  gap: 10px;
  align-items: end;
}

.code-row .small-btn {
  min-height: 38px;
}

.wechat-btn {
  min-height: 40px;
  border: 1px solid #b9dfc7;
  border-radius: 8px;
  color: #167b3a;
  font-weight: 700;
  background: #f0fff5;
}

.auth-status,
.back-link {
  color: var(--muted);
  font-size: 13px;
}

.back-link,
.link-btn {
  display: inline-grid;
  place-items: center;
  text-decoration: none;
}

.account-page {
  width: min(1180px, calc(100vw - 40px));
  margin: 0 auto;
  padding: 18px 0 32px;
}

.admin-page {
  width: min(1440px, calc(100vw - 40px));
  margin: 0 auto;
  padding: 18px 0 32px;
}

.admin-nav {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin: 12px 0 16px;
}

.admin-nav a,
.admin-entry-card {
  display: grid;
  gap: 5px;
  min-height: 68px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  text-decoration: none;
  background: #fff;
  box-shadow: var(--soft-shadow);
}

.admin-nav a {
  align-content: center;
  font-weight: 800;
}

.admin-nav a span,
.admin-entry-card span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  line-height: 1.45;
}

.admin-nav a.active {
  border-color: rgba(255, 114, 20, 0.42);
  color: #b5520e;
  background: #fff4e9;
}

.admin-entry-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.admin-entry-card strong {
  color: #8b4b1d;
  font-size: 16px;
}

.backup-tools {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-top: 16px;
  padding: 14px;
  border: 1px solid #eaded5;
  border-radius: 8px;
  background: #fffaf5;
}

.account-layout {
  display: grid;
  gap: 16px;
}

.admin-stats {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.admin-stats div {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--soft-shadow);
}

.admin-stats span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.admin-stats strong {
  display: block;
  margin-top: 6px;
  color: #8b4b1d;
  font-size: 26px;
}

.admin-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.admin-grid > .commerce-panel {
  align-self: start;
}

.admin-page[data-admin-page="users"] .admin-grid {
  grid-template-columns: minmax(340px, 430px) minmax(0, 1fr);
}

.admin-page[data-admin-page="users"] .admin-grid > [data-admin-panel="users-list"] {
  grid-column: 1;
}

.admin-page[data-admin-page="users"] .admin-grid > [data-admin-panel="user-detail"] {
  grid-column: 2;
}

.admin-page[data-admin-page="orders"] .admin-grid {
  grid-template-columns: minmax(0, 1.1fr) minmax(420px, 0.9fr);
}

.admin-page[data-admin-page="orders"] .admin-grid > [data-admin-panel="orders-list"] {
  grid-column: 1 / -1;
}

.admin-page[data-admin-page="users"] .data-table,
.admin-page[data-admin-page="orders"] .data-table {
  max-height: none;
  overflow: visible;
}

.admin-grid > .commerce-panel:nth-child(6) {
  grid-column: span 2;
  order: 1;
}

.admin-grid > .commerce-panel:nth-child(7) {
  order: 2;
}

.admin-grid > .commerce-panel:nth-child(8) {
  order: 3;
}

.admin-grid > .commerce-panel:nth-child(9) {
  order: 4;
}

.admin-grid > .commerce-panel:nth-child(10) {
  order: 5;
}

.admin-grid > .commerce-panel:nth-child(11) {
  order: 6;
}

.admin-grid > .commerce-panel:nth-child(1) {
  order: 7;
}

.admin-grid > .commerce-panel:nth-child(2) {
  order: 8;
}

.admin-grid > .commerce-panel:nth-child(3) {
  order: 9;
}

.admin-grid > .commerce-panel:nth-child(5) {
  order: 10;
}

.admin-grid > .commerce-panel:nth-child(4) {
  order: 11;
}

.user-detail-panel {
  grid-column: span 2;
}

.data-table {
  max-height: 360px;
  margin-top: 14px;
  overflow: auto;
}

.data-table table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.data-table th,
.data-table td {
  padding: 9px 8px;
  border-bottom: 1px solid #eaded5;
  text-align: left;
  vertical-align: top;
}

.data-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  color: #8b4b1d;
  background: #fff4e9;
}

.admin-mini-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: 4px 0 12px;
}

.admin-mini-stats div {
  padding: 12px;
  border: 1px solid #eaded5;
  border-radius: 8px;
  background: #fffaf5;
}

.admin-mini-stats span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.admin-mini-stats strong {
  display: block;
  margin-top: 5px;
  color: #8b4b1d;
  font-size: 20px;
}

.admin-table-card {
  max-height: min(620px, calc(100vh - 330px));
  overflow: auto;
  border: 1px solid #eaded5;
  border-radius: 8px;
  background: #fff;
}

.admin-table-card table {
  font-size: 13px;
}

.admin-table-card th,
.admin-table-card td {
  padding: 12px 11px;
}

.admin-primary {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.admin-primary strong {
  overflow: hidden;
  color: #101820;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-primary span,
.muted-inline {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.point-text,
.money-text {
  display: block;
  color: #8b4b1d;
  font-size: 15px;
}

.role-badge {
  display: inline-grid;
  min-height: 24px;
  place-items: center;
  padding: 0 9px;
  border-radius: 999px;
  color: #59616f;
  font-size: 12px;
  font-weight: 700;
  background: #eef1f5;
}

.role-badge.admin {
  color: #a25511;
  background: #fff3df;
}

.table-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.progress-mini {
  width: 96px;
  height: 7px;
  overflow: hidden;
  border-radius: 999px;
  background: #f0e4db;
}

.progress-mini span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #ff7214, #ff9f55);
}

.error-inline {
  display: block;
  max-width: 260px;
  margin-top: 4px;
  color: #b53535;
  font-size: 12px;
}

.delta-text {
  font-size: 15px;
}

.delta-text.positive {
  color: #157347;
}

.delta-text.negative {
  color: #b53535;
}

.table-action {
  min-height: 28px;
  padding: 0 9px;
  border: 1px solid rgba(255, 114, 20, 0.24);
  border-radius: 8px;
  color: #d75d0d;
  background: #fff4e9;
}

.table-action.danger {
  border-color: rgba(181, 53, 53, 0.28);
  color: #b53535;
  background: #fff7f5;
}

.compact-select {
  min-height: 34px;
  padding: 0 10px;
  border: 1px solid #eaded5;
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
}

.status-badge {
  display: inline-grid;
  min-width: 58px;
  min-height: 24px;
  place-items: center;
  padding: 0 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}

.status-paid,
.status-completed {
  color: #157347;
  background: #eaf7ef;
}

.status-pending,
.status-queued,
.status-running {
  color: #a25511;
  background: #fff3df;
}

.status-closed {
  color: #59616f;
  background: #eef1f5;
}

.status-failed {
  color: #b53535;
  background: #fff0ee;
}

.user-detail-empty {
  margin-top: 14px;
  padding: 18px;
  border: 1px dashed #dfcbbd;
  border-radius: 8px;
  color: var(--muted);
  background: #fffaf5;
}

.detail-stats {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.detail-stats div {
  padding: 10px;
  border: 1px solid #eaded5;
  border-radius: 8px;
  background: #fffaf5;
}

.detail-stats span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.detail-stats strong {
  display: block;
  margin-top: 5px;
  color: #8b4b1d;
  font-size: 20px;
}

.detail-sections {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-top: 14px;
}

.admin-page[data-admin-page="users"] .detail-sections {
  grid-template-columns: 1fr;
}

.compact-detail-table {
  max-height: 280px;
}

.floating-status {
  position: fixed;
  right: 22px;
  bottom: 22px;
  max-width: 420px;
  padding: 10px 14px;
  border-radius: 999px;
  color: #8b4b1d;
  font-size: 13px;
  background: #fff1e4;
  box-shadow: var(--soft-shadow);
}

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 32px;
  background: rgba(16, 24, 32, 0.76);
}

.lightbox[hidden] {
  display: none;
}

.lightbox img {
  max-width: min(92vw, 1100px);
  max-height: 88vh;
  border-radius: 8px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.34);
  background: #fff;
}

.lightbox-close {
  position: fixed;
  top: 18px;
  right: 22px;
  width: 42px;
  height: 42px;
  border: 1px solid rgba(255, 255, 255, 0.26);
  border-radius: 50%;
  color: #fff;
  font-size: 30px;
  line-height: 1;
  background: rgba(0, 0, 0, 0.25);
}

.site-footer {
  width: min(100%, 1380px);
  margin: 18px auto 0;
  padding: 14px 18px 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  color: var(--muted);
  font-size: 13px;
}

.site-footer a {
  color: #8a4a1f;
  text-decoration: none;
}

.site-footer a:hover {
  color: var(--accent);
}

.auth-footer {
  margin-top: 14px;
  padding-bottom: 0;
}

.legal-page {
  width: min(100vw - 32px, 920px);
  margin: 0 auto;
  padding: 42px 0 64px;
}

.legal-panel {
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 34px;
}

.legal-panel h1 {
  margin: 8px 0 12px;
  font-size: 30px;
}

.legal-panel h2 {
  margin: 28px 0 10px;
  font-size: 18px;
}

.legal-panel p {
  margin: 0 0 12px;
  color: #334155;
  line-height: 1.8;
}

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

.finance-card {
  margin-top: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 250, 245, 0.72);
}

.finance-card h4 {
  margin: 0 0 10px;
  font-size: 15px;
}

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

  .control-panel,
  .results-area,
  .ai-chat-panel,
  .chat-client-panel,
  .generation-account-panel {
    grid-column: 1;
    grid-row: auto;
  }

  .control-panel,
  .ai-chat-panel,
  .chat-client-panel {
    padding: 14px;
  }

  .ai-chat-panel {
    position: static;
  }

  .prompt-chat-log {
    min-height: 180px;
    max-height: 300px;
  }

  .results-grid {
    grid-template-columns: repeat(auto-fill, minmax(200px, 260px));
  }
}

@media (max-width: 820px) {
  .workspace {
    width: min(100vw - 24px, 680px);
    padding: 12px 0 24px;
  }

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

  .field-grid,
  .asset-settings-grid,
  .upload-pair,
  .chat-format-row,
  .generation-account-panel,
  .api-settings,
  .style-options,
  .results-grid,
  .plans-grid,
  .admin-tools,
  .system-settings,
  .model-add-grid,
  .model-card-form,
  .model-pool-grid,
  .model-form,
  .payment-settings,
  .sms-settings,
  .custom-recharge-row,
  .code-row,
  .admin-nav,
  .admin-entry-grid,
  .admin-stats,
  .admin-grid {
    grid-template-columns: 1fr;
  }

  .admin-page[data-admin-page="users"] .admin-grid,
  .admin-page[data-admin-page="orders"] .admin-grid,
  .admin-mini-stats,
  .detail-stats,
  .detail-sections,
  .finance-grid {
    grid-template-columns: 1fr;
  }

  .admin-page[data-admin-page="users"] .admin-grid > [data-admin-panel="users-list"],
  .admin-page[data-admin-page="users"] .admin-grid > [data-admin-panel="user-detail"],
  .admin-page[data-admin-page="orders"] .admin-grid > [data-admin-panel="orders-list"] {
    grid-column: 1;
  }

  .chat-composer {
    grid-template-columns: 42px minmax(0, 1fr);
  }

  .chat-composer .composer-btn {
    grid-column: span 1;
  }

  .attach-menu {
    bottom: auto;
    top: 44px;
  }

  .wide-setting {
    grid-column: auto;
  }

  .actions {
    width: 100%;
  }

  .primary-btn {
    flex: 1;
  }
}
