:root {
  --bg: #080b16;
  --bg-soft: #101827;
  --panel: rgba(255, 255, 255, 0.08);
  --panel-strong: rgba(255, 255, 255, 0.13);
  --line: rgba(255, 255, 255, 0.14);
  --text: #eef2ff;
  --muted: #aab3cc;
  --muted-2: #78839d;
  --brand: #72e5ff;
  --brand-2: #8b5cf6;
  --brand-3: #f59e0b;
  --ok: #34d399;
  --warn: #fbbf24;
  --bad: #fb7185;
  --shadow: 0 30px 90px rgba(0, 0, 0, 0.45);
  --radius-xl: 30px;
  --radius-lg: 22px;
  --radius-md: 16px;
  --radius-sm: 12px;
  --sidebar: 320px;
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 10% 8%, rgba(114, 229, 255, 0.20), transparent 32rem),
    radial-gradient(circle at 78% 14%, rgba(139, 92, 246, 0.28), transparent 34rem),
    radial-gradient(circle at 76% 88%, rgba(245, 158, 11, 0.18), transparent 30rem),
    linear-gradient(135deg, #070913 0%, #0d1224 58%, #111827 100%);
  background-attachment: fixed;
}

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

button {
  border: 0;
}

a {
  color: inherit;
}

.boot-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
}

.boot-screen h1 {
  margin: 0 0 8px;
  font-size: 34px;
}

.boot-screen p {
  margin: 0;
  color: var(--muted);
}

.brand-orb,
.logo-mark {
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  border-radius: 20px;
  font-size: 25px;
  font-weight: 900;
  color: white;
  background:
    radial-gradient(circle at 68% 22%, rgba(255, 255, 255, 0.92), transparent 0.42rem),
    linear-gradient(135deg, var(--brand), var(--brand-2) 56%, var(--brand-3));
  box-shadow: 0 18px 45px rgba(90, 121, 255, 0.42);
}

.logo-mark.small {
  width: 42px;
  height: 42px;
  border-radius: 15px;
  font-size: 20px;
}

.landing {
  min-height: 100vh;
  padding: 26px;
}

.landing-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 1200px;
  margin: 0 auto 40px;
  padding: 14px 18px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(9, 13, 27, 0.62);
  backdrop-filter: blur(18px);
  box-shadow: var(--shadow);
}

.brand-line,
.user-line {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-title {
  font-weight: 900;
  letter-spacing: 0.02em;
}

.brand-subtitle,
.user-subtitle {
  color: var(--muted);
  font-size: 12px;
  margin-top: 2px;
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.landing-grid {
  max-width: 1200px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) 430px;
  gap: 28px;
  align-items: stretch;
}

.hero-card,
.auth-card,
.panel-card,
.message-composer,
.chat-empty,
.paywall,
.admin-shell,
.sidebar,
.workspace {
  border: 1px solid var(--line);
  background: rgba(10, 16, 33, 0.72);
  box-shadow: var(--shadow);
  backdrop-filter: blur(22px);
}

.hero-card {
  position: relative;
  overflow: hidden;
  min-height: 640px;
  border-radius: var(--radius-xl);
  padding: 54px;
}

.hero-card::before {
  content: "";
  position: absolute;
  inset: -40% -20% auto auto;
  width: 520px;
  height: 520px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(114, 229, 255, 0.34), transparent 64%);
  pointer-events: none;
}

.hero-kicker,
.section-kicker {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #dff8ff;
  background: rgba(114, 229, 255, 0.10);
  border: 1px solid rgba(114, 229, 255, 0.25);
  padding: 8px 12px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
}

.hero-card h1 {
  position: relative;
  margin: 26px 0 20px;
  max-width: 780px;
  font-size: clamp(42px, 6vw, 76px);
  line-height: 0.98;
  letter-spacing: -0.06em;
}

.gradient-text {
  background: linear-gradient(120deg, #fff, #8beaff 30%, #c4b5fd 65%, #fef3c7);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hero-lead {
  position: relative;
  max-width: 700px;
  color: #c9d3ea;
  line-height: 1.8;
  font-size: 17px;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin: 30px 0;
}

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

.feature-item,
.stat-card,
.plan-card,
.order-card,
.setting-group,
.prompt-card,
.audit-card {
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.07);
  border-radius: var(--radius-lg);
}

.feature-item {
  padding: 18px;
}

.feature-icon {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 16px;
  margin-bottom: 14px;
  background: linear-gradient(135deg, rgba(114, 229, 255, 0.20), rgba(139, 92, 246, 0.24));
}

.feature-item h3,
.plan-card h3,
.panel-card h3,
.setting-group h3 {
  margin: 0 0 8px;
}

.feature-item p,
.plan-card p,
.panel-card p,
.setting-group p {
  margin: 0;
  color: var(--muted);
  line-height: 1.65;
}

.auth-card {
  border-radius: var(--radius-xl);
  padding: 26px;
  align-self: stretch;
}

.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 6px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.06);
  margin-bottom: 24px;
}

.auth-tab {
  cursor: pointer;
  padding: 12px;
  border-radius: 14px;
  color: var(--muted);
  background: transparent;
}

.auth-tab.active {
  color: white;
  background: linear-gradient(135deg, rgba(114, 229, 255, 0.18), rgba(139, 92, 246, 0.30));
}

.auth-card h2 {
  margin: 0 0 8px;
  font-size: 26px;
}

.auth-note {
  color: var(--muted);
  line-height: 1.65;
  margin: 0 0 20px;
}

.form {
  display: grid;
  gap: 14px;
}

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

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

.field label {
  color: #d7ddef;
  font-size: 13px;
  font-weight: 700;
}

.input,
.textarea,
.select {
  width: 100%;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 14px;
  color: var(--text);
  background: rgba(5, 9, 18, 0.70);
  outline: none;
  padding: 13px 14px;
  transition: border-color 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
}

