:root {
  color-scheme: dark;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --bg: #07080b;
  --bar: #121318;
  --side: #17181e;
  --panel: #0d0e12;
  --panel-2: #14151b;
  --line: #25262c;
  --line-soft: #1b1c22;
  --text: #f2f4f8;
  --muted: #9aa0ac;
  --muted-2: #c8ccd6;
  --heading-soft: #e8ebf2;
  --button-bg: #191a20;
  --button-hover: #202128;
  --button-border-hover: #454751;
  --input-bg: #101116;
  --nav-text: #d8dbe2;
  --nav-active: #202126;
  --nav-active-text: #ffffff;
  --card-bg: #111218;
  --card-text: #f2f4f8;
  --card-muted: #a7adba;
  --badge-bg: #202a36;
  --badge-text: #d5e4f6;
  --copy-bg: #171a22;
  --copy-text: #edf2fb;
  --copy-border: #303746;
  --ribbon-bg: #191d27;
  --ribbon-alt: #22182a;
  --ribbon-third: #14242b;
  --ribbon-text: #eaf0fb;
  --hero-overlay: rgba(255, 255, 255, 0.02);
  --hero-accent: #b97cff;
  --surface-soft: rgba(16, 17, 22, 0.76);
  --surface-deep: #101116;
  --code: #b8cffd;
  --mini-btn-bg: #363840;
  --mini-btn-text: #d8dbe2;
  --side-label: #858b96;
  --side-link: #b9bec8;
  --danger-bg: #3a141a;
  --danger-border: #6f2630;
  --danger-text: #ffdce1;
  --danger-hover-bg: #551d26;
  --danger-hover-border: #b23a4a;
  --shadow: rgba(0, 0, 0, 0.36);
  --purple: #8236d9;
  --purple-2: #a855f7;
  --blue: #2f80ed;
  --green: #32c66b;
  --cyan: #18a8bd;
  --gold: #dfb51f;
  --pink: #c23591;
  --orange: #f07a15;
  --success-soft-bg: rgba(50, 198, 107, 0.18);
  --success-soft-text: #9df0bd;
  --danger-soft-bg: rgba(226, 72, 72, 0.18);
  --danger-soft-text: #ffb5b5;
  --neutral-soft-bg: rgba(154, 160, 172, 0.18);
  --neutral-soft-text: #d8dce5;
  --pre-bg: #08090c;
  --pre-border: #22242a;
  --pre-text: #d7dce7;
  --notice-bg: rgba(61, 255, 202, 0.08);
  --notice-text: #b7bdc9;
  /* commercial layout tokens */
  --radius: 12px;
  --radius-sm: 10px;
  --radius-xs: 8px;
  --control-h: 40px;
  --control-h-sm: 34px;
  --space-1: 6px;
  --space-2: 10px;
  --space-3: 14px;
  --space-4: 18px;
  --space-5: 24px;
  --side-w: 200px;
  --content-max: 1280px;
}

body.theme-light {
  color-scheme: light;
  --bg: #f4f6fb;
  --bar: #ffffff;
  --side: #eef1f7;
  --panel: #ffffff;
  --panel-2: #f7f8fc;
  --line: #d5dbe8;
  --line-soft: #e6eaf3;
  --text: #151a24;
  --muted: #5b6576;
  --muted-2: #4e586a;
  --heading-soft: #2a3140;
  --button-bg: #eef1f7;
  --button-hover: #e3e8f2;
  --button-border-hover: #b8c1d4;
  --input-bg: #ffffff;
  --nav-text: #3a4456;
  --nav-active: #e4e9f4;
  --nav-active-text: #151a24;
  --card-bg: #ffffff;
  --card-text: #1a2130;
  --card-muted: #5c6678;
  --badge-bg: #e7eef9;
  --badge-text: #2a3b52;
  --copy-bg: #f7f9fd;
  --copy-text: #2c3648;
  --copy-border: #cfd7e6;
  --ribbon-bg: #e4e8f2;
  --ribbon-alt: #f6dce8;
  --ribbon-third: #d6eef3;
  --ribbon-text: #1d2433;
  --hero-overlay: rgba(90, 110, 160, 0.04);
  --hero-accent: #7b3fd4;
  --surface-soft: rgba(255, 255, 255, 0.88);
  --surface-deep: #f0f3f9;
  --code: #355fbf;
  --mini-btn-bg: #e7ebf4;
  --mini-btn-text: #2f3848;
  --side-label: #6a7384;
  --side-link: #3b4558;
  --danger-bg: #fdecee;
  --danger-border: #efb4bb;
  --danger-text: #9b2433;
  --danger-hover-bg: #f9d5da;
  --danger-hover-border: #e08a95;
  --shadow: rgba(24, 34, 56, 0.1);
  --purple: #7b3fd4;
  --purple-2: #8b4de0;
  --blue: #2a6fd6;
  --green: #1f9a52;
  --cyan: #0f8a9c;
  --gold: #c49214;
  --pink: #b02d7a;
  --orange: #d96a12;
  --success-soft-bg: rgba(34, 160, 90, 0.12);
  --success-soft-text: #176b3a;
  --danger-soft-bg: rgba(210, 60, 60, 0.12);
  --danger-soft-text: #a12c2c;
  --neutral-soft-bg: rgba(100, 110, 130, 0.12);
  --neutral-soft-text: #4a5466;
  --pre-bg: #f3f5fa;
  --pre-border: #d5dce9;
  --pre-text: #2a3344;
  --notice-bg: rgba(40, 140, 120, 0.08);
  --notice-text: #3d4a5c;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
}

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

button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: var(--control-h-sm);
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-xs);
  background: var(--button-bg);
  color: var(--text);
  font-weight: 700;
  line-height: 1.2;
  white-space: nowrap;
  cursor: pointer;
  transition: background .15s ease, border-color .15s ease, color .15s ease;
}

button:hover {
  border-color: var(--button-border-hover);
  background: var(--button-hover);
}

button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

input, textarea, select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius-xs);
  background: var(--input-bg);
  color: var(--text);
  outline: none;
  transition: border-color .15s ease, box-shadow .15s ease;
}

input:focus,
textarea:focus,
select:focus {
  border-color: color-mix(in srgb, var(--purple-2) 55%, var(--line));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--purple) 18%, transparent);
}

input::placeholder,
textarea::placeholder {
  color: var(--muted);
  opacity: 0.85;
}

input, select {
  height: var(--control-h);
  padding: 0 12px;
}

textarea {
  min-height: 120px;
  padding: 12px 14px;
  resize: vertical;
  line-height: 1.55;
}

code {
  color: var(--code);
}