.textarea {
  min-height: 116px;
  resize: vertical;
  line-height: 1.65;
}

.input:focus,
.textarea:focus,
.select:focus {
  border-color: rgba(114, 229, 255, 0.7);
  box-shadow: 0 0 0 4px rgba(114, 229, 255, 0.10);
  background: rgba(7, 12, 24, 0.9);
}

.select option {
  background: #101827;
  color: white;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  padding: 0 17px;
  border-radius: 14px;
  cursor: pointer;
  color: white;
  background: rgba(255, 255, 255, 0.10);
  border: 1px solid rgba(255, 255, 255, 0.12);
  transition: transform 0.16s ease, background 0.16s ease, border-color 0.16s ease, opacity 0.16s ease;
  white-space: nowrap;
}

.btn:hover {
  transform: translateY(-1px);
  background: rgba(255, 255, 255, 0.14);
  border-color: rgba(255, 255, 255, 0.22);
}

.btn:disabled {
  cursor: not-allowed;
  opacity: 0.58;
  transform: none;
}

.btn.primary {
  border: 0;
  background: linear-gradient(135deg, #37d4f6, #7c3aed 58%, #f59e0b);
  box-shadow: 0 18px 38px rgba(93, 93, 255, 0.35);
}

.btn.ghost {
  background: transparent;
}

.btn.danger {
  background: rgba(251, 113, 133, 0.14);
  border-color: rgba(251, 113, 133, 0.30);
}

.btn.success {
  background: rgba(52, 211, 153, 0.14);
  border-color: rgba(52, 211, 153, 0.30);
}

.btn.full {
  width: 100%;
}

.btn.small {
  min-height: 34px;
  padding: 0 11px;
  border-radius: 11px;
  font-size: 13px;
}

.micro-copy {
  color: var(--muted-2);
  font-size: 12px;
  line-height: 1.55;
}

.shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: var(--sidebar) minmax(0, 1fr);
  gap: 16px;
  padding: 16px;
}

.sidebar {
  position: sticky;
  top: 16px;
  height: calc(100vh - 32px);
  border-radius: var(--radius-xl);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.sidebar-head {
  padding: 20px 18px 14px;
  display: flex;
  gap: 12px;
  align-items: center;
}

.sidebar-actions {
  padding: 0 18px 14px;
}

.side-nav {
  padding: 0 12px 14px;
  display: grid;
  gap: 6px;
}

.side-link {
  width: 100%;
  justify-content: flex-start;
  color: #dbe4f7;
  background: transparent;
}

.side-link.active {
  background: rgba(114, 229, 255, 0.13);
  border-color: rgba(114, 229, 255, 0.24);
}

.sidebar-section-title {
  padding: 14px 18px 8px;
  font-size: 12px;
  color: var(--muted-2);
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.chat-list {
  flex: 1;
  overflow-y: auto;
  padding: 0 12px 14px;
  display: grid;
  align-content: start;
  gap: 8px;
}

.chat-item {
  width: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  padding: 10px 10px 10px 12px;
  border-radius: 14px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  text-align: left;
}

.chat-item:hover,
.chat-item.active {
  border-color: rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.08);
}

.chat-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 14px;
}

.chat-meta {
  color: var(--muted-2);
  font-size: 12px;
  margin-top: 4px;
}

.icon-btn {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
}

.icon-btn:hover {
  color: white;
  background: rgba(255, 255, 255, 0.10);
}

.sidebar-foot {
  padding: 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.10);
}

.user-card {
  border-radius: 20px;
  padding: 14px;
  background: rgba(255, 255, 255, 0.07);
}

.user-card-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.user-quota {
  margin-top: 4px;
  color: var(--muted-2);
  font-size: 12px;
  font-weight: 700;
}

.avatar {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  font-weight: 900;
  background: linear-gradient(135deg, rgba(114, 229, 255, 0.30), rgba(139, 92, 246, 0.35));
}

.workspace {
  min-height: calc(100vh - 32px);
  border-radius: var(--radius-xl);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.topbar {
  min-height: 76px;
  padding: 16px 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.10);
  background: rgba(5, 9, 18, 0.30);
}

.topbar-title h2 {
  margin: 0;
  font-size: 20px;
}

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

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.topbar-actions:empty {
  display: none;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  border: 1px solid rgba(255, 255, 255, 0.13);
  background: rgba(255, 255, 255, 0.08);
  color: #e8edff;
}

.badge.ok {
  color: #a7f3d0;
  border-color: rgba(52, 211, 153, 0.28);
  background: rgba(52, 211, 153, 0.12);
}

.badge.warn,
.badge.pending {
  color: #fde68a;
  border-color: rgba(251, 191, 36, 0.30);
  background: rgba(251, 191, 36, 0.12);
}

.badge.bad,
.badge.rejected {
  color: #fecdd3;
  border-color: rgba(251, 113, 133, 0.30);
  background: rgba(251, 113, 133, 0.12);
}

.main-panel {
  min-height: 0;
  flex: 1;
  overflow: hidden;
}

.chat-view {
  height: 100%;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
}

.messages {
  overflow-y: auto;
  padding: 18px 24px 22px;
  scroll-behavior: smooth;
}

.welcome-card {
  max-width: 860px;
  margin: 10px auto 18px;
  padding: 18px 2px 10px;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.welcome-card h2 {
  margin: 8px 0 6px;
  font-size: 24px;
}

.welcome-card p {
  color: var(--muted);
  line-height: 1.75;
  margin: 0;
}

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

.prompt-card {
  text-align: left;
  color: #edf2ff;
  padding: 12px;
  cursor: pointer;
  border-radius: 14px;
}

.prompt-card:hover {
  transform: translateY(-1px);
  background: rgba(255, 255, 255, 0.10);
}

.prompt-card strong {
  display: block;
  margin-bottom: 6px;
}

.prompt-card span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.message {
  max-width: 840px;
  margin: 0 auto 14px;
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 13px;
}

.message.user {
  grid-template-columns: minmax(0, 1fr) 42px;
  margin-left: auto;
  margin-right: auto;
}

.message.user .message-avatar {
  grid-column: 2;
  grid-row: 1;
}

.message.user .message-body {
  grid-column: 1;
  grid-row: 1;
  text-align: right;
}

.message-avatar {
  width: 42px;
  height: 42px;
  border-radius: 15px;
  display: grid;
  place-items: center;
  font-weight: 900;
  background: rgba(255, 255, 255, 0.10);
}

.message.assistant .message-avatar {
  background: linear-gradient(135deg, rgba(114, 229, 255, 0.28), rgba(139, 92, 246, 0.32));
}

.message.user .message-avatar {
  background: rgba(245, 158, 11, 0.18);
}

.message-body {
  border: 0;
  border-radius: 0;
  background: transparent;
  overflow: visible;
}

.message-head {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 12px;
  padding: 0 0 8px;
  color: #dbe6fb;
  border-bottom: 0;
  font-size: 13px;
}

.message.user .message-head {
  align-items: flex-end;
  justify-content: flex-end;
}

.message-head-main {
  display: grid;
  gap: 3px;
}

.message-name {
  color: #eef4ff;
  font-weight: 800;
}

.message-meta {
  display: block;
}

.message-content {
  padding: 0;
  line-height: 1.82;
  color: #f1f5ff;
  word-break: break-word;
}

.message-content.compact {
  padding: 12px 0 0;
}

.message-content pre {
  margin: 12px 0;
  overflow-x: auto;
  padding: 14px;
  border-radius: 14px;
  background: rgba(0, 0, 0, 0.40);
  border: 1px solid rgba(255, 255, 255, 0.10);
}

.message-content code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: 13px;
}

.composer-wrap {
  padding: 16px 24px 22px;
  border-top: 1px solid rgba(255, 255, 255, 0.10);
  background: rgba(5, 9, 18, 0.42);
}

.message-composer {
  max-width: 930px;
  margin: 0 auto;
  border-radius: 24px;
  padding: 12px;
  min-width: 0;
  position: relative;
}

.message-composer.is-dragging {
  background: rgba(56, 189, 248, 0.08);
  box-shadow: inset 0 0 0 1px rgba(56, 189, 248, 0.46), 0 20px 48px rgba(14, 165, 233, 0.12);
}

.composer-drop-hint {
  pointer-events: none;
  position: absolute;
  inset: 8px;
  z-index: 8;
  display: grid;
  place-items: center;
  border: 1px dashed rgba(125, 211, 252, 0.78);
  border-radius: 18px;
  color: #dff7ff;
  background: rgba(7, 12, 24, 0.74);
  opacity: 0;
  transform: scale(0.99);
  transition: opacity 0.16s ease, transform 0.16s ease;
  font-size: 14px;
  font-weight: 800;
}

.message-composer.is-dragging .composer-drop-hint {
  opacity: 1;
  transform: scale(1);
}

.composer-textarea {
  width: 100%;
  min-height: 70px;
  max-height: 220px;
  resize: none;
  color: var(--text);
  background: transparent;
  border: 0;
  outline: 0;
  padding: 8px;
  line-height: 1.6;
  overflow-y: hidden;
}

.composer-tools {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 4px;
  min-width: 0;
  max-width: 100%;
}

.composer-tool-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  min-width: 0;
}

.composer-tool-row-right {
  justify-content: flex-end;
  flex-wrap: nowrap;
  margin-left: auto;
}

.send-icon-btn {
  width: 34px;
  min-width: 34px;
  height: 34px;
  min-height: 34px;
  padding: 0;
  border-radius: 999px;
  font-size: 18px;
  line-height: 1;
  box-shadow: 0 10px 24px rgba(93, 93, 255, 0.28);
  display: inline-grid;
  place-items: center;
}

.send-icon-btn span {
  display: block;
  transform: translateY(-1px);
}

.send-icon-btn.is-loading {
  cursor: wait;
  opacity: .92;
}

.send-icon-btn.is-loading .send-spinner {
  width: 15px;
  height: 15px;
  border: 2px solid rgba(7, 17, 31, 0.28);
  border-top-color: #07111f;
  border-radius: 999px;
  transform: none;
  animation: sendSpin .72s linear infinite;
}

@keyframes sendSpin {
  to {
    transform: rotate(360deg);
  }
}

.mode-switch {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  min-height: 36px;
  padding: 3px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.05);
}

.mode-pill {
  cursor: pointer;
  min-height: 28px;
  border: 0;
  border-radius: 999px;
  padding: 0 13px;
  color: var(--muted);
  background: transparent;
  font-size: 13px;
  font-weight: 800;
}

.mode-pill.active {
  color: #07111f;
  background: #f7fbff;
}

.tool-pill,
.tool-select {
  min-height: 34px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 999px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
  font-size: 13px;
}

.tool-pill {
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 0 13px;
  font-weight: 700;
}

.file-tool input {
  display: none;
}

.file-tool {
  width: 30px;
  min-width: 30px;
  height: 30px;
  min-height: 30px;
  justify-content: center;
  gap: 0;
  padding: 0;
  border-color: rgba(255, 255, 255, 0.16);
  color: rgba(233, 242, 255, 0.76);
  background: rgba(255, 255, 255, 0.04);
  font-size: 0;
  font-weight: 500;
  line-height: 1;
}

.file-tool span {
  width: 0;
  height: 0;
  overflow: hidden;
  font-size: 0;
}

.file-tool::before {
  content: "+";
  font-size: 21px;
  line-height: 1;
  transform: translateY(-1px);
}