.app {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

body.console-open .app {
  height: 100dvh;
  max-height: 100dvh;
  overflow: hidden;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  height: 56px;
  padding: 0 18px;
  border-bottom: 1px solid var(--line-soft);
  background: var(--bar);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: max-content;
  height: 38px;
  padding: 0 8px;
  border-color: transparent;
  background: transparent;
}

.brand-avatar {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: linear-gradient(135deg, #ff9abd, #9b5df4);
}

.topnav {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
  overflow-x: auto;
}

.topnav button {
  min-width: max-content;
  border-color: transparent;
  background: transparent;
  color: var(--nav-text);
}

.topnav button.active,
.topnav button:hover {
  background: var(--nav-active);
  color: var(--nav-active-text);
}

.workspace {
  display: none;
  grid-template-columns: var(--side-w) minmax(0, 1fr);
  height: calc(100dvh - 56px);
  min-height: 0;
  overflow: hidden;
}

body.console-open .workspace {
  display: grid;
}

body.console-open .public-home {
  display: none;
}

body.console-open .public-page {
  display: none;
}

.admin-only {
  display: none;
}

body.admin-open .admin-only {
  display: block;
}

body.admin-open .user-only {
  display: none;
}

.public-home {
  height: calc(100dvh - 56px);
  max-height: calc(100dvh - 56px);
  overflow: hidden;
}

.public-page {
  display: none;
  min-height: calc(100vh - 56px);
}

.public-page.active {
  display: block;
}

.public-hero {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(300px, 380px);
  align-items: center;
  gap: clamp(28px, 5vw, 64px);
  height: 100%;
  min-height: 0;
  padding: clamp(24px, 5vh, 56px) clamp(20px, 5vw, 80px);
  overflow: hidden;
  isolation: isolate;
}

.hero-atmosphere {
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(ellipse 55% 50% at 78% 42%, color-mix(in srgb, var(--cyan) 18%, transparent), transparent 70%),
    radial-gradient(ellipse 48% 55% at 18% 68%, color-mix(in srgb, var(--purple) 26%, transparent), transparent 68%),
    radial-gradient(circle at 52% 8%, color-mix(in srgb, var(--blue) 12%, transparent), transparent 42%),
    linear-gradient(165deg, color-mix(in srgb, var(--panel-2) 70%, transparent) 0%, transparent 55%);
  animation: heroAurora 18s ease-in-out infinite alternate;
}

.hero-atmosphere::after {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0.35;
  background-image:
    linear-gradient(color-mix(in srgb, var(--line) 55%, transparent) 1px, transparent 1px),
    linear-gradient(90deg, color-mix(in srgb, var(--line) 55%, transparent) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: radial-gradient(ellipse 70% 65% at 50% 45%, #000 20%, transparent 78%);
}

@keyframes heroAurora {
  from { transform: translate3d(0, 0, 0) scale(1); }
  to { transform: translate3d(-1.5%, 1.2%, 0) scale(1.04); }
}

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

@media (prefers-reduced-motion: reduce) {
  .hero-atmosphere,
  .hero-copy,
  .hero-lede,
  .hero-actions,
  .hero-meta,
  .login-card {
    animation: none !important;
  }
}

@media (max-width: 980px) {
  .public-home {
    height: auto;
    max-height: none;
    overflow: visible;
  }

  .public-hero {
    grid-template-columns: 1fr;
    align-items: start;
    height: auto;
    min-height: calc(100dvh - 56px);
    padding-top: 28px;
    padding-bottom: 36px;
  }

  .login-card {
    max-width: 440px;
    width: 100%;
    justify-self: start;
  }
}

body.theme-light .public-hero {
  background: transparent;
}

body.theme-light .hero-atmosphere {
  background:
    radial-gradient(ellipse 55% 50% at 78% 40%, rgba(24, 168, 189, 0.12), transparent 70%),
    radial-gradient(ellipse 48% 55% at 16% 70%, rgba(130, 54, 217, 0.14), transparent 68%),
    linear-gradient(180deg, #eef2fb 0%, var(--bg) 62%);
}

.hero-copy {
  min-width: 0;
  max-width: 640px;
  animation: heroRise 0.7s ease both;
}

.eyebrow {
  margin: 0 0 14px;
  color: color-mix(in srgb, var(--cyan) 55%, var(--muted-2));
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.hero-copy h1 {
  margin: 0;
  color: var(--text);
  font-family: "Avenir Next", "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-size: clamp(40px, 6.2vw, 72px);
  font-weight: 750;
  line-height: 1.05;
  letter-spacing: -0.035em;
}

.hero-lede {
  max-width: 34em;
  margin: 18px 0 0;
  color: var(--muted-2);
  font-size: clamp(15px, 1.5vw, 18px);
  line-height: 1.65;
  animation: heroRise 0.75s ease 0.08s both;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 28px;
  animation: heroRise 0.75s ease 0.14s both;
}

.hero-actions button,
.login-card button {
  min-height: 44px;
  padding: 0 18px;
  color: var(--text);
}

.hero-actions button:first-child,
.login-card button:first-of-type {
  border-color: transparent;
  background: linear-gradient(135deg, #6d2fd4, #9b5cff 55%, #18a8bd);
  color: #fff;
  box-shadow: 0 10px 28px rgba(109, 47, 212, 0.28);
}

.hero-actions button:first-child:hover,
.login-card button:first-of-type:hover {
  filter: brightness(1.06);
}

.hero-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
  margin: 28px 0 0;
  color: var(--muted);
  font-size: 13px;
  animation: heroRise 0.75s ease 0.2s both;
}

.hero-meta strong {
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.hero-meta code {
  color: var(--muted-2);
  font-size: 12.5px;
}

.hero-meta-sep {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--line);
}

body.theme-light .hero-actions button:not(:first-child),
body.theme-light .login-card .auth-actions button:not(:first-child),
body.theme-light .login-card > button#showRegister {
  color: var(--text);
  background: var(--button-bg);
  border-color: var(--line);
}

body.theme-light .brand {
  color: var(--text);
}

body.theme-light .brand strong {
  color: var(--text);
}

.side-highlight {
  position: relative;
  font-weight: 900 !important;
}

body:not(.theme-light) .side-highlight {
  color: #f0d9ff !important;
}

body.theme-light .side-highlight {
  color: #5a1fad !important;
}

.agent-promo-card,
.agent-access-panel {
  border-color: color-mix(in srgb, var(--purple) 35%, var(--line));
  background: color-mix(in srgb, var(--purple) 8%, var(--panel));
}

.agent-promo-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 12px 0;
}

.hero-agent-btn {
  min-height: 44px !important;
  padding: 0 18px !important;
  font-size: 15px !important;
}

.agent-hint,
.agent-pack-preview {
  width: 100%;
}

.agent-pack-preview {
  min-height: 320px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12.5px;
  line-height: 1.55;
  white-space: pre;
}

.agent-preview-label {
  display: block;
  margin: 12px 0 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.agent-steps {
  margin-bottom: 16px;
}

.agent-will-list {
  margin: 0 0 14px;
  padding-left: 18px;
  color: var(--muted-2);
  line-height: 1.75;
}

.agent-install-line {
  margin-top: 8px;
}

.home-stats {
  display: none;
}

.home-lines {
  display: none;
}

.home-panels {
  display: none;
}

.site-footer {
  margin-top: auto;
  padding: 20px clamp(22px, 6vw, 92px) 28px;
  border-top: 1px solid var(--line-soft);
  text-align: center;
}

.site-footer a {
  color: var(--muted);
  font-size: 13px;
  text-decoration: none;
}

.site-footer a:hover {
  color: var(--text);
  text-decoration: underline;
}

.site-footer .footer-kefu {
  display: inline-block;
  margin-right: 14px;
  color: var(--accent, #0f766e);
  font-weight: 600;
}

a.topnav-kefu {
  display: inline-flex;
  align-items: center;
  padding: 6px 12px;
  border-radius: 999px;
  text-decoration: none;
  color: var(--text);
  border: 1px solid var(--line-soft);
  font-size: 14px;
  font-weight: 600;
}

a.topnav-kefu:hover {
  border-color: var(--accent, #0f766e);
  color: var(--accent, #0f766e);
}

.kefu-fab {
  position: fixed;
  right: 18px;
  bottom: 22px;
  z-index: 80;
  width: 52px;
  height: 52px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: #0f766e;
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
  box-shadow: 0 10px 24px rgba(15, 118, 110, 0.35);
}

.kefu-fab:hover {
  filter: brightness(1.06);
}

.faq-grid {
  display: grid;
  gap: 10px;
}

.faq-grid p {
  margin: 0;
  color: var(--muted-2);
  line-height: 1.6;
}

.login-card {
  position: relative;
  width: 100%;
  max-width: 380px;
  padding: 26px 24px;
  border: 1px solid color-mix(in srgb, var(--line) 80%, transparent);
  border-radius: 18px;
  background: color-mix(in srgb, var(--panel) 78%, transparent);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  box-shadow:
    0 1px 0 color-mix(in srgb, #fff 6%, transparent) inset,
    0 24px 60px rgba(0, 0, 0, 0.35);
  justify-self: end;
  animation: heroRise 0.8s ease 0.12s both;
}

.login-card h2 {
  margin: 0 0 6px;
  font-size: 22px;
  letter-spacing: -0.02em;
}

.login-card p,
.login-card label,
.login-divider {
  color: var(--muted);
}

.login-card p {
  margin: 0 0 18px;
  line-height: 1.55;
  font-size: 13px;
}

.login-card label {
  display: block;
  margin: 0 0 6px;
  font-size: 12.5px;
  font-weight: 700;
}

.login-card input {
  margin-bottom: 12px;
}

.login-card > button,
.login-card .auth-actions {
  margin-top: 4px;
  margin-bottom: 10px;
}

.login-card pre,
.login-result {
  margin: 8px 0 0;
  max-height: 88px;
  padding: 10px 12px;
  overflow: auto;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--pre-bg);
  color: var(--pre-text);
  font-size: 12.5px;
  line-height: 1.45;
  white-space: pre-wrap;
}

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

.auth-actions button {
  width: 100%;
  min-height: var(--control-h);
}

.register-panel {
  max-width: 520px;
}

.login-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 4px 0 12px;
  font-size: 12px;
  font-weight: 900;
}

.login-divider::before,
.login-divider::after {
  content: "";
  height: 1px;
  flex: 1;
  background: var(--line);
}

.public-section {
  padding: 96px clamp(22px, 6vw, 92px) 46px;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

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

.section-head p {
  margin: 7px 0 0;
  color: var(--muted);
  line-height: 1.6;
}

.section-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.sidebar {
  align-self: stretch;
  width: var(--side-w);
  height: 100%;
  min-height: 0;
  padding: 16px 12px 20px;
  border-right: 1px solid var(--line-soft);
  background: var(--side);
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
}

.side-section {
  padding: 0 0 12px;
  margin-bottom: 10px;
  border-bottom: 1px solid var(--line-soft);
}

.side-section:last-child {
  border-bottom: 0;
  margin-bottom: 0;
}

.side-section p {
  margin: 0 0 8px 4px;
  color: var(--side-label);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.side-section button {
  display: flex;
  align-items: center;
  width: 100%;
  min-height: 38px;
  height: auto;
  margin: 3px 0;
  padding: 8px 12px;
  border-color: transparent;
  border-radius: var(--radius-xs);
  background: transparent;
  color: var(--side-link);
  text-align: left;
  white-space: normal;
  line-height: 1.25;
  font-size: 13px;
  font-weight: 650;
}

.side-section button.active,
.side-section button:hover {
  background: color-mix(in srgb, var(--purple) 42%, var(--panel));
  color: var(--nav-active-text);
}

body.theme-light .side-section button.active,
body.theme-light .side-section button:hover {
  background: color-mix(in srgb, var(--purple) 14%, #ffffff);
  color: #5a1fad;
  border-color: color-mix(in srgb, var(--purple) 22%, var(--line));
}

.content {
  min-width: 0;
  height: 100%;
  min-height: 0;
  padding: var(--space-5) clamp(16px, 2.5vw, 28px) 28px;
  overflow: auto;
  overscroll-behavior: contain;
}

.content > .tab.active {
  max-width: var(--content-max);
  margin: 0 auto;
}

/* 快速创作：铺满右侧，内部左右分栏各自滚动 */
.content:has(> #chat.active) {
  padding: 0;
  overflow: hidden;
}

.content > #chat.tab.active {
  display: flex;
  flex-direction: column;
  max-width: none;
  margin: 0;
  height: 100%;
  min-height: 0;
}

.tab {
  display: none;
}

.tab.active {
  display: block;
}

.page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: var(--space-4);
  flex-wrap: wrap;
}

.page-head > div:first-child {
  min-width: 0;
  flex: 1 1 220px;
}

.page-head h1 {
  margin: 0;
  font-size: clamp(1.25rem, 1.1rem + 0.6vw, 1.55rem);
  line-height: 1.25;
  letter-spacing: -0.01em;
}

.page-head p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13.5px;
  line-height: 1.5;
}

.page-head > button,
.page-head .dashboard-tools,
.page-head .section-actions {
  flex: 0 0 auto;
  margin-top: 2px;
}

.auth-strip {
  display: flex;
  align-items: center;
  gap: 8px;
  width: min(520px, 48vw);
}

.dashboard-tools {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: var(--space-3);
}

.metric-grid.compact {
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  margin-bottom: var(--space-3);
}

.metric-card,
.block,
.model-card,
.filter-panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
}

.metric-card {
  display: flex;
  flex-direction: column;
  min-height: 118px;
  overflow: hidden;
}

.card-title {
  flex: 0 0 auto;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line-soft);
  color: var(--heading-soft);
  font-size: 12.5px;
  font-weight: 800;
  letter-spacing: 0.01em;
}

.metric-row {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  min-width: 0;
}

.metric-row > div {
  min-width: 0;
}

.metric-row small {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.metric-row strong,
.metric-card > strong {
  display: block;
  margin: 3px 0 0;
  color: var(--text);
  font-size: 17px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.metric-card > strong {
  flex: 1;
  display: flex;
  align-items: center;
  padding: 16px;
  font-size: clamp(1.2rem, 1rem + 0.8vw, 1.5rem);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.metric-dot {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  color: #fff;
  font-size: 12px;
  font-weight: 900;
}

.blue { background: var(--blue); }
.green { background: var(--green); }
.cyan { background: var(--cyan); }
.gold { background: var(--gold); color: #1e1600; }
.pink { background: #9c2ad1; }
.rose { background: var(--pink); }
.indigo { background: #4d5ad7; }
.orange { background: var(--orange); }

.mini-btn {
  min-width: 52px;
  height: 28px;
  padding: 0 10px;
  color: var(--mini-btn-text);
  background: var(--mini-btn-bg);
}

.block {
  margin-top: var(--space-3);
  padding: var(--space-4);
}

.block-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.block-head h2,
.block h2,
.form-block > h2 {
  margin: 0;
  font-size: 15px;
  font-weight: 800;
  letter-spacing: -0.01em;
}

.form-block > h2 {
  margin-bottom: 2px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line-soft);
}

.block-head span {
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

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

.health-grid div {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-deep);
}

.health-grid small {
  display: block;
  color: var(--muted);
}

.health-grid strong {
  display: block;
  margin-top: 6px;
  font-size: 18px;
}

.health-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0;
}

.health-tags span {
  padding: 5px 9px;
  border-radius: 8px;
  background: var(--danger-soft-bg);
  color: var(--danger-soft-text);
  font-size: 12px;
}

.performance-panel {
  overflow: hidden;
}

.model-health-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 14px 0 10px;
  padding-top: 12px;
  border-top: 1px solid var(--line-soft);
}

.model-health-head strong {
  display: block;
  font-size: 14px;
}

.model-health-head span {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.segmented,
.mini-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.segmented button,
.mini-tabs button {
  min-height: 28px;
  padding: 0 10px;
  border-color: transparent;
  font-size: 12px;
}

.segmented button.active,
.mini-tabs button.active {
  border-color: color-mix(in srgb, var(--purple-2) 45%, var(--line));
  background: color-mix(in srgb, var(--purple) 28%, var(--panel));
  color: var(--text);
}

body.theme-light .segmented button.active,
body.theme-light .mini-tabs button.active {
  background: color-mix(in srgb, var(--purple) 12%, #fff);
  color: #5a1fad;
  border-color: color-mix(in srgb, var(--purple) 28%, var(--line));
}

table {
  width: 100%;
  border-collapse: collapse;
  overflow: hidden;
  border-radius: 8px;
  font-size: 13px;
}

th, td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line-soft);
  text-align: left;
}

th {
  color: var(--muted);
  background: var(--panel-2);
}

td {
  color: var(--text);
}

.dashboard-lower {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.rebate-board {
  display: grid;
  grid-template-columns: 1fr 1.25fr 1fr 1fr;
  gap: 14px;
  margin-top: 14px;
}

.rebate-card {
  min-height: 168px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

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

.rebate-card span,
.rebate-card p {
  color: var(--muted);
}

.rebate-card p {
  margin: 24px 0 0;
}

.champion-card {
  display: grid;
  align-content: center;
  min-height: 168px;
  background: linear-gradient(135deg, #243197, #4b1767);
  color: #fff;
}

.champion-card small {
  width: max-content;
  padding: 4px 8px;
  border-radius: 6px;
  background: #ff8a00;
  color: #fff;
  font-weight: 900;
}

.champion-card strong {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  margin: 12px 0;
  border: 3px solid #e9dd29;
  border-radius: 50%;
  background: #40c63f;
  color: #fff;
  font-size: 24px;
}

.champion-card p {
  margin: 0;
  color: #3dffca;
  font-size: 20px;
  font-weight: 900;
}

.admin-refresh-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0 0 12px;
  flex-wrap: wrap;
}

.admin-summary {
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
}

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

.admin-user-actions button {
  height: 28px;
  min-width: 44px;
  padding: 0 8px;
  font-size: 12px;
}

.admin-subhead {
  margin: 16px 0 8px;
  font-size: 15px;
}

.admin-quick-credits {
  margin: 8px 0;
}

.inline-notice {
  margin: 0 0 12px;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--notice-bg);
  color: var(--notice-text);
  line-height: 1.5;
}

.admin-pending-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0 0 14px;
  padding: 12px 14px;
  border-radius: 12px;
  background: rgba(255, 180, 70, 0.12);
  border: 1px solid rgba(255, 180, 70, 0.35);
}

.admin-pending-banner strong {
  display: block;
  margin-bottom: 4px;
}

.admin-pending-banner span {
  color: var(--muted-2);
  font-size: 13px;
}

body.theme-light .admin-pending-banner {
  background: rgba(255, 170, 40, 0.14);
  border-color: rgba(210, 140, 30, 0.35);
}

body.theme-light .admin-pending-banner strong {
  color: #8a4b00;
}

/* —— 管理端财务页 —— */
.finance-today-hero {
  margin-bottom: 14px;
}
.finance-today-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}
.finance-today-head h2 {
  margin: 0 0 4px;
  font-size: 1.05rem;
}
.finance-today-head .muted-copy {
  margin: 0;
}
.finance-day-chip {
  flex: none;
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid var(--line-soft);
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 650;
  white-space: nowrap;
}
.finance-kpi-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}
.finance-kpi {
  display: grid;
  gap: 6px;
  padding: 16px 16px 14px;
  border-radius: 14px;
  border: 1px solid var(--line-soft);
  background: var(--panel-2, rgba(255, 255, 255, 0.02));
  min-width: 0;
}
.finance-kpi-profit {
  border-color: rgba(61, 207, 154, 0.28);
  background: linear-gradient(160deg, rgba(61, 207, 154, 0.12), transparent 70%);
}
.finance-kpi.up .finance-kpi-value {
  color: #3dcf9a;
}
.finance-kpi.down .finance-kpi-value {
  color: #f0a07a;
}
.finance-kpi-label {
  color: var(--muted);
  font-size: 12.5px;
}
.finance-kpi-value {
  font-size: 1.55rem;
  font-weight: 750;
  line-height: 1.15;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}
.finance-kpi-value small {
  margin-left: 4px;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--muted);
}
.finance-kpi-sub,
.finance-hint,
.finance-table-note {
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.4;
}
.finance-hint {
  margin: 12px 0 0;
}
.finance-compare-table {
  width: 100%;
  border-collapse: collapse;
}
.finance-compare-table th,
.finance-compare-table td {
  padding: 10px 12px;
  text-align: right;
  border-bottom: 1px solid var(--line-soft);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.finance-compare-table th:first-child,
.finance-compare-table td:first-child {
  text-align: left;
}
.finance-compare-table th {
  color: var(--muted);
  font-weight: 600;
  font-size: 12.5px;
}
.finance-compare-table tbody tr:last-child td {
  border-bottom: 0;
}
.finance-compare-table .num-up {
  color: #3dcf9a;
  font-weight: 700;
}
.finance-compare-table .num-down {
  color: #f0a07a;
  font-weight: 700;
}
.finance-table-note {
  margin: 10px 0 0;
}
.finance-detail-grid {
  align-items: start;
}
.finance-empty {
  padding: 18px 12px;
  border-radius: 12px;
  border: 1px dashed var(--line-soft);
  text-align: center;
  color: var(--muted);
  font-size: 13px;
}
.finance-mini-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
}
.finance-mini-list > li {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: start;
  padding: 11px 12px;
  border-radius: 12px;
  border: 1px solid var(--line-soft);
  background: var(--panel-2, rgba(255, 255, 255, 0.02));
}
.finance-mini-list strong {
  display: block;
  font-size: 13.5px;
  line-height: 1.35;
}
.finance-mini-list span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}
.finance-mini-side {
  text-align: right;
}
.finance-mini-side strong {
  color: #3dcf9a;
  font-variant-numeric: tabular-nums;
}
.finance-model-main {
  min-width: 0;
  display: grid;
  gap: 4px;
}
.finance-model-main > strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.finance-bar {
  height: 4px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  overflow: hidden;
  margin-top: 2px;
}
body.theme-light .finance-bar {
  background: rgba(20, 30, 50, 0.08);
}
.finance-bar > i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: rgba(125, 211, 252, 0.75);
}
body.theme-light .finance-kpi-profit {
  background: linear-gradient(160deg, rgba(15, 159, 110, 0.1), transparent 70%);
}
body.theme-light .finance-kpi.up .finance-kpi-value,
body.theme-light .finance-compare-table .num-up,
body.theme-light .finance-mini-side strong {
  color: #0f9f6e;
}
body.theme-light .finance-kpi.down .finance-kpi-value,
body.theme-light .finance-compare-table .num-down {
  color: #c45c2a;
}

@media (max-width: 980px) {
  .finance-kpi-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media (max-width: 640px) {
  .finance-kpi-row {
    grid-template-columns: 1fr;
  }
  .finance-today-head {
    flex-direction: column;
  }
}

.nav-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  margin-left: 4px;
  padding: 0 5px;
  border-radius: 999px;
  background: #ff6b4a;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  vertical-align: middle;
}

.metric-card.has-alert,
.metric-card-alert.has-alert {
  box-shadow: inset 0 0 0 1px rgba(255, 107, 74, 0.55);
}

.admin-filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 12px;
}

.admin-filter-bar input,
.admin-filter-bar select {
  min-width: 160px;
}

.token-copy-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 12px;
}

.topup-steps {
  margin: 0 0 12px;
  padding-left: 18px;
  color: var(--muted-2);
  line-height: 1.7;
}

.payment-box {
  display: grid;
  gap: 6px;
  margin: 0 0 12px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  background: var(--panel-2);
  border: 1px solid var(--line-soft);
}

.payment-box strong {
  display: block;
  margin: 0;
  color: var(--text);
  font-size: 13px;
}

.payment-box span,
.payment-box p {
  margin: 0;
  color: var(--muted-2);
  font-size: 13px;
  line-height: 1.55;
}

.payment-pre {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
  line-height: 1.6;
}

.api-line {
  display: grid;
  grid-template-columns: 88px auto minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line-soft);
  min-width: 0;
}

.api-line:last-child {
  border-bottom: 0;
}

.api-line > span:first-child {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
}

.api-line button {
  height: 30px;
  min-width: 56px;
  flex: 0 0 auto;
}

.api-line code {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12.5px;
}

.notice-list p,
.muted-copy {
  margin: 0 0 10px;
  color: var(--muted-2);
  line-height: 1.65;
}

.pricing-layout {
  display: grid;
  grid-template-columns: 270px 1fr;
  gap: 18px;
}

.filter-panel {
  position: sticky;
  top: 76px;
  align-self: start;
  padding: 14px;
  max-height: calc(100vh - 96px);
  overflow: auto;
}

.filter-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.filter-panel p {
  margin: 16px 0 8px;
  color: var(--heading-soft);
  font-size: 13px;
  font-weight: 900;
}

.filter-list {
  display: grid;
  gap: 8px;
}

.filter-list button {
  display: flex;
  justify-content: space-between;
  height: 34px;
  padding: 0 10px;
  color: var(--side-link);
}

.filter-list button.active {
  border-color: var(--purple-2);
  color: var(--hero-accent);
  background: color-mix(in srgb, var(--purple) 12%, var(--panel));
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--purple-2) 20%, transparent) inset;
}

.model-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.model-toolbar h1 {
  margin: 0;
  min-width: max-content;
  font-size: 18px;
}