.tool-select {
  cursor: pointer;
  max-width: 128px;
  padding: 0 30px 0 12px;
  outline: none;
}

.image-settings-menu {
  position: relative;
  flex: 0 0 auto;
  width: max-content;
}

.image-settings-menu summary {
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 999px;
  padding: 0 13px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
  font-size: 13px;
  font-weight: 700;
  list-style: none;
}

.image-settings-menu summary::-webkit-details-marker {
  display: none;
}

.settings-popover {
  position: absolute;
  right: 0;
  bottom: calc(100% + 8px);
  z-index: 20;
  display: grid;
  gap: 8px;
  width: min(308px, calc(100vw - 28px));
  padding: 8px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 14px;
  background: rgba(17, 24, 39, 0.98);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.38);
}

.image-setting-group {
  display: grid;
  gap: 6px;
}

.image-setting-group[aria-label="图片比例"] {
  grid-template-columns: repeat(6, minmax(0, 1fr));
}

.image-setting-group[aria-label="图片数量"] {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.image-option {
  appearance: none;
  min-width: 0;
  min-height: 42px;
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 6px 4px;
  cursor: pointer;
  color: rgba(255, 255, 255, 0.78);
  background: transparent;
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  transition: background .16s ease, border-color .16s ease, color .16s ease;
}

.image-option:hover,
.image-option:focus-visible {
  border-color: rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  outline: none;
}

.image-option.active {
  border-color: rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
}

.ratio-icon {
  display: block;
  border: 1.5px solid currentColor;
  border-radius: 3px;
  opacity: .86;
}

.ratio-auto {
  position: relative;
  width: 18px;
  height: 18px;
  border-radius: 999px;
}

.ratio-auto::after {
  content: "";
  position: absolute;
  inset: 4px;
  border-radius: inherit;
  background: currentColor;
  opacity: .38;
}

.ratio-16-9 {
  width: 22px;
  height: 13px;
}

.ratio-4-3 {
  width: 20px;
  height: 15px;
}

.ratio-1-1 {
  width: 17px;
  height: 17px;
}

.ratio-3-4 {
  width: 15px;
  height: 20px;
}

.ratio-9-16 {
  width: 13px;
  height: 22px;
}

.tool-select option {
  background: #101827;
  color: white;
}

.tool-pill:hover,
.file-tool:hover,
.tool-select:hover,
.tool-select:focus,
.image-settings-menu summary:hover {
  border-color: rgba(114, 229, 255, 0.42);
  background: rgba(114, 229, 255, 0.10);
}

.upload-preview-row {
  display: flex;
  align-items: center;
  gap: 8px;
  overflow-x: auto;
  padding: 0 4px 8px;
}

.upload-preview {
  position: relative;
  flex: 0 0 auto;
  width: 56px;
  height: 56px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.06);
  overflow: visible;
}

.upload-preview img {
  width: 100%;
  height: 100%;
  border-radius: 11px;
  object-fit: cover;
}

.upload-remove-btn {
  position: absolute;
  top: -7px;
  right: -7px;
  width: 20px;
  height: 20px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  color: #f8fafc;
  background: rgba(15, 23, 42, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.20);
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.28);
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
}

.upload-remove-btn:hover {
  background: rgba(239, 68, 68, 0.96);
  border-color: rgba(254, 202, 202, 0.62);
}

.chat-empty,
.paywall {
  max-width: 820px;
  margin: 46px auto;
  border-radius: var(--radius-xl);
  padding: 34px;
  text-align: center;
}

.chat-empty h2,
.paywall h2 {
  margin: 16px 0 8px;
  font-size: 30px;
}

.chat-empty p,
.paywall p {
  margin: 0 auto 22px;
  color: var(--muted);
  line-height: 1.75;
  max-width: 620px;
}

.content-scroll {
  height: 100%;
  overflow: auto;
  padding: 24px;
}

.page-grid {
  max-width: 1180px;
  margin: 0 auto;
  display: grid;
  gap: 18px;
}

.panel-card {
  border-radius: var(--radius-xl);
  padding: 24px;
}

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

.card-head h2 {
  margin: 0 0 8px;
  font-size: 26px;
}

.card-head p {
  margin: 0;
  color: var(--muted);
  line-height: 1.65;
}

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

.stats-grid.four {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.stat-card {
  padding: 18px;
}

.stat-value {
  font-size: 28px;
  font-weight: 900;
  margin-bottom: 4px;
}

.stat-label {
  color: var(--muted);
  font-size: 13px;
}

.plan-card {
  padding: 20px;
  position: relative;
  overflow: hidden;
}

.plan-card.selected {
  border-color: rgba(114, 229, 255, 0.45);
  box-shadow: inset 0 0 0 1px rgba(114, 229, 255, 0.25);
}

.plan-price {
  font-size: 34px;
  font-weight: 900;
  margin: 16px 0 8px;
}

.plan-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 14px 0 18px;
}

.payment-box {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: 18px;
  align-items: stretch;
}

.qr-box {
  min-height: 220px;
  display: grid;
  place-items: center;
  text-align: center;
  border-radius: 22px;
  padding: 18px;
  color: #dce7fb;
  background:
    linear-gradient(45deg, rgba(255,255,255,0.055) 25%, transparent 25%, transparent 50%, rgba(255,255,255,0.055) 50%, rgba(255,255,255,0.055) 75%, transparent 75%),
    rgba(255, 255, 255, 0.07);
  background-size: 26px 26px;
  border: 1px dashed rgba(255, 255, 255, 0.20);
  line-height: 1.65;
}

.qr-box img {
  max-width: 100%;
  max-height: 230px;
  border-radius: 18px;
}

.table-wrap {
  overflow: auto;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.10);
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
}

th,
td {
  text-align: left;
  padding: 13px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  vertical-align: top;
}