.searchbox {
  display: flex;
  align-items: center;
  gap: 8px;
  width: min(360px, 100%);
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-2);
  color: var(--muted);
}

.searchbox input {
  border: 0;
  background: transparent;
  padding: 0;
}

.model-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(230px, 1fr));
  gap: 14px;
  margin-top: 16px;
}

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

.model-grid.list-view .model-card {
  min-height: 0;
}

.model-grid.list-view .model-card-head {
  min-height: 0;
}

.pager,
.tool-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
}

.pager span {
  color: var(--muted);
  font-weight: 800;
}

.model-card {
  min-height: 132px;
  padding: 18px;
  border: 1px solid var(--line);
  background: var(--card-bg);
  color: var(--card-text);
}

.model-card-head {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: start;
  min-height: 58px;
}

.model-card h3 {
  margin: 0;
  font-size: 16px;
  word-break: break-word;
}

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

.model-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 10px 0 14px;
}

.model-badges span {
  padding: 4px 7px;
  border-radius: 8px;
  background: var(--badge-bg);
  color: var(--badge-text);
  font-size: 12px;
  font-weight: 900;
}

.model-card.skeleton {
  background: var(--panel-2);
  color: var(--text);
}

.form-block {
  display: grid;
  gap: 12px;
  align-items: stretch;
  min-width: 0;
}

.form-block > button {
  width: fit-content;
  min-width: 120px;
  min-height: var(--control-h);
  justify-self: start;
}

.form-block > .primary-action,
.form-block > button.primary-action {
  width: 100%;
  max-width: 280px;
}

.upstream-key-list {
  display: grid;
  gap: 10px;
}

.upstream-key-summary {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-2);
}

.upstream-key-rows {
  display: grid;
  gap: 8px;
}