th {
  color: #dbe5fa;
  font-size: 13px;
  background: rgba(255, 255, 255, 0.05);
}

td {
  color: #f0f4ff;
  font-size: 14px;
}

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

.admin-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 18px;
}

.admin-tab.active {
  background: rgba(114, 229, 255, 0.14);
  border-color: rgba(114, 229, 255, 0.28);
}

.admin-section {
  display: grid;
  gap: 16px;
}

.order-actions {
  display: grid;
  grid-template-columns: 90px 100px minmax(180px, 1fr);
  gap: 8px;
  margin-top: 10px;
}

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

.settings-actions {
  justify-content: flex-end;
  padding-top: 2px;
}

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

.setting-group {
  padding: 18px;
}

.setting-group.wide {
  grid-column: 1 / -1;
}

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

.plan-row {
  display: grid;
  grid-template-columns: 0.8fr 1fr 0.7fr 0.7fr 0.8fr 1.4fr;
  gap: 8px;
}

.api-test-row {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) auto;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
}

.api-test-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: nowrap;
  gap: 8px;
}

.api-test-actions .btn,
.settings-actions .btn {
  min-width: max-content;
}

.test-output {
  min-height: 120px;
  white-space: pre-wrap;
  line-height: 1.7;
  color: #e8efff;
  padding: 14px;
  border-radius: 16px;
  background: rgba(0, 0, 0, 0.26);
  border: 1px solid rgba(255, 255, 255, 0.10);
}

.empty-note,
.loading-note {
  padding: 22px;
  color: var(--muted);
  text-align: center;
  line-height: 1.7;
}

.loading-dots::after {
  content: "";
  display: inline-block;
  width: 1.2em;
  text-align: left;
  animation: dots 1.1s steps(4, end) infinite;
}

@keyframes dots {
  0% { content: ""; }
  25% { content: "."; }
  50% { content: ".."; }
  75%, 100% { content: "..."; }
}

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 99;
  display: grid;
  gap: 10px;
  max-width: min(420px, calc(100vw - 44px));
}

.toast-item {
  padding: 13px 15px;
  border-radius: 16px;
  color: white;
  background: rgba(17, 24, 39, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.15);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
  animation: toast-in 0.18s ease-out;
}

.toast-item.ok {
  border-color: rgba(52, 211, 153, 0.34);
}

.toast-item.bad {
  border-color: rgba(251, 113, 133, 0.36);
}