.upstream-key-row {
  display: grid;
  grid-template-columns: minmax(160px, 1fr) minmax(150px, auto) auto minmax(110px, 0.75fr) auto;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.025);
}

.upstream-key-main {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.upstream-key-main strong,
.upstream-key-main small,
.upstream-key-error {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.upstream-key-main small,
.upstream-key-error {
  color: var(--muted);
  font-size: 12px;
}

.upstream-key-row .secret-pill {
  max-width: 190px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.inline-notice {
  padding: 10px 12px;
  border: 1px solid rgba(177, 111, 255, 0.28);
  border-radius: 8px;
  background: rgba(177, 111, 255, 0.12);
  color: var(--text);
  font-weight: 800;
}

.filter-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
  align-items: center;
}

.filter-row input,
.filter-row select,
.filter-row button {
  min-width: 0;
  width: 100%;
}

.wallet-grid,
.profile-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-3);
  align-items: start;
}

/* wallet-grid itself is a .block containing two form-blocks */
.wallet-grid.block {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-3);
}

.wallet-grid > .form-block {
  padding: 16px;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-sm);
  background: var(--panel-2);
  height: 100%;
}

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

.profile-grid > div {
  min-width: 0;
  display: grid;
  gap: 12px;
  align-content: start;
  padding: 16px;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-sm);
  background: var(--panel-2);
}

.profile-grid > div > h2 {
  margin: 0;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line-soft);
  font-size: 15px;
}

.profile-grid > div > button {
  width: fit-content;
  min-height: var(--control-h);
}

.amount-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.amount-pills button {
  min-width: 64px;
  min-height: var(--control-h-sm);
  padding: 0 12px;
  flex: 0 0 auto;
}

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

.playground-grid label {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.playground-grid label,
.inline-check {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.inline-check {
  display: flex;
  align-items: center;
  gap: 8px;
}

.inline-check input {
  width: 16px;
  height: 16px;
}

.chat-links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.chat-links pre {
  flex-basis: 100%;
}

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

.rebate-grid div {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-deep);
}

.rebate-grid small {
  display: block;
  color: var(--muted);
}

.rebate-grid strong {
  display: block;
  margin-top: 6px;
  font-size: 18px;
}

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

.primary-action {
  border-color: color-mix(in srgb, var(--purple-2) 50%, var(--line));
  background: color-mix(in srgb, var(--purple) 28%, var(--panel));
  color: var(--text);
}

body.theme-light .primary-action {
  background: color-mix(in srgb, var(--purple) 12%, #fff);
  color: #5a1fad;
  border-color: color-mix(in srgb, var(--purple) 30%, var(--line));
}

body.theme-light .primary-action:hover {
  background: color-mix(in srgb, var(--purple) 18%, #fff);
}

.token-manager {
  padding: 16px;
}

.token-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.token-actions,
.token-filters {
  display: flex;
  align-items: center;
  gap: 8px;
}

.token-actions {
  flex-wrap: wrap;
}

.token-filters {
  margin-left: auto;
  width: min(680px, 100%);
}

.token-filters input {
  min-width: 170px;
}

.token-filters button,
.token-actions button {
  min-width: max-content;
  padding: 0 12px;
}

.token-editor {
  margin-bottom: 14px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-2);
}

.token-editor-head,
.token-editor-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.token-editor-head {
  margin-bottom: 12px;
}

.token-editor-head strong {
  display: block;
  font-size: 16px;
}

.token-editor-head span {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

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

.token-form-grid label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.token-editor-actions {
  justify-content: flex-start;
  margin-top: 12px;
}

.token-table-wrap {
  border: 1px solid var(--line);
  border-radius: 8px;
}

.token-table {
  min-width: 1480px;
  border-collapse: separate;
  border-spacing: 0;
}

.token-table th,
.token-table td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--line-soft);
  vertical-align: middle;
}

.token-table th {
  background: var(--panel-2);
  color: var(--muted);
  font-size: 12px;
}

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

.token-table tr.is-disabled td {
  background: rgba(120, 127, 140, 0.08);
  color: var(--muted);
}

.token-table input[type="checkbox"] {
  width: 16px;
  height: 16px;
  padding: 0;
  accent-color: var(--purple-2);
}

.status-badge,
.quota-pill,
.group-pill,
.limit-pill,
.secret-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 280px;
  min-height: 24px;
  padding: 2px 9px;
  border-radius: 7px;
  background: var(--button-bg);
  color: var(--text);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.status-badge.on {
  background: var(--success-soft-bg);
  color: var(--success-soft-text);
}

.status-badge.off {
  background: var(--danger-soft-bg);
  color: var(--danger-soft-text);
}

.group-pill {
  background: var(--neutral-soft-bg);
  color: var(--neutral-soft-text);
}

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

.secret-pill {
  border: 1px solid var(--line);
  background: rgba(154, 160, 172, 0.16);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  max-width: 360px;
}

.token-key-cell {
  min-width: 300px;
  max-width: 440px;
}

.token-key-box {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  width: 100%;
  max-width: 420px;
  padding: 5px 6px 5px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(154, 160, 172, 0.14);
  box-sizing: border-box;
}

.token-key-text {
  flex: 1 1 auto;
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--text);
  font: 600 12px/1.35 ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  letter-spacing: 0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.token-key-box.is-revealed .token-key-text {
  overflow-x: auto;
  text-overflow: clip;
}

.token-key-actions {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 4px;
}

.token-key-actions button,
.secret-pill button {
  display: grid;
  place-items: center;
  width: 26px;
  min-width: 26px;
  height: 26px;
  min-height: 26px;
  padding: 0;
  border-color: transparent;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
  cursor: pointer;
}

.token-key-actions button:hover,
.secret-pill button:hover {
  background: rgba(255, 255, 255, 0.14);
}

body.theme-light .token-key-box {
  background: rgba(20, 26, 38, 0.06);
}

body.theme-light .token-key-actions button,
body.theme-light .secret-pill button {
  background: rgba(20, 26, 38, 0.08);
}

.compact-token-table .token-table th,
.compact-token-table .token-table td {
  padding: 7px 10px;
}

.copy-fallback {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 50;
  width: min(560px, calc(100vw - 36px));
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 18px 50px var(--shadow);
}

.copy-fallback > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.copy-fallback textarea {
  min-height: 220px;
}

.icon-btn {
  min-height: 28px;
  padding: 0 9px;
  border-color: var(--copy-border);
  background: var(--copy-bg);
  color: var(--copy-text);
  font-size: 12px;
}

.danger-btn {
  min-height: 28px;
  padding: 0 10px;
  border-color: var(--danger-border);
  background: var(--danger-bg);
  color: var(--danger-text);
  font-size: 12px;
}

.danger-btn:hover {
  border-color: var(--danger-hover-border);
  background: var(--danger-hover-bg);
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: var(--radius-sm);
}

.table-wrap table {
  min-width: 640px;
}

.token-table-wrap table {
  min-width: 1100px;
}

.table-wrap th,
.table-wrap td {
  vertical-align: middle;
}

.table-wrap th {
  white-space: nowrap;
}

.table-wrap td {
  white-space: nowrap;
}

.table-wrap td code {
  font-size: 12px;
}

.admin-summary {
  margin-bottom: 14px;
  grid-template-columns: repeat(auto-fit, minmax(148px, 1fr));
}

.admin-page {
  display: none;
  animation: none;
  max-width: var(--content-max);
}

.admin-page.active {
  display: block;
}

#admin > .admin-page.active > .page-head {
  margin-bottom: 14px;
}

#admin > .admin-page.active > .page-head h1 {
  font-size: clamp(1.2rem, 1.1rem + 0.5vw, 1.45rem);
}

.admin-nav {
  text-align: left;
  width: 100%;
}

.admin-nav.active {
  background: color-mix(in srgb, var(--purple) 42%, var(--panel)) !important;
  color: var(--nav-active-text) !important;
  font-weight: 800;
}

body.theme-light .admin-nav.active {
  background: color-mix(in srgb, var(--purple) 14%, #ffffff) !important;
  color: #5a1fad !important;
}

.admin-quick-links .agent-promo-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.admin-quick-links .agent-promo-actions button {
  min-height: var(--control-h);
  min-width: 120px;
}

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

.admin-identity div {
  min-width: 0;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--panel-2);
}

.admin-identity small {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.admin-identity strong {
  display: block;
  margin-top: 8px;
  color: var(--text);
  font-size: 14px;
  line-height: 1.4;
  word-break: break-word;
}

.admin-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-3);
  align-items: start;
}