@keyframes toast-in {
  from { transform: translateY(10px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

@keyframes wait-sweep {
  0% { transform: translateX(-100%); }
  55%, 100% { transform: translateX(100%); }
}

@keyframes gradient-flow {
  0% { background-position: 0% 50%; }
  100% { background-position: 200% 50%; }
}

@keyframes image-tile-pulse {
  0%, 100% { opacity: 0.56; transform: translateY(0); }
  50% { opacity: 1; transform: translateY(-2px); }
}

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

.mobile-menu {
  display: none;
}

.hidden {
  display: none !important;
}

@media (max-width: 1080px) {
  .landing-grid,
  .payment-box,
  .settings-grid {
    grid-template-columns: 1fr;
  }

  .stats-grid,
  .stats-grid.four,
  .plans-grid,
  .feature-grid,
  .prompt-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

  .sidebar {
    position: relative;
    top: auto;
    height: auto;
  }

  .chat-list {
    max-height: 260px;
  }
}

@media (max-width: 720px) {
  .landing,
  .shell,
  .content-scroll,
  .messages,
  .composer-wrap {
    padding: 14px;
  }

  .landing-nav,
  .topbar,
  .card-head,
  .user-card-row {
    align-items: flex-start;
    flex-direction: column;
    border-radius: 24px;
  }

  .nav-actions,
  .topbar-actions,
  .hero-actions,
  .inline-actions {
    width: 100%;
  }

  .nav-actions .btn,
  .topbar-actions .btn,
  .hero-actions .btn {
    flex: 1;
  }

  .hero-card {
    padding: 28px;
    min-height: auto;
  }

  .auth-card,
  .panel-card,
  .chat-empty,
  .paywall {
    padding: 20px;
  }

  .form-row,
  .stats-grid,
  .stats-grid.four,
  .plans-grid,
  .feature-grid,
  .prompt-grid,
  .order-actions,
  .api-test-row,
  .plan-row {
    grid-template-columns: 1fr;
  }

  .api-test-actions,
  .settings-actions {
    width: 100%;
  }

  .api-test-actions .btn,
  .settings-actions .btn {
    flex: 1;
  }

  .composer-tools {
    align-items: stretch;
    flex-direction: column;
    padding-bottom: 4px;
  }

  .composer-tool-row,
  .composer-tools .inline-actions {
    width: 100%;
  }

  .composer-tools .inline-actions {
    justify-content: flex-end;
  }

  .progress-wait-note {
    display: grid;
    gap: 4px;
  }

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

  .message-avatar {
    display: none;
  }
}

/* 增强：导航说明、会话状态、图文结果与导出 */
.side-link {
  min-height: 58px;
  align-items: center;
  gap: 10px;
  white-space: normal;
}

.side-icon {
  flex: 0 0 auto;
  width: 28px;
  text-align: center;
}

.side-text {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.side-text strong {
  font-size: 14px;
  line-height: 1.25;
}

.side-text small {
  color: var(--muted-2);
  font-size: 11px;
  line-height: 1.35;
}

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

.chat-title-row .badge {
  min-height: 22px;
  padding: 0 7px;
  font-size: 10px;
}

.message-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0 14px 14px;
}

.notice-card {
  margin: 14px 14px 0;
  padding: 14px 16px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.065);
  color: #eef4ff;
}

.notice-card.warn {
  border-color: rgba(251, 191, 36, 0.34);
  background: rgba(251, 191, 36, 0.10);
}

.notice-card.bad {
  border-color: rgba(251, 113, 133, 0.34);
  background: rgba(251, 113, 133, 0.10);
}

.notice-card.ok {
  border-color: rgba(52, 211, 153, 0.34);
  background: rgba(52, 211, 153, 0.10);
}

.notice-card.info {
  border-color: rgba(114, 229, 255, 0.26);
  background: rgba(114, 229, 255, 0.08);
}

.notice-title {
  font-weight: 900;
  margin-bottom: 6px;
}

.notice-subtitle {
  margin-top: 10px;
  color: #dbeafe;
  font-size: 12px;
  font-weight: 900;
}

.notice-card p {
  margin: 0;
  color: #dbe5fa;
  line-height: 1.7;
}

.notice-card ul {
  margin: 6px 0 0 18px;
  padding: 0;
  color: #dbe5fa;
  line-height: 1.7;
}

.diagnostic-box {
  margin: 0 14px 14px;
  border: 1px dashed rgba(255, 255, 255, 0.16);
  border-radius: 14px;
  background: rgba(0, 0, 0, 0.20);
  overflow: hidden;
}

.diagnostic-box summary {
  cursor: pointer;
  padding: 11px 13px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.diagnostic-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  padding: 0 13px 12px;
}

.diagnostic-grid div {
  border-radius: 12px;
  padding: 9px;
  background: rgba(255, 255, 255, 0.06);
}

.diagnostic-grid span {
  display: block;
  color: var(--muted-2);
  font-size: 11px;
  margin-bottom: 4px;
}

.diagnostic-grid strong {
  font-size: 12px;
  word-break: break-all;
}

.diagnostic-box pre {
  margin: 0 13px 13px;
  white-space: pre-wrap;
  word-break: break-word;
  color: #d1d9ee;
  font-size: 12px;
  line-height: 1.6;
  padding: 12px;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.30);
}

.image-results {
  display: grid;
  gap: 14px;
  padding: 0 14px 14px;
}

.message.assistant.image-focused {
  max-width: 840px;
}

.message.assistant.image-focused .message-body {
  border: 0;
  border-radius: 0;
  background: transparent;
  max-width: min(700px, 100%);
}

.message.image-focused .message-head {
  border-bottom: 0;
  padding: 4px 2px 10px;
  color: var(--muted);
}

.message.image-focused .image-results {
  grid-template-columns: repeat(auto-fit, minmax(min(260px, 100%), 340px));
  justify-content: start;
  justify-items: start;
  padding: 0;
  gap: 14px;
}

.message.image-focused .image-results:has(.image-card:only-child) {
  grid-template-columns: minmax(0, 340px);
}

.image-card {
  margin: 0;
  width: min(340px, 100%);
  overflow: visible;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.message.image-focused .image-card {
  border: 0;
  background: transparent;
  box-shadow: none;
}

.image-stage {
  width: 100%;
  border: 0;
  cursor: zoom-in;
  display: grid;
  place-items: center;
  min-height: 220px;
  padding: 0;
  overflow: hidden;
  border-radius: 12px;
  background: transparent;
}

.message.image-focused .image-stage {
  min-height: clamp(180px, 32vh, 300px);
  background: transparent;
}

.image-stage:hover img {
  transform: scale(1.01);
}

.image-stage img {
  display: block;
  max-width: 100%;
  max-height: 680px;
  object-fit: contain;
  transition: transform 0.16s ease;
}

.message.image-focused .image-stage img {
  max-height: clamp(190px, 34vh, 320px);
}

.image-card figcaption {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 12px;
}

.message.image-focused .image-card figcaption {
  padding: 10px 12px;
  background: rgba(2, 6, 23, 0.28);
}

.image-message-details {
  margin: 0 0 12px;
  max-width: min(520px, 100%);
}

.image-message-details summary {
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 32px;
  padding: 0 10px;
  border-radius: 999px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.045);
  font-size: 13px;
  font-weight: 800;
  list-style: none;
}

.image-message-details summary::-webkit-details-marker {
  display: none;
}

.image-message-details[open] summary {
  margin-bottom: 10px;
}

.image-message-details > .message-content,
.image-message-details > .diagnostic-box,
.image-message-details > .image-details-empty,
.image-message-details > .message-actions {
  max-width: min(520px, 100%);
}

.image-details-empty {
  color: var(--muted-2);
  font-size: 13px;
  line-height: 1.7;
}

.image-message-details > .message-actions {
  padding: 8px 0 0;
}

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

.image-card figcaption strong,
.image-card figcaption span {
  display: block;
}

.image-card figcaption span {
  color: var(--muted-2);
  font-size: 12px;
  margin-top: 3px;
}

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

.image-preview-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(2, 6, 23, 0.82);
  backdrop-filter: blur(18px);
}

.image-preview-dialog {
  position: relative;
  z-index: 1;
  width: min(1120px, 96vw);
  max-height: 92vh;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 20px;
  background: rgba(8, 13, 25, 0.96);
  box-shadow: var(--shadow);
}

.image-preview-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.10);
}

.image-preview-head strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.image-preview-body {
  display: grid;
  place-items: center;
  max-height: calc(92vh - 54px);
  padding: 14px;
}

.image-preview-body img {
  display: block;
  max-width: 100%;
  max-height: calc(92vh - 82px);
  object-fit: contain;
  border-radius: 12px;
}

.message.has-assets {
  max-width: 840px;
}

.cover-brief-box {
  margin-top: 16px;
  padding: 13px 15px;
  border-radius: 16px;
  color: #dbeafe;
  background: rgba(114, 229, 255, 0.08);
  border: 1px solid rgba(114, 229, 255, 0.20);
  line-height: 1.7;
}

.prompt-card.featured {
  border-color: rgba(114, 229, 255, 0.30);
  background: linear-gradient(135deg, rgba(114, 229, 255, 0.12), rgba(139, 92, 246, 0.14));
}

.progress-card {
  padding: 16px;
}

.image-progress-card {
  position: relative;
  overflow: hidden;
}

.image-progress-card::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(110deg, transparent 0%, rgba(114, 229, 255, 0.08) 42%, transparent 70%);
  transform: translateX(-100%);
  animation: wait-sweep 2.4s ease-in-out infinite;
}

.progress-title {
  position: relative;
  color: #dbeafe;
  margin-bottom: 12px;
}

.progress-title strong {
  color: #f8fbff;
}

.progress-wait-note {
  position: relative;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin: -4px 0 12px;
  color: var(--muted-2);
  font-size: 12px;
  line-height: 1.6;
}

.progress-wait-note strong {
  color: #dbeafe;
}

.progressbar {
  position: relative;
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.10);
  border: 1px solid rgba(255, 255, 255, 0.10);
}

.progressbar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--brand), var(--brand-2), var(--brand-3));
  transition: width 0.3s ease;
}

.image-progress-card .progressbar span {
  background-size: 200% 100%;
  animation: gradient-flow 1.4s linear infinite;
}

.image-wait-preview {
  position: relative;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 14px;
}

.image-wait-preview span {
  aspect-ratio: 1;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.10);
  background:
    linear-gradient(135deg, rgba(114, 229, 255, 0.13), rgba(139, 92, 246, 0.08)),
    rgba(255, 255, 255, 0.045);
  animation: image-tile-pulse 1.6s ease-in-out infinite;
}

.image-wait-preview span:nth-child(2) { animation-delay: 0.16s; }
.image-wait-preview span:nth-child(3) { animation-delay: 0.32s; }
.image-wait-preview span:nth-child(4) { animation-delay: 0.48s; }

.image-wait-preview i {
  position: absolute;
  right: 10px;
  bottom: 10px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, 0.18);
  border-top-color: var(--brand);
  animation: spin 0.9s linear infinite;
}

.progress-steps {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-top: 12px;
}

.progress-steps span {
  padding: 8px 9px;
  border-radius: 12px;
  color: var(--muted-2);
  background: rgba(255, 255, 255, 0.055);
  font-size: 12px;
  line-height: 1.45;
}

.progress-steps span.done {
  color: #e8f7ff;
  background: rgba(114, 229, 255, 0.13);
}

.settings-hint {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.65;
  padding: 11px 12px;
  border-radius: 14px;
  background: rgba(114, 229, 255, 0.07);
  border: 1px solid rgba(114, 229, 255, 0.16);
}

.test-output {
  white-space: normal;
}

.test-answer {
  line-height: 1.8;
}

#printArea {
  display: none;
}

@page {
  size: A4;
  margin: 12mm;
}

@media print {
  body.print-mode > *:not(#printArea) {
    display: none !important;
  }

  body.print-mode #printArea {
    display: block !important;
  }

  body.print-mode {
    background: white !important;
    color: #111827 !important;
  }

  .print-page {
    color: #111827;
    font-family: "PingFang SC", "Microsoft YaHei", Arial, sans-serif;
    padding: 24px;
    print-color-adjust: exact;
    -webkit-print-color-adjust: exact;
  }

  .print-page.deliverable-print {
    padding: 0;
  }

  .print-page h1 {
    margin: 0 0 18px;
    font-size: 24px;
  }

  .print-message {
    break-inside: avoid;
    page-break-inside: avoid;
    border: 1px solid #d1d5db;
    border-radius: 14px;
    padding: 16px;
    margin: 0 0 14px;
    background: white;
  }

  .print-meta {
    color: #6b7280;
    font-size: 12px;
    margin-bottom: 10px;
  }

  .print-content {
    line-height: 1.75;
  }

  .print-content pre,
  .print-message pre {
    white-space: pre-wrap;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    padding: 10px;
    background: #f9fafb;
    color: #111827;
  }

  .print-image-results {
    display: grid;
    gap: 14px;
    padding-top: 12px;
  }

  .print-image-card {
    break-inside: avoid;
    page-break-inside: avoid;
    margin: 0;
    border: 1px solid #d1d5db;
    border-radius: 12px;
    padding: 12px;
    background: white;
  }

  .print-image-card + .print-image-card {
    break-before: page;
    page-break-before: always;
  }

  .print-image-stage {
    display: grid;
    place-items: center;
    min-height: 80mm;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    padding: 8mm;
    background: #f9fafb;
  }

  .print-image-stage img {
    display: block;
    max-width: 100%;
    max-height: 180mm;
    object-fit: contain;
  }

  .print-image-card figcaption {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin-top: 10px;
    color: #6b7280;
    font-size: 12px;
  }

  .print-image-card figcaption strong {
    color: #111827;
  }

  .print-message .image-results {
    padding: 12px 0 0;
  }

  .print-message .image-card {
    border-color: #d1d5db;
    background: white;
  }

  .print-message .image-stage {
    min-height: auto;
    background: white;
  }

  .print-message .image-stage img {
    max-height: 720px;
  }

  .print-message .image-card figcaption {
    color: #111827;
  }

  .deliverable-page {
    page-break-after: always;
    break-after: page;
    min-height: 258mm;
    color: #111827;
    background: white;
    font-family: "PingFang SC", "Microsoft YaHei", Arial, sans-serif;
    print-color-adjust: exact;
    -webkit-print-color-adjust: exact;
  }

  .deliverable-page:last-child {
    page-break-after: auto;
  }

  .cover-sheet {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 18px;
    padding: 34mm 24mm;
  }

  .deliverable-brand {
    color: #2563eb;
    font-size: 15px;
    font-weight: 800;
    letter-spacing: 0;
  }

  .cover-sheet h1 {
    margin: 0;
    max-width: 150mm;
    font-size: 34px;
    line-height: 1.2;
  }

  .cover-sheet p {
    margin: 0;
    color: #4b5563;
    font-size: 16px;
  }

  .cover-sheet dl {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    margin: 18px 0 0;
  }

  .cover-sheet dt,
  .appendix-block h2 {
    color: #6b7280;
    font-size: 12px;
    font-weight: 700;
  }

  .cover-sheet dd {
    margin: 5px 0 0;
    font-size: 14px;
    font-weight: 800;
  }

  .image-sheet {
    display: grid;
    grid-template-rows: auto 1fr auto;
    gap: 14px;
    padding: 14mm;
  }

  .image-sheet header,
  .image-sheet footer,
  .appendix-sheet header {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: center;
    color: #6b7280;
    font-size: 11px;
  }

  .image-sheet header strong,
  .appendix-sheet header strong {
    color: #111827;
    font-size: 15px;
  }

  .deliverable-image-frame {
    display: grid;
    place-items: center;
    border: 1px solid #e5e7eb;
    border-radius: 14px;
    padding: 10mm;
    background: #f9fafb;
  }

  .deliverable-image-frame img {
    display: block;
    max-width: 100%;
    max-height: 210mm;
    object-fit: contain;
    border-radius: 8px;
  }

  .appendix-sheet {
    display: grid;
    align-content: start;
    gap: 16px;
    padding: 18mm;
  }

  .appendix-block {
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 12px;
  }

  .appendix-block h2 {
    margin: 0 0 8px;
  }

  .appendix-block p {
    margin: 0;
    line-height: 1.75;
  }

  .appendix-block pre {
    margin: 0;
    white-space: pre-wrap;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
    font-size: 11px;
    line-height: 1.55;
  }

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

  .appendix-grid div {
    display: grid;
    gap: 4px;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    padding: 10px;
  }

  .appendix-grid span {
    color: #6b7280;
    font-size: 12px;
  }
}