.admin-grid > .block {
  margin-top: 0;
  height: 100%;
}

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

.toolbar button {
  min-height: var(--control-h-sm);
}

pre {
  max-height: 360px;
  margin: 0;
  padding: 12px 14px;
  overflow: auto;
  border: 1px solid var(--pre-border);
  border-radius: var(--radius-sm);
  background: var(--pre-bg);
  color: var(--pre-text);
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 12.5px;
  line-height: 1.55;
}

/* Result / status boxes under forms — keep compact and readable */
.form-block > pre,
#topupSubmitResult,
#balanceResult,
#userResult,
#syncResult,
#siteContentResult,
#adminAccountResult,
#loginResult,
#registerResult,
#checkinResult {
  max-height: 180px;
  font-family: inherit;
  font-size: 13px;
  line-height: 1.55;
  color: var(--muted-2);
}

.model-toolbar {
  flex-wrap: wrap;
}

.model-toolbar h1 {
  flex: 0 0 auto;
}

.model-toolbar .searchbox {
  flex: 1 1 220px;
}

.dashboard-lower {
  align-items: start;
}

.admin-filter-bar input,
.admin-filter-bar select {
  flex: 1 1 160px;
  min-width: 0;
  max-width: 280px;
}

.admin-filter-bar button {
  flex: 0 0 auto;
}

.upstream-key-row {
  grid-template-columns: minmax(0, 1.2fr) minmax(120px, 0.8fr) auto minmax(0, 0.9fr) auto;
}

/* Primary CTA consistency */
button.primary-action,
.primary-action {
  min-height: var(--control-h);
  padding: 0 18px;
  font-weight: 800;
}

.topnav button {
  min-height: 34px;
  padding: 0 12px;
  border-radius: var(--radius-xs);
}

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

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

.home-panels {
  gap: var(--space-3);
}

/* Agent access: keep actions and preview tidy */
.agent-access-panel .form-block,
#agent .form-block {
  gap: 12px;
}

#agent .agent-promo-actions button {
  min-height: var(--control-h);
}

.form-narrow {
  max-width: 480px;
}

.spaced-head {
  margin-top: 16px;
}

/* Nested form panels inside wallet/admin already styled via wallet-grid > .form-block */
.wallet-grid > .form-block.wallet-panel {
  min-height: 100%;
}

/* Admin form sections as equal cards */
.admin-grid > .form-block,
.admin-grid > .block.form-block {
  display: grid;
  gap: 12px;
}

#admin .block.form-block > button,
#admin .block.form-block > .primary-action {
  min-height: var(--control-h);
}

/* Prevent long admin nav labels from looking cramped */
.side-section.admin-only .admin-nav {
  font-size: 13px;
}

/* Soft empty states */
.table-wrap.muted-copy:empty,
.muted-copy:only-child {
  color: var(--muted);
}

/* Segmented controls size consistency */
.segmented button,
.mini-tabs button,
.amount-pills button {
  border-radius: var(--radius-xs);
}

/* Model cards: equal visual weight */
.model-card {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-height: 148px;
}

.model-card .icon-btn,
.model-card button {
  margin-top: auto;
  align-self: flex-start;
}

/* Dashboard rebate board less crushed */
.rebate-board {
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}

.rebate-card {
  min-height: 160px;
  border-radius: var(--radius);
}

/* Content area for admin section */
#admin.tab.active {
  max-width: none;
}

#admin .admin-page.active {
  margin: 0 auto;
}

@media (max-width: 1180px) {
  .metric-grid,
  .model-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

  .dashboard-lower,
  .pricing-layout,
  .home-panels,
  .wallet-grid,
  .wallet-grid.block,
  .profile-grid,
  .admin-grid {
    grid-template-columns: 1fr;
  }

  .filter-panel {
    position: static;
    max-height: none;
  }

  .admin-identity {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 900px) {
  :root {
    --side-w: 180px;
  }

  .token-toolbar,
  .token-actions,
  .token-filters,
  .token-editor-head,
  .model-health-head,
  .upstream-key-summary {
    align-items: stretch;
    flex-direction: column;
  }

  .token-filters {
    margin-left: 0;
    width: 100%;
  }

  .token-form-grid {
    grid-template-columns: 1fr;
  }

  .upstream-key-row {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .upstream-key-row .secret-pill,
  .upstream-key-error {
    max-width: none;
    white-space: normal;
  }

  .form-block > button,
  .form-block > .primary-action {
    width: 100%;
    max-width: none;
  }
}

@media (max-width: 760px) {
  :root {
    --side-w: 100%;
  }

  .topbar {
    height: auto;
    min-height: 56px;
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    padding: 10px 12px;
  }

  .brand {
    min-width: 0;
    max-width: 100%;
  }

  .brand strong {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .topnav {
    display: flex;
    justify-content: flex-start;
    flex-wrap: wrap;
    width: 100%;
    max-width: 100%;
    overflow-x: visible;
    padding-bottom: 2px;
    gap: 6px;
  }

  .topnav button {
    flex: 0 1 auto;
    min-width: 0;
    padding: 0 10px;
  }

  .workspace {
    grid-template-columns: 1fr;
    height: auto;
    min-height: calc(100dvh - 56px);
    overflow: visible;
  }

  body.console-open .app {
    height: auto;
    max-height: none;
    overflow: visible;
  }

  .sidebar {
    position: sticky;
    top: 0;
    z-index: 15;
    width: 100%;
    display: flex;
    gap: 10px;
    height: auto;
    max-height: none;
    padding: 10px;
    overflow-x: auto;
    overflow-y: hidden;
    border-right: 0;
    border-bottom: 1px solid var(--line-soft);
  }

  .content:has(> #chat.active) {
    min-height: calc(100dvh - 140px);
    height: calc(100dvh - 140px);
  }

  .side-section {
    min-width: 148px;
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: 0;
    border-right: 1px solid var(--line-soft);
    padding-right: 10px;
  }

  .side-section:last-child {
    border-right: 0;
  }

  .side-section button {
    min-height: 36px;
    white-space: nowrap;
  }

  .content {
    padding: 14px 12px 28px;
  }

  .page-head,
  .section-head,
  .auth-strip,
  .model-toolbar {
    align-items: stretch;
    flex-direction: column;
    width: 100%;
  }

  .page-head > button,
  .dashboard-tools button {
    width: 100%;
  }

  .public-section {
    padding: 36px 16px 32px;
  }

  .section-actions {
    justify-content: stretch;
  }

  .section-actions button {
    flex: 1 1 auto;
  }

  .metric-grid,
  .metric-grid.compact,
  .health-grid,
  .model-grid,
  .admin-grid,
  .admin-identity,
  .rebate-board,
  .home-stats,
  .home-lines,
  .filter-row,
  .playground-grid,
  .rebate-grid,
  .wallet-grid,
  .wallet-grid.block,
  .profile-grid {
    grid-template-columns: 1fr;
  }

  .home-panels {
    padding: 0 16px 28px;
  }

  .api-line {
    grid-template-columns: 1fr auto auto;
    gap: 8px;
  }

  .api-line code {
    grid-column: 1 / -1;
    word-break: break-all;
  }

  .login-card {
    justify-self: stretch;
    max-width: none;
  }

  .metric-card > strong {
    white-space: normal;
    word-break: break-all;
  }
}

/* 常见手机宽度（iPhone SE ~ Pro Max）：进一步压缩顶栏，确保登录按钮始终可见可点 */
@media (max-width: 430px) {
  .topbar {
    gap: 8px;
    padding: 8px 10px;
  }

  .topnav {
    gap: 4px;
  }

  .topnav button {
    padding: 0 8px;
    min-height: 32px;
    font-size: 13px;
  }

  .brand {
    height: 34px;
    padding: 0 4px;
    gap: 8px;
  }

  .brand-avatar {
    width: 24px;
    height: 24px;
  }
}

/* —— 钱包：余额一眼可见 + 充值主视觉 —— */
.wallet-hero {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-3);
  margin-bottom: var(--space-3);
}
.wallet-hero-card {
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-rows: auto auto;
  gap: 6px 12px;
  align-items: end;
  padding: 22px 24px;
  border-radius: var(--radius);
  border: 1px solid var(--line-soft);
  background: linear-gradient(145deg, var(--panel-2), var(--panel));
  min-height: 110px;
}
.wallet-hero-card.balance {
  border-color: rgba(167, 139, 250, 0.35);
  box-shadow: 0 0 0 1px rgba(167, 139, 250, 0.08) inset;
}
.wallet-hero-label {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.04em;
}
.wallet-hero-value {
  font-size: clamp(32px, 4vw, 44px);
  line-height: 1;
  font-weight: 760;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}
.wallet-hero-unit {
  color: var(--muted);
  font-size: 14px;
  padding-bottom: 6px;
}
.wallet-topup-hero {
  display: grid;
  gap: 14px;
  padding: 22px 24px 24px !important;
  border: 1px solid rgba(167, 139, 250, 0.28) !important;
  background:
    radial-gradient(120% 80% at 0% 0%, rgba(167, 139, 250, 0.12), transparent 55%),
    var(--panel) !important;
}
.wallet-topup-head h2 {
  margin: 0 0 4px;
  font-size: 18px;
}
.wallet-topup-head .muted-copy {
  font-size: 12.5px;
  margin: 0;
}
.wallet-field-label {
  display: block;
  margin: 0;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--muted);
}
.wallet-amount-pick {
  display: grid;
  gap: 10px;
}
.wallet-amount-pills {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
}
.wallet-amount-pills button {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-width: 0;
  min-height: 72px !important;
  padding: 10px 6px !important;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 650;
  line-height: 1.15;
}
.wallet-amount-pills button strong {
  font-size: clamp(22px, 2.6vw, 28px);
  font-weight: 780;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
  color: var(--text);
}
.wallet-amount-pills button span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}
.wallet-amount-pills button.active {
  border-color: rgba(167, 139, 250, 0.65);
  background: rgba(167, 139, 250, 0.22);
  color: var(--text);
  box-shadow: 0 0 0 1px rgba(167, 139, 250, 0.18) inset;
}
.wallet-amount-pills button.active span {
  color: color-mix(in srgb, var(--purple-2) 55%, var(--muted-2));
}
.wallet-amount-summary {
  margin: 0;
  font-size: 14px;
  color: var(--muted-2);
}
.wallet-amount-summary strong {
  font-size: 18px;
  font-weight: 750;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}