@media (max-width: 720px) {
  .diagnostic-grid,
  .progress-steps {
    grid-template-columns: 1fr;
  }

  .image-card figcaption {
    align-items: flex-start;
    flex-direction: column;
  }
}

/* 二次优化：结构化消息、可折叠诊断、外部图片结果展示 */
.message-content p {
  margin: 0 0 12px;
}

.message-content p:last-child {
  margin-bottom: 0;
}

.message-content h3 {
  margin: 18px 0 10px;
  padding: 10px 12px;
  border-radius: 14px;
  color: #e0f2fe;
  background: rgba(114, 229, 255, 0.075);
  border: 1px solid rgba(114, 229, 255, 0.16);
  font-size: 16px;
  line-height: 1.45;
}

.message-content h3:first-child {
  margin-top: 0;
}

.message-content ul {
  margin: 0 0 14px;
  padding: 0;
  display: grid;
  gap: 8px;
  list-style: none;
}

.message-content li {
  position: relative;
  padding: 9px 12px 9px 30px;
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid rgba(255, 255, 255, 0.075);
  line-height: 1.7;
}

.message-content li::before {
  content: "";
  position: absolute;
  left: 13px;
  top: 21px;
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: var(--brand);
  box-shadow: 0 0 0 4px rgba(114, 229, 255, 0.10);
}

.code-card {
  margin: 14px 0 18px;
  overflow: hidden;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.11);
  background: rgba(3, 7, 18, 0.54);
}

.code-card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 13px;
  color: #dbeafe;
  font-size: 12px;
  font-weight: 900;
  background: rgba(255, 255, 255, 0.055);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.message-content pre,
.code-card pre,
.print-content pre,
.print-message pre {
  white-space: pre-wrap;
  word-break: break-word;
  overflow-x: hidden;
}

.code-card pre {
  margin: 0;
  padding: 14px;
  border: 0;
  border-radius: 0;
  background: rgba(0, 0, 0, 0.24);
}

.asset-pill {
  display: inline-flex !important;
  align-items: center;
  margin-left: 8px;
  padding: 2px 7px;
  border-radius: 999px;
  color: #fde68a;
  border: 1px solid rgba(251, 191, 36, 0.28);
  background: rgba(251, 191, 36, 0.10);
  font-size: 11px;
  font-weight: 800;
  vertical-align: middle;
}

.diagnostic-box {
  margin: 0 14px 14px;
}

.diagnostic-toggle {
  width: 100%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 13px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.045);
  border: 1px dashed rgba(255, 255, 255, 0.16);
  border-radius: 14px;
  text-align: left;
}

.diagnostic-toggle span {
  font-size: 12px;
  font-weight: 900;
}

.diagnostic-toggle small {
  color: var(--muted-2);
  font-size: 11px;
}

.diagnostic-content {
  margin-top: 8px;
  border: 1px dashed rgba(255, 255, 255, 0.16);
  border-radius: 14px;
  background: rgba(0, 0, 0, 0.20);
  overflow: hidden;
}

.diagnostic-content[hidden] {
  display: none !important;
}

.image-card figcaption strong .asset-pill,
.image-card figcaption span.asset-pill {
  margin-top: 0;
}

.print-content h3 {
  margin: 14px 0 8px;
  padding: 8px 10px;
  border-radius: 10px;
  background: #eff6ff;
  color: #111827;
  font-size: 15px;
}

.print-content ul {
  margin: 0 0 12px 20px;
  padding: 0;
}

.print-content li {
  margin-bottom: 5px;
}

@media print {
  .code-card {
    border-color: #e5e7eb;
    background: #f9fafb;
  }

  .code-card-head {
    color: #374151;
    background: #f3f4f6;
    border-bottom-color: #e5e7eb;
  }

  .message-content li::before {
    display: none;
  }

  .asset-pill,
  .diagnostic-box,
  .message-actions {
    display: none !important;
  }
}

.diagnostic-box {
  border: 0;
  background: transparent;
  overflow: visible;
}