.wallet-amount-yuan {
  margin-left: 6px;
  color: var(--muted);
  font-size: 13px;
}
.wallet-amount-input {
  width: 100%;
  max-width: 220px;
  min-height: 40px !important;
  font-size: 14px !important;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  padding: 0 12px !important;
}
.wallet-topup-row {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 12px;
}
.wallet-pay-method {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}
.wallet-pay-badge {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 8px;
  border: 1px solid rgba(56, 189, 248, 0.35);
  background: rgba(56, 189, 248, 0.14);
  color: #7dd3fc;
  font-size: 13px;
  font-weight: 700;
}
.wallet-pay-method .muted-copy {
  margin: 0;
  font-size: 12.5px;
}
.wallet-field {
  display: grid;
  gap: 6px;
  min-width: 0;
}
.wallet-steps-compact {
  margin: 0;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.45;
}
.wallet-pay-btn {
  width: 100%;
  min-height: 48px !important;
  font-size: 16px !important;
  font-weight: 700;
}
.wallet-pay-hint {
  margin: 0;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--panel-2);
  border: 1px solid var(--line-soft);
  color: var(--muted);
  white-space: pre-wrap;
  font-size: 12.5px;
  line-height: 1.45;
}

.pay-confirm-modal {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.pay-confirm-modal[hidden] {
  display: none !important;
}

.pay-confirm-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(6, 8, 14, 0.62);
}

.pay-confirm-panel {
  position: relative;
  z-index: 1;
  width: min(420px, 100%);
  padding: 22px 22px 18px;
  border-radius: 16px;
  border: 1px solid var(--line-soft);
  background: var(--panel, #12151d);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.35);
}

.pay-confirm-panel input[type="password"],
.pay-confirm-panel input[type="text"] {
  width: 100%;
  margin: 8px 0 0;
  box-sizing: border-box;
}

.pay-confirm-panel #adminResetPassResult {
  margin: 10px 0 0;
  white-space: pre-wrap;
}

.pay-confirm-panel h3 {
  margin: 0 0 8px;
  font-size: 1.15rem;
}

.pay-confirm-facts {
  margin: 16px 0 18px;
  display: grid;
  gap: 10px;
}

.pay-confirm-facts > div {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--hero-overlay, rgba(255, 255, 255, 0.03));
}

.pay-confirm-facts dt {
  color: var(--muted, #9aa3b2);
  font-size: 0.9rem;
}

.pay-confirm-facts dd {
  margin: 0;
  font-size: 1.05rem;
}

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

.ghost-btn {
  appearance: none;
  border: 1px solid var(--line-soft);
  background: transparent;
  color: inherit;
  border-radius: 10px;
  padding: 10px 14px;
  cursor: pointer;
  font: inherit;
}

.ghost-btn:hover {
  background: var(--hero-overlay, rgba(255, 255, 255, 0.04));
}

.admin-user-actions .primary-btn {
  appearance: none;
  border: 0;
  border-radius: 10px;
  padding: 8px 12px;
  cursor: pointer;
  font: inherit;
  font-weight: 600;
  background: var(--accent, #7c5cff);
  color: #fff;
}

body.theme-light .pay-confirm-panel {
  background: #fff;
  box-shadow: 0 18px 48px rgba(20, 30, 50, 0.12);
}

body.theme-light .pay-confirm-backdrop {
  background: rgba(20, 28, 45, 0.35);
}

.wallet-secondary {
  padding: 12px 16px !important;
  opacity: 0.92;
}
.wallet-secondary summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--muted);
  list-style: none;
}
.wallet-secondary summary::-webkit-details-marker { display: none; }
.wallet-secondary summary::before {
  content: "▸ ";
  color: var(--purple-2, #a78bfa);
}
.wallet-secondary[open] summary::before { content: "▾ "; }
.wallet-secondary-body {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}
.wallet-secondary-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}

.wallet-activity {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-3, 16px);
  margin-top: 4px;
}
.wallet-activity-panel {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.wallet-feed {
  margin: 0;
}
.wallet-feed-meta {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 12.5px;
}
.wallet-feed-empty {
  padding: 18px 14px;
  border-radius: 12px;
  border: 1px dashed var(--line-soft);
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
  text-align: center;
}
.wallet-feed-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
  max-height: 420px;
  overflow: auto;
}
.wallet-feed-item {
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-rows: auto auto;
  gap: 4px 12px;
  align-items: start;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--line-soft);
  background: var(--panel-2, rgba(255, 255, 255, 0.02));
}
.wallet-feed-main {
  display: grid;
  gap: 2px;
  min-width: 0;
}
.wallet-feed-title {
  font-size: 14px;
  font-weight: 650;
  line-height: 1.35;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.wallet-feed-time,
.wallet-feed-balance,
.wallet-feed-detail {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}
.wallet-feed-detail {
  grid-column: 1 / -1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.wallet-feed-side {
  display: grid;
  justify-items: end;
  gap: 4px;
  text-align: right;
}
.wallet-feed-amount {
  font-size: 15px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.01em;
}
.wallet-feed-item.tone-in .wallet-feed-amount {
  color: #3dcf9a;
}
.wallet-feed-item.tone-out .wallet-feed-amount {
  color: #f0a07a;
}
body.theme-light .wallet-feed-item.tone-in .wallet-feed-amount {
  color: #0f9f6e;
}
body.theme-light .wallet-feed-item.tone-out .wallet-feed-amount {
  color: #c45c2a;
}
.wallet-status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 0 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 650;
  border: 1px solid var(--line-soft);
  color: var(--muted);
  background: transparent;
}
.wallet-status-pill.status-settled {
  color: #3dcf9a;
  border-color: rgba(61, 207, 154, 0.35);
  background: rgba(61, 207, 154, 0.1);
}
.wallet-status-pill.status-pending {
  color: #e8c36a;
  border-color: rgba(232, 195, 106, 0.35);
  background: rgba(232, 195, 106, 0.1);
}
.wallet-status-pill.status-rejected,
.wallet-status-pill.status-failed {
  color: #f0a07a;
  border-color: rgba(240, 160, 122, 0.35);
  background: rgba(240, 160, 122, 0.1);
}
body.theme-light .wallet-status-pill.status-settled {
  color: #0f9f6e;
}
body.theme-light .wallet-status-pill.status-pending {
  color: #9a6b00;
}
body.theme-light .wallet-status-pill.status-rejected,
body.theme-light .wallet-status-pill.status-failed {
  color: #c45c2a;
}

@media (max-width: 760px) {
  .wallet-hero { grid-template-columns: 1fr; }
  .wallet-topup-row { grid-template-columns: 1fr; }
  .wallet-secondary-row { grid-template-columns: 1fr; }
  .wallet-amount-pills { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .wallet-amount-pills button { min-height: 64px !important; }
  .wallet-amount-input { max-width: none; }
  .wallet-activity { grid-template-columns: 1fr; }
  .wallet-feed-list { max-height: none; }
}
.source-badge {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 1px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
  border: 1px solid transparent;
}
.source-cli {
  background: rgba(56, 189, 248, 0.16);
  color: #7dd3fc;
  border-color: rgba(56, 189, 248, 0.35);
}
.source-web {
  background: rgba(167, 139, 250, 0.16);
  color: #c4b5fd;
  border-color: rgba(167, 139, 250, 0.35);
}
.source-api {
  background: rgba(52, 211, 153, 0.14);
  color: #6ee7b7;
  border-color: rgba(52, 211, 153, 0.3);
}
.source-unknown {
  background: var(--button-bg);
  color: var(--muted);
  border-color: var(--line);
}
.log-cost {
  color: var(--text);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.status-badge.ok {
  background: rgba(52, 211, 153, 0.14);
  color: #6ee7b7;
}
.status-badge.bad {
  background: rgba(248, 113, 113, 0.14);
  color: #fca5a5;
}
.status-badge.warn {
  background: rgba(251, 191, 36, 0.14);
  color: #fbbf24;
}
.money-zero {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.money-charge {
  color: #f8e7a0;
  font-variant-numeric: tabular-nums;
}
.money-flow {
  display: inline-block;
  max-width: 280px;
  font-size: 12px;
  line-height: 1.35;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.money-flow.charged {
  color: var(--text);
}
.toolbar button.active {
  border-color: rgba(248, 231, 160, 0.45);
  color: var(--text);
  background: rgba(248, 231, 160, 0.08);
}
button.id-copy {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 12px;
  cursor: pointer;
  padding: 0;
  text-decoration: underline dotted;
}
button.id-copy:hover {
  color: var(--text);
}
.log-result-count {
  margin: 0 0 10px;
}
.data-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--panel, var(--card-bg, #12121a));
}

/* ========== 快速创作 ========== */
.qc-page {
  background: var(--bg);
}

.qc-topbar {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 56px;
  padding: 10px 18px;
  border-bottom: 1px solid var(--line-soft);
  background: color-mix(in srgb, var(--panel) 88%, transparent);
}

.qc-topbar-left {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 14px 18px;
  min-width: 0;
}

.qc-topbar h1 {
  margin: 0;
  font-size: 18px;
  font-weight: 750;
  letter-spacing: -0.02em;
  white-space: nowrap;
}

.qc-topbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.qc-balance {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  color: var(--muted-2);
  font-size: 13px;
}

.qc-mode-switch {
  display: inline-flex;
  gap: 2px;
  padding: 3px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--panel-2);
}

.qc-mode {
  min-height: 32px;
  padding: 0 14px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 13px;
  font-weight: 650;
  cursor: pointer;
}

.qc-mode:hover {
  color: var(--text);
  background: color-mix(in srgb, var(--button-hover) 80%, transparent);
}

.qc-mode.active {
  color: var(--nav-active-text);
  background: var(--nav-active);
}

.qc-split {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  overflow: hidden;
}

.qc-rail {
  min-height: 0;
  padding: 16px 14px;
  border-right: 1px solid var(--line-soft);
  background: var(--side);
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.qc-rail-block select {
  width: 100%;
}

.qc-hint {
  margin: 8px 0 0;
  font-size: 12px;
  line-height: 1.45;
}

.qc-rail-more {
  margin-top: auto;
  border-top: 1px solid var(--line-soft);
  padding-top: 12px;
}

.qc-rail-more summary {
  cursor: pointer;
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 650;
  list-style: none;
}

.qc-rail-more summary::-webkit-details-marker {
  display: none;
}

.qc-rail-more[open] summary {
  margin-bottom: 10px;
  color: var(--text);
}

.qc-rail-more .tool-row {
  flex-direction: column;
  align-items: stretch;
}

.qc-rail-more button {
  width: 100%;
  justify-content: flex-start;
}

.qc-rail-more pre {
  margin: 8px 0 0;
  max-height: 120px;
  overflow: auto;
  font-size: 11.5px;
}

.qc-stage {
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg);
}

.qc-panel {
  display: none;
  flex: 1;
  min-height: 0;
  flex-direction: column;
  overflow: hidden;
}

.qc-panel.active {
  display: flex;
}

.qc-chat-messages {
  flex: 1;
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.qc-empty {
  margin: auto;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
  text-align: center;
  padding: 24px 12px;
}

.qc-bubble {
  max-width: min(78%, 720px);
  padding: 10px 14px;
  border-radius: 14px;
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.55;
  font-size: 14px;
}

.qc-bubble.user {
  align-self: flex-end;
  background: color-mix(in srgb, var(--purple) 28%, var(--panel));
  border: 1px solid color-mix(in srgb, var(--purple-2) 40%, var(--line));
  color: var(--text);
  border-bottom-right-radius: 6px;
}

.qc-bubble.assistant {
  align-self: flex-start;
  background: var(--panel-2);
  border: 1px solid var(--line);
  color: var(--text);
  border-bottom-left-radius: 6px;
}

.qc-chat-compose {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px 16px 14px;
  border-top: 1px solid var(--line-soft);
  background: color-mix(in srgb, var(--panel) 92%, transparent);
}

.qc-chat-compose textarea,
.qc-gen-form textarea {
  width: 100%;
  resize: none;
  min-height: 72px;
  max-height: 160px;
}

.qc-compose-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.qc-gen-form {
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: end;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line-soft);
  background: color-mix(in srgb, var(--panel) 88%, transparent);
}

.qc-gen-form .primary-action {
  min-height: 44px;
  white-space: nowrap;
}

.qc-panel[data-qc-panel="image"] .qc-hint,
.qc-panel[data-qc-panel="video"] .qc-hint {
  padding: 0 16px;
  margin: 8px 0 0;
}

.qc-media-result {
  flex: 1;
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
  padding: 16px 18px;
}

.qc-preview-img,
.qc-preview-video {
  display: block;
  width: 100%;
  max-width: 820px;
  max-height: calc(100% - 48px);
  object-fit: contain;
  border-radius: 10px;
  background: #000;
  margin-bottom: 10px;
}

@media (max-width: 980px) {
  .qc-split {
    grid-template-columns: 1fr;
    grid-template-rows: auto minmax(0, 1fr);
  }

  .qc-rail {
    max-height: 38vh;
    border-right: 0;
    border-bottom: 1px solid var(--line-soft);
  }

  .qc-rail-more {
    margin-top: 0;
  }

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

  .qc-gen-form {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 860px) {
  .qc-mode-switch {
    display: flex;
    width: 100%;
  }

  .qc-mode {
    flex: 1;
  }
}

.docs-guide h3 {
  margin: 1.25rem 0 0.5rem;
  font-size: 1.05rem;
}

.docs-guide h3:first-child {
  margin-top: 0;
}

.docs-steps,
.docs-ways,
.docs-faq {
  margin: 0.4rem 0 0.8rem;
  padding-left: 1.25rem;
  line-height: 1.65;
}

.docs-guide pre {
  margin: 0.5rem 0 1rem;
  overflow-x: auto;
}

.admin-package-add {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  align-items: end;
  margin: 12px 0;
}

.admin-package-add label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.85rem;
}

.admin-package-add input {
  width: 100%;
}

.admin-packages-table {
  width: 100%;
  border-collapse: collapse;
}

.admin-packages-wrap {
  margin: 10px 0 16px;
  padding: 8px;
  border: 1px solid var(--line-soft, rgba(255,255,255,.08));
  background: rgba(255,255,255,.03);
}

.admin-packages-table th,
.admin-packages-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line-soft, #e5e7eb);
  text-align: left;
  vertical-align: middle;
}

.admin-packages-table input[type="number"],
.admin-packages-table input[type="text"] {
  width: 100%;
  min-width: 88px;
  max-width: 140px;
  background: var(--input-bg, rgba(0,0,0,.25));
  color: inherit;
  border: 1px solid var(--line-soft, rgba(255,255,255,.12));
  border-radius: 8px;
  padding: 8px 10px;
}

.wallet-amount-pills button .pkg-yuan {
  display: block;
  font-size: 0.75rem;
  opacity: 0.75;
  font-weight: 500;
}

@media (max-width: 900px) {
  .admin-package-add {
    grid-template-columns: 1fr 1fr;
  }
}
