/* =====================================================================
   app.css —— 站点共用组件（原生 CSS，无构建）
   依赖 tokens.css。规则见契约 §8：蓝灰极简、白卡片 12px 圆角、8px 网格、
   无渐变 / 无玻璃拟态 / 无图标库；移动端 720px 断点单列。
   ===================================================================== */

/* ---------------- 重置 ---------------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  min-height: 100vh;
  background: var(--canvas);
  color: var(--text);
  font-family: var(--font);
  font-size: var(--fs-body);
  line-height: var(--line-height);
  -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3,
h4,
p,
figure {
  margin: 0;
}

a {
  color: var(--brand);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

img,
svg {
  max-width: 100%;
}

[hidden] {
  display: none !important;
}

:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

/* ---------------- 布局 ---------------- */
.container {
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--space-3);
}

.page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.page-main {
  flex: 1 0 auto;
}

.section {
  padding: var(--space-6) 0;
}

.section-sm {
  padding: var(--space-4) 0;
}

.section-head {
  margin-bottom: var(--space-3);
}

.section-head .section-title {
  margin-bottom: var(--space-1);
}

.row {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.row-wrap {
  flex-wrap: wrap;
}

.row-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
}

.stack {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.grid {
  display: grid;
  gap: var(--space-2);
}

.grid-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.grid-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.grid-4 {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.grow {
  flex: 1 1 auto;
  min-width: 0;
}

.center {
  text-align: center;
}

/* ---------------- 文字 ---------------- */
h1,
.h1 {
  font-size: var(--fs-h1);
  font-weight: 800;
  line-height: 1.25;
  letter-spacing: -0.5px;
}

h2,
.h2 {
  font-size: var(--fs-h2);
  font-weight: 800;
  line-height: 1.3;
  letter-spacing: -0.2px;
}

h3,
.h3 {
  font-size: var(--fs-h3);
  font-weight: 700;
  line-height: 1.4;
}

.section-title {
  font-size: var(--fs-h2);
  font-weight: 800;
  line-height: 1.3;
}

.section-desc {
  color: var(--muted);
  font-size: var(--fs-small);
}

.text-secondary {
  color: var(--secondary);
}

.text-muted {
  color: var(--muted);
  font-size: var(--fs-small);
}

.text-success {
  color: var(--success);
}

.text-warning {
  color: var(--warning);
}

.text-danger {
  color: var(--danger);
}

.text-brand {
  color: var(--brand);
}

.mono {
  font-family: var(--font-mono);
  font-size: var(--fs-small);
  word-break: break-all;
}

.nowrap {
  white-space: nowrap;
}

.mt-1 {
  margin-top: var(--space-1);
}

.mt-2 {
  margin-top: var(--space-2);
}

.mt-3 {
  margin-top: var(--space-3);
}

.mt-4 {
  margin-top: var(--space-4);
}

.mb-2 {
  margin-bottom: var(--space-2);
}

.mb-3 {
  margin-bottom: var(--space-3);
}

/* ---------------- 顶部导航 ---------------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: var(--z-header);
  background: var(--card);
  border-bottom: 1px solid var(--line);
}

.header-inner {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  height: var(--header-height);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  color: var(--text);
  font-weight: 800;
  font-size: 16px;
  text-decoration: none;
  flex: 0 0 auto;
}

.brand:hover {
  text-decoration: none;
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: var(--brand-weak);
  color: var(--brand);
  font-size: 15px;
  font-weight: 800;
}

.nav {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: 1 1 auto;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: none;
}

.nav::-webkit-scrollbar {
  display: none;
}

.nav-link {
  padding: 6px 10px;
  border-radius: var(--radius-btn);
  color: var(--secondary);
  font-size: var(--fs-small);
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}

.nav-link:hover {
  background: var(--surface);
  color: var(--text);
  text-decoration: none;
}

.nav-link.active {
  background: var(--brand-weak);
  color: var(--brand);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  flex: 0 0 auto;
}

.balance-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: var(--radius-btn);
  background: var(--surface);
  color: var(--secondary);
  font-size: var(--fs-tiny);
  white-space: nowrap;
}

.balance-chip b {
  color: var(--text);
  font-size: var(--fs-small);
}

.balance-chip.is-low {
  background: var(--warning-weak);
  color: var(--warning);
}

.balance-chip.is-low b {
  color: var(--warning);
}

/* ---------------- 按钮 ---------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 40px;
  padding: 0 var(--space-2);
  border: 1px solid transparent;
  border-radius: var(--radius-btn);
  background: var(--surface);
  color: var(--text);
  font-size: var(--fs-body);
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
  text-decoration: none;
  cursor: pointer;
  transition: opacity 0.15s ease, background-color 0.15s ease, border-color 0.15s ease;
}

.btn:hover {
  text-decoration: none;
  opacity: 0.9;
}

.btn:active {
  transform: translateY(1px);
}

.btn:disabled,
.btn.is-disabled {
  cursor: not-allowed;
  opacity: 0.6;
  transform: none;
}

.btn-primary {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}

.btn-primary:disabled {
  background: var(--brand-disabled);
  border-color: var(--brand-disabled);
  color: #fff;
}

.btn-outline {
  background: var(--card);
  border-color: var(--brand);
  color: var(--brand);
}

.btn-ghost {
  background: var(--card);
  border-color: var(--line);
  color: var(--secondary);
}

.btn-soft {
  background: var(--surface);
  color: var(--text);
}

.btn-danger-ghost {
  background: var(--card);
  border-color: var(--danger);
  color: var(--danger);
}

.btn-sm {
  height: 32px;
  padding: 0 12px;
  font-size: var(--fs-small);
  border-radius: 6px;
}

.btn-lg {
  height: 48px;
  padding: 0 var(--space-3);
  font-size: 15px;
}

.btn-block {
  display: flex;
  width: 100%;
}

.btn-link {
  display: inline;
  height: auto;
  padding: 0;
  border: 0;
  background: none;
  color: var(--brand);
  font-size: var(--fs-small);
  font-weight: 600;
  cursor: pointer;
}

.btn-loading {
  position: relative;
  color: transparent !important;
  pointer-events: none;
}

.btn-loading::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 16px;
  height: 16px;
  margin: -8px 0 0 -8px;
  border: 2px solid rgba(255, 255, 255, 0.45);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

.btn-ghost.btn-loading::after,
.btn-outline.btn-loading::after,
.btn-soft.btn-loading::after {
  border-color: var(--line);
  border-top-color: var(--brand);
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* ---------------- 卡片 ---------------- */
.card {
  background: var(--card);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  padding: var(--space-3);
}

.card-flat {
  box-shadow: none;
  border: 1px solid var(--line);
}

.card-pad-lg {
  padding: var(--space-4);
}

.card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-2);
  margin-bottom: var(--space-2);
}

.card-title {
  font-size: var(--fs-h3);
  font-weight: 700;
  line-height: 1.4;
}

.card-sub {
  margin-top: 4px;
  color: var(--muted);
  font-size: var(--fs-small);
}

.divider {
  height: 1px;
  background: var(--line);
  margin: var(--space-2) 0;
  border: 0;
}

/* ---------------- 标签 ---------------- */
.tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 6px;
  background: var(--surface);
  color: var(--secondary);
  font-size: var(--fs-tiny);
  font-weight: 600;
  line-height: 1.6;
  white-space: nowrap;
}

.tag-blue {
  background: var(--brand-weak);
  color: var(--brand);
}

.tag-green {
  background: var(--success-weak);
  color: var(--success);
}

.tag-yellow {
  background: var(--warning-weak);
  color: var(--warning);
}

.tag-red {
  background: var(--danger-weak);
  color: var(--danger);
}

/* ---------------- 表单 ---------------- */
.form {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field-label {
  font-size: var(--fs-small);
  font-weight: 600;
  color: var(--secondary);
}

.field-label .req {
  color: var(--danger);
  margin-left: 2px;
}

.input,
.select,
.textarea {
  width: 100%;
  min-height: 40px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-btn);
  background: var(--card);
  color: var(--text);
  font-size: var(--fs-body);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.input::placeholder,
.textarea::placeholder {
  color: var(--muted);
}

.input:focus,
.select:focus,
.textarea:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-weak);
}

.input.is-invalid {
  border-color: var(--danger);
}

.textarea {
  min-height: 120px;
  resize: vertical;
  line-height: 1.5;
}

.field-hint {
  color: var(--muted);
  font-size: var(--fs-tiny);
}

.field-error {
  color: var(--danger);
  font-size: var(--fs-tiny);
}

.form-error {
  padding: 10px 12px;
  border-radius: var(--radius-btn);
  background: var(--danger-weak);
  color: var(--danger);
  font-size: var(--fs-small);
  line-height: 1.5;
}

.form-error[hidden] {
  display: none;
}

.form-success {
  padding: 10px 12px;
  border-radius: var(--radius-btn);
  background: var(--success-weak);
  color: var(--success);
  font-size: var(--fs-small);
}

.inline-form {
  display: flex;
  gap: var(--space-1);
  align-items: flex-start;
  flex-wrap: wrap;
}

.inline-form .input {
  flex: 1 1 200px;
  width: auto;
}

.check-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: var(--fs-small);
  color: var(--secondary);
}

.check-row input {
  margin-top: 3px;
}

/* 支付渠道 / 套餐选择的单选项（用 label 包一层，点整卡生效） */
.choice {
  position: relative;
  display: block;
  cursor: pointer;
}

.choice input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.choice-body {
  display: flex;
  flex-direction: column;
  gap: 4px;
  height: 100%;
  padding: var(--space-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  background: var(--card);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.choice:hover .choice-body {
  border-color: var(--brand-line);
}

.choice input:checked + .choice-body {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-weak);
}

.choice input:focus-visible + .choice-body {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

.choice input:disabled + .choice-body {
  opacity: 0.55;
  cursor: not-allowed;
}

.choice-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-weight: 700;
}

.choice-desc {
  color: var(--muted);
  font-size: var(--fs-tiny);
  line-height: 1.5;
}

/* ---------------- 提示条 ---------------- */
.notice {
  padding: 10px 12px;
  border-radius: var(--radius-btn);
  background: var(--brand-weak);
  color: var(--brand);
  font-size: var(--fs-small);
  line-height: 1.6;
}

.notice-warning {
  background: var(--warning-weak);
  color: var(--warning);
}

.notice-danger {
  background: var(--danger-weak);
  color: var(--danger);
}

.notice-success {
  background: var(--success-weak);
  color: var(--success);
}

.sandbox-banner {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 10px 12px;
  border: 1px solid #f3d9a8;
  border-radius: var(--radius-btn);
  background: var(--warning-weak);
  color: var(--warning);
  font-size: var(--fs-small);
  line-height: 1.6;
}

.sandbox-banner strong {
  flex: 0 0 auto;
  white-space: nowrap;
}

/* ---------------- 表格 ---------------- */
.table-wrap {
  overflow-x: auto;
  border-radius: var(--radius-card);
  background: var(--card);
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--fs-small);
  white-space: nowrap;
}

.table th,
.table td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid var(--line);
}

.table th {
  color: var(--muted);
  font-weight: 600;
  font-size: var(--fs-tiny);
  background: var(--surface);
  position: sticky;
  top: 0;
}

.table tr:last-child td {
  border-bottom: 0;
}

.table tbody tr:hover td {
  background: #fbfcfe;
}

.table .num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.table .actions {
  text-align: right;
}

/* ---------------- 状态：加载 / 空 / 错误 ---------------- */
.state-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: var(--space-6) var(--space-3);
  text-align: center;
}

.state-title {
  font-size: var(--fs-body);
  font-weight: 600;
  color: var(--secondary);
}

.state-sub {
  color: var(--muted);
  font-size: var(--fs-small);
  max-width: 420px;
}

.state-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--surface);
  color: var(--muted);
  font-size: 20px;
  font-weight: 700;
}

.state-icon.is-danger {
  background: var(--danger-weak);
  color: var(--danger);
}

.spinner {
  width: 18px;
  height: 18px;
  border: 2px solid var(--brand-line);
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  flex: 0 0 auto;
}

.spinner-lg {
  width: 28px;
  height: 28px;
  border-width: 3px;
}

.spinner-inline {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: var(--fs-small);
}

.skeleton {
  border-radius: var(--radius-card);
  background: var(--surface);
  min-height: 120px;
  animation: pulse 1.4s ease-in-out infinite;
}

@keyframes pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.55;
  }
}

/* ---------------- Toast ---------------- */
.toast-stack {
  position: fixed;
  left: 50%;
  bottom: var(--space-4);
  z-index: var(--z-toast);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  transform: translateX(-50%);
  width: min(92vw, 480px);
  pointer-events: none;
}

.toast {
  max-width: 100%;
  padding: 10px 14px;
  border-radius: var(--radius-btn);
  background: var(--text);
  color: #fff;
  font-size: var(--fs-small);
  line-height: 1.5;
  box-shadow: var(--shadow-card);
  animation: toast-in 0.18s ease-out;
  pointer-events: auto;
}

.toast-success {
  background: var(--success);
}

.toast-warning {
  background: var(--warning);
}

.toast-error {
  background: var(--danger);
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ---------------- 首页 ---------------- */
.hero {
  padding: var(--space-8) 0 var(--space-6);
}

.hero-inner {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
  gap: var(--space-6);
  align-items: center;
}

.hero h1 {
  margin-bottom: var(--space-2);
}

.hero-lede {
  color: var(--secondary);
  font-size: 16px;
  line-height: 1.7;
  margin-bottom: var(--space-3);
}

.hero-actions {
  display: flex;
  gap: var(--space-1);
  flex-wrap: wrap;
}

.hero-points {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.hero-point {
  display: flex;
  gap: var(--space-2);
  align-items: flex-start;
}

.point-index {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  flex: 0 0 auto;
  border-radius: 8px;
  background: var(--brand-weak);
  color: var(--brand);
  font-size: var(--fs-small);
  font-weight: 700;
}

.point-title {
  font-weight: 600;
}

.point-desc {
  color: var(--muted);
  font-size: var(--fs-small);
}

.steps {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--space-2);
}

.step {
  background: var(--card);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  padding: var(--space-3);
}

.step-index {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--brand-weak);
  color: var(--brand);
  font-weight: 800;
  margin-bottom: var(--space-1);
}

.step-title {
  font-weight: 700;
  margin-bottom: 4px;
}

.step-desc {
  color: var(--muted);
  font-size: var(--fs-small);
  line-height: 1.6;
}

.price-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--space-2);
}

.price-card {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  padding: var(--space-3);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
}

.price-card.featured {
  border-color: var(--brand);
}

.price-card .price-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: var(--secondary);
  font-size: var(--fs-small);
  font-weight: 600;
}

.price-amount {
  font-size: 28px;
  font-weight: 800;
  line-height: 1.2;
}

.price-amount small {
  font-size: 14px;
  font-weight: 600;
  color: var(--secondary);
  margin-left: 2px;
}

.price-credits {
  color: var(--brand);
  font-weight: 700;
  font-size: var(--fs-small);
}

.price-desc {
  color: var(--muted);
  font-size: var(--fs-tiny);
  min-height: 34px;
}

.faq {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.faq-item {
  background: var(--card);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  padding: 0 var(--space-3);
}

.faq-item summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  padding: var(--space-2) 0;
  font-weight: 600;
  cursor: pointer;
  list-style: none;
}

.faq-item summary::-webkit-details-marker {
  display: none;
}

.faq-item summary::after {
  content: "+";
  color: var(--muted);
  font-weight: 400;
  font-size: 18px;
}

.faq-item[open] summary::after {
  content: "−";
}

.faq-answer {
  padding: 0 0 var(--space-2);
  color: var(--secondary);
  font-size: var(--fs-small);
  line-height: 1.7;
}

/* ---------------- 登录 / 注册 ---------------- */
.auth-wrap {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: var(--space-6) var(--space-3) var(--space-8);
}

.auth-card {
  width: 100%;
  max-width: 400px;
  background: var(--card);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  padding: var(--space-4);
}

.auth-title {
  font-size: 22px;
  font-weight: 800;
  margin-bottom: 4px;
}

.auth-sub {
  color: var(--muted);
  font-size: var(--fs-small);
  margin-bottom: var(--space-3);
}

.tabs {
  display: flex;
  padding: 4px;
  border-radius: var(--radius-btn);
  background: var(--surface);
  margin-bottom: var(--space-3);
}

.tab {
  flex: 1 1 0;
  height: 32px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--secondary);
  font-size: var(--fs-small);
  font-weight: 600;
  cursor: pointer;
}

.tab.is-active {
  background: var(--card);
  color: var(--text);
  box-shadow: var(--shadow-card);
}

/* ---------------- 充值页 ---------------- */
.pricing-hero {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--space-2);
  flex-wrap: wrap;
  margin-bottom: var(--space-3);
}

.balance-line {
  color: var(--secondary);
  font-size: var(--fs-small);
}

.balance-line b {
  color: var(--text);
  font-size: var(--fs-h3);
}

.packages {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--space-2);
}

.package-card .choice-body {
  padding: var(--space-3);
  gap: 6px;
}

.package-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.package-name {
  font-weight: 700;
}

.package-price {
  font-size: 24px;
  font-weight: 800;
}

.package-price small {
  font-size: 13px;
  font-weight: 600;
  color: var(--secondary);
}

.package-credits {
  color: var(--brand);
  font-weight: 700;
}

.custom-amount {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  padding: var(--space-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  background: var(--surface);
}

.amount-input-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}

.amount-prefix {
  color: var(--secondary);
  font-weight: 700;
}

.amount-input {
  flex: 1 1 auto;
  min-width: 120px;
}

.credits-preview {
  flex: 0 0 auto;
  color: var(--brand);
  font-weight: 700;
  font-size: var(--fs-small);
  white-space: nowrap;
}

.credits-preview.is-invalid {
  color: var(--danger);
}

.channels {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: var(--space-1);
}

.pay-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 340px);
  gap: var(--space-2);
  align-items: start;
}

.order-card {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.order-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-1);
}

.order-amount {
  font-size: 24px;
  font-weight: 800;
}

.order-meta {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: var(--fs-small);
  color: var(--secondary);
}

.order-meta .k {
  color: var(--muted);
  display: inline-block;
  min-width: 64px;
}

.order-meta .mono {
  color: var(--text);
}

.qr-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: var(--space-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  background: var(--card);
}

.qr-box svg {
  display: block;
  width: 216px;
  height: 216px;
  border-radius: 4px;
  background: #fff;
}

.qr-hint {
  color: var(--muted);
  font-size: var(--fs-tiny);
  text-align: center;
  line-height: 1.6;
}

.qr-fallback {
  width: 216px;
  padding: var(--space-2);
  border: 1px dashed var(--line);
  border-radius: var(--radius-btn);
  color: var(--secondary);
  font-size: var(--fs-tiny);
  word-break: break-all;
}

.order-status {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--secondary);
  font-size: var(--fs-small);
}

.redeem-box {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

/* ---------------- 工作台 ---------------- */
.workbench {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  background: var(--canvas);
}

.topbar {
  position: relative;
  z-index: var(--z-header);
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: var(--space-2);
  height: var(--topbar-height);
  padding: 0 var(--space-2);
  background: var(--card);
  border-bottom: 1px solid var(--line);
}

.topbar-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: var(--fs-small);
  white-space: nowrap;
}

.topbar-items {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex: 1 1 auto;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: none;
}

.topbar-items::-webkit-scrollbar {
  display: none;
}

.topbar-item {
  display: flex;
  align-items: baseline;
  gap: 6px;
  color: var(--muted);
  font-size: var(--fs-tiny);
  white-space: nowrap;
}

.topbar-item b {
  color: var(--text);
  font-size: var(--fs-small);
  font-variant-numeric: tabular-nums;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  flex: 0 0 auto;
}

.topbar.warning {
  background: var(--warning-weak);
  border-bottom-color: #f3d9a8;
}

.topbar.warning .topbar-item b {
  color: var(--warning);
}

.topbar-warning-text {
  color: var(--warning);
  font-size: var(--fs-tiny);
  font-weight: 600;
  white-space: nowrap;
  max-width: 240px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.workbench-main {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  background: var(--card);
}

.workbench-frame {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
  background: var(--card);
}

.workbench-overlay {
  position: absolute;
  inset: 0;
  z-index: var(--z-overlay);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-3);
  background: var(--canvas);
}

.workbench-overlay .card {
  width: 100%;
  max-width: 420px;
  text-align: center;
}

.workbench-overlay h2 {
  font-size: 18px;
  margin-bottom: 6px;
}

.overlay-actions {
  display: flex;
  justify-content: center;
  gap: var(--space-1);
  margin-top: var(--space-2);
  flex-wrap: wrap;
}

/* ---------------- 管理端 ---------------- */
.admin-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--space-2);
}

.stat-card {
  background: var(--card);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  padding: var(--space-2) var(--space-3);
}

.stat-label {
  color: var(--muted);
  font-size: var(--fs-tiny);
  margin-bottom: 4px;
}

.stat-value {
  font-size: 22px;
  font-weight: 800;
  line-height: 1.3;
  font-variant-numeric: tabular-nums;
}

.stat-value small {
  font-size: var(--fs-small);
  font-weight: 600;
  color: var(--secondary);
  margin-left: 2px;
}

.stat-sub {
  color: var(--muted);
  font-size: var(--fs-tiny);
  margin-top: 2px;
}

.admin-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 360px);
  gap: var(--space-2);
  align-items: start;
}

.admin-side {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.toolbar {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  flex-wrap: wrap;
  margin-bottom: var(--space-1);
}

.toolbar .input {
  width: auto;
  flex: 1 1 200px;
  min-width: 0;
}

.toolbar .select {
  width: auto;
}

.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-1);
  margin-top: var(--space-2);
  color: var(--muted);
  font-size: var(--fs-small);
}

.code-output {
  font-family: var(--font-mono);
  font-size: var(--fs-tiny);
  line-height: 1.7;
  white-space: pre;
  overflow: auto;
  max-height: 260px;
  padding: var(--space-1) var(--space-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-btn);
  background: var(--surface);
  color: var(--text);
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-2);
}

.form-grid .field-wide {
  grid-column: 1 / -1;
}

/* ---------------- 页脚 ---------------- */
.site-footer {
  border-top: 1px solid var(--line);
  background: var(--card);
  padding: var(--space-4) 0;
  margin-top: var(--space-6);
}

.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  flex-wrap: wrap;
  color: var(--muted);
  font-size: var(--fs-small);
}

.footer-links {
  display: flex;
  gap: var(--space-2);
}

.footer-links a {
  color: var(--muted);
}

/* ---------------- 项目计费文案（index / pricing） ---------------- */
.project-pricing {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.project-pricing-row {
  display: flex;
  align-items: flex-start;
  gap: var(--space-2);
}

.project-pricing-row .tag {
  flex: 0 0 auto;
  margin-top: 2px;
}

.project-pricing-line {
  margin: 0;
  color: var(--secondary);
  font-size: var(--fs-small);
  line-height: 1.7;
}

/* ---------------- 工作台：余额不足 gate（不打开 iframe） ---------------- */
.gate-wrap {
  position: absolute;
  inset: 0;
  z-index: var(--z-overlay);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-3);
  background: var(--canvas);
  overflow: auto;
}

.gate-card {
  width: 100%;
  max-width: 520px;
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  text-align: left;
}

.gate-title {
  margin: 0;
  font-size: var(--fs-h3);
  font-weight: 800;
}

.gate-line {
  margin: 0;
  color: var(--secondary);
  font-size: var(--fs-body);
  line-height: 1.7;
}

.gate-line-strong {
  color: var(--danger);
  font-weight: 700;
}

.gate-card .overlay-actions {
  justify-content: flex-start;
}

/* ---------------- 模态弹窗（新建项目确认） ---------------- */
.modal-mask {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-2);
  background: rgba(32, 41, 56, 0.45);
}

.modal-card {
  width: 100%;
  max-width: 420px;
  padding: var(--space-3);
  border-radius: var(--radius-card);
  background: var(--card);
  box-shadow: var(--shadow-card);
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-1);
  margin-top: var(--space-3);
  flex-wrap: wrap;
}

/* ---------------- 工作台顶栏：项目 / 项目扣费 ---------------- */
.topbar-project b {
  display: inline-block;
  max-width: 190px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  vertical-align: bottom;
}

.topbar-project-billing {
  color: var(--muted);
}

/* ---------------- 移动端（720px 单列） ---------------- */
@media (max-width: 720px) {
  :root {
    --fs-h1: 26px;
    --fs-h2: 20px;
    --space-6: 32px;
    --space-8: 40px;
  }

  .container {
    padding: 0 var(--space-2);
  }

  .header-inner {
    height: auto;
    min-height: var(--header-height);
    padding-block: 10px;
    flex-wrap: wrap;
    gap: var(--space-1);
  }

  .nav {
    order: 3;
    flex-basis: 100%;
  }

  .header-actions {
    margin-left: auto;
  }

  .hero {
    padding: var(--space-5) 0 var(--space-4);
  }

  .hero-inner,
  .grid-2,
  .grid-3,
  .grid-4,
  .steps,
  .price-grid,
  .packages,
  .pay-panel,
  .admin-layout,
  .form-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .hero-points {
    gap: var(--space-2);
  }

  .card,
  .step,
  .price-card,
  .stat-card,
  .auth-card {
    padding: var(--space-2);
  }

  .admin-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .topbar {
    height: auto;
    min-height: var(--topbar-height);
    flex-wrap: wrap;
    gap: 4px var(--space-1);
    padding: 6px var(--space-1);
  }

  .topbar-title {
    flex: 1 1 auto;
  }

  .topbar-actions {
    flex: 0 0 auto;
    margin-left: auto;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .topbar-items {
    flex: 1 1 100%;
    order: 3;
    gap: var(--space-1);
    overflow-x: auto;
  }

  .topbar-project b {
    max-width: 150px;
  }

  .project-pricing-row {
    flex-direction: column;
    gap: 4px;
  }

  .gate-wrap {
    padding: var(--space-2);
  }

  .balance-line {
    width: 100%;
  }

  .pricing-hero {
    align-items: flex-start;
  }

  .footer-inner {
    flex-direction: column;
    align-items: flex-start;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}


/* ================================================================
   极简操作页（/）：未登录登录卡 + 已登录状态栏 + 铺满工作台
   ================================================================ */
.home-body {
  background: var(--canvas);
}

.home-auth {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-3) var(--space-2);
}

.home-auth-card {
  width: 100%;
  max-width: 360px;
  padding: var(--space-3);
}

.home-auth-brand {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  font-weight: 800;
  font-size: var(--fs-h3);
  color: var(--text);
}

.home-tabs {
  margin: var(--space-3) 0 var(--space-2);
}

.home-gift {
  margin: var(--space-2) 0 0;
  text-align: center;
  font-size: var(--fs-tiny);
  color: var(--muted);
}

.home-app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
}

.home-bar {
  flex: 0 0 auto;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  padding: 0 var(--space-2);
  background: var(--card);
  border-bottom: 1px solid var(--line);
  position: relative;
  z-index: 20;
}

.home-bar-left {
  display: flex;
  align-items: baseline;
  gap: 6px;
  min-width: 0;
}

.home-bar-label {
  color: var(--muted);
  font-size: var(--fs-tiny);
}

.home-bar-project {
  max-width: 46vw;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: var(--fs-small);
}

.home-bar-right {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex: 0 0 auto;
}

.home-balance {
  color: var(--secondary);
  font-size: var(--fs-small);
}

.home-balance b {
  color: var(--text);
}

.menu-wrap {
  position: relative;
}

.menu-btn {
  width: 32px;
  height: 32px;
  border: 1px solid var(--line);
  border-radius: var(--radius-btn);
  background: var(--card);
  color: var(--secondary);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}

.menu-btn:hover {
  background: var(--surface);
}

.menu {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  min-width: 140px;
  padding: 4px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  box-shadow: 0 8px 24px rgba(32, 41, 56, 0.12);
  z-index: 30;
}

.menu-item {
  display: block;
  width: 100%;
  padding: 8px 10px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--text);
  font-size: var(--fs-small);
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}

.menu-item:hover {
  background: var(--brand-weak);
  color: var(--brand);
}

.home-main {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  background: var(--card);
}

.home-frame {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
  background: var(--canvas);
}

.home-loading {
  position: absolute;
  inset: 0;
  z-index: 9;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-1);
  background: var(--canvas);
  color: var(--secondary);
  font-size: var(--fs-small);
}

.home-gate,
.home-status {
  position: absolute;
  inset: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-2);
  background: var(--canvas);
}

.home-gate-card,
.home-status-card {
  width: 100%;
  max-width: 560px;
  padding: var(--space-2) var(--space-3);
}

.home-gate-line,
.home-status-text {
  margin: 0 0 var(--space-2);
  color: var(--secondary);
  font-size: var(--fs-small);
  line-height: 1.7;
}

.home-gate-actions {
  display: flex;
  gap: var(--space-1);
  flex-wrap: wrap;
}

/* ================================================================
   充值页（DeepSeek 风格）
   ================================================================ */
.recharge-body {
  background: var(--canvas);
  min-height: 100vh;
}

.recharge-header {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  border-bottom: 1px solid var(--line);
  background: var(--card);
}

.recharge-back {
  color: var(--secondary);
  font-size: var(--fs-small);
  text-decoration: none;
}

.recharge-back:hover {
  color: var(--brand);
}

.recharge-title {
  margin: 0;
  font-size: var(--fs-h3);
  flex: 1 1 auto;
}

.recharge-balance {
  color: var(--secondary);
  font-size: var(--fs-small);
}

.recharge-balance b {
  color: var(--text);
}

.recharge-main {
  max-width: 720px;
  margin: 0 auto;
  padding: var(--space-3) var(--space-2) var(--space-4);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.recharge-card {
  padding: var(--space-3);
}

.recharge-amount-block {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.amount-box {
  display: flex;
  align-items: center;
  gap: 6px;
  border-bottom: 2px solid var(--line);
  padding-bottom: var(--space-1);
}

.amount-symbol {
  font-size: 32px;
  font-weight: 700;
  color: var(--text);
}

.amount-input-lg {
  flex: 1 1 auto;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font-size: 40px;
  font-weight: 800;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
}

.amount-chips {
  display: flex;
  gap: var(--space-1);
  flex-wrap: wrap;
  margin-top: var(--space-1);
}

.chip {
  padding: 7px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--card);
  color: var(--secondary);
  font-size: var(--fs-small);
  cursor: pointer;
}

.chip:hover {
  border-color: var(--brand-line);
  color: var(--brand);
}

.chip.is-active {
  border-color: var(--brand);
  background: var(--brand-weak);
  color: var(--brand);
  font-weight: 600;
}

.estimate-line {
  margin: var(--space-2) 0 0;
  color: var(--brand);
  font-size: var(--fs-small);
  font-weight: 600;
}

.recharge-channel-block {
  margin-top: var(--space-3);
}

.channel-list {
  display: flex;
  gap: var(--space-1);
  flex-wrap: wrap;
  margin-top: var(--space-1);
}

.channel-option {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-btn);
  background: var(--card);
  color: var(--text);
  font-size: var(--fs-small);
  cursor: pointer;
}

.channel-option input {
  margin: 0;
  accent-color: var(--brand);
}

.channel-option.is-active {
  border-color: var(--brand);
  background: var(--brand-weak);
}

.channel-option.is-disabled {
  color: var(--muted);
  background: var(--surface);
  cursor: not-allowed;
}

.redeem-area {
  margin-top: var(--space-3);
}

.redeem-row {
  display: flex;
  gap: var(--space-1);
  margin-top: var(--space-1);
}

.redeem-row .input {
  flex: 1 1 auto;
}

.recharge-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  margin-top: var(--space-3);
  padding-top: var(--space-2);
  border-top: 1px solid var(--line);
}

.recharge-summary {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.recharge-summary-amount {
  font-size: var(--fs-h3);
  font-weight: 800;
  color: var(--text);
}

.recharge-summary-credits {
  color: var(--muted);
  font-size: var(--fs-tiny);
}

.recharge-order {
  padding: var(--space-3);
}

.recharge-order-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
}

.recharge-order-body {
  display: flex;
  gap: var(--space-3);
  align-items: center;
  flex-wrap: wrap;
  margin-top: var(--space-2);
}

.recharge-qr {
  min-width: 220px;
}

.recharge-qr svg {
  display: block;
}

.recharge-order-meta {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.recharge-order-line {
  color: var(--secondary);
  font-size: var(--fs-small);
}

.recharge-success-title {
  font-size: var(--fs-h3);
  font-weight: 800;
  color: var(--success);
  margin-top: var(--space-2);
}

.recharge-packages {
  padding: var(--space-2) var(--space-3);
}

.recharge-packages summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--secondary);
}

.recharge-package-grid {
  margin-top: var(--space-2);
}

.recharge-package {
  text-align: left;
}

@media (max-width: 720px) {
  .home-bar {
    height: 48px;
    padding: 0 var(--space-1);
  }

  .home-bar-project {
    max-width: 40vw;
  }

  .home-auth-card {
    max-width: 100%;
    padding: var(--space-2);
  }

  .recharge-header {
    padding: var(--space-1) var(--space-2);
  }

  .recharge-main {
    padding: var(--space-2) var(--space-1) var(--space-3);
  }

  .recharge-card {
    padding: var(--space-2);
  }

  .amount-input-lg {
    font-size: 34px;
  }

  .recharge-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .recharge-actions .btn {
    width: 100%;
  }

  .recharge-order-body {
    flex-direction: column;
    align-items: flex-start;
  }
}

/* ================================================================
   未登录操作界面：状态栏 + 排课要求输入区（不是登录墙）
   ================================================================ */
.home-anon {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
}

.home-anon-main {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-2);
  background: var(--canvas);
}

.home-login-link {
  border: 0;
  background: transparent;
  color: var(--brand);
  font-size: var(--fs-small);
  font-weight: 600;
  padding: 4px 6px;
  cursor: pointer;
}

.home-login-link:hover {
  text-decoration: underline;
}

.composer {
  width: 100%;
  max-width: 760px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  padding: var(--space-2);
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.composer-input {
  width: 100%;
  min-height: 120px;
  max-height: 320px;
  resize: vertical;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font-size: var(--fs-body);
  line-height: 1.7;
  font-family: inherit;
}

.composer-input::placeholder {
  color: var(--muted);
}

.composer-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  border-top: 1px solid var(--line);
  padding-top: var(--space-1);
}

.composer-hint {
  color: var(--muted);
  font-size: var(--fs-tiny);
}

.composer-send {
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 50%;
  background: var(--brand);
  color: #fff;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  flex: 0 0 auto;
}

.composer-send:hover {
  background: var(--brand-hover, #2f61c9);
}

.auth-modal-card {
  position: relative;
}

.modal-close {
  position: absolute;
  right: 10px;
  top: 8px;
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}

.modal-close:hover {
  background: var(--surface);
  color: var(--text);
}

@media (max-width: 720px) {
  .composer {
    padding: var(--space-1);
  }

  .composer-input {
    min-height: 96px;
  }

  .composer-hint {
    font-size: 11px;
  }
}

/* ================================================================
   首页（未登录）：品牌区 + 主卡片 + 上传工具
   ================================================================ */
.home-anon-main {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: var(--space-3) var(--space-2) var(--space-4);
  gap: var(--space-3);
  overflow-y: auto;
}

.home-hero {
  width: 720px;
  max-width: 100%;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.home-brand-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-logo {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  background: var(--brand);
  color: #fff;
  font-size: 17px;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
}

.brand-name {
  font-size: 20px;
  font-weight: 600;
  color: var(--text);
}

.home-subtitle {
  margin: 0;
  padding-left: 42px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
}

.home-card {
  width: 720px;
  max-width: 100%;
  padding: 28px;
  border-radius: 16px;
  box-shadow: 0 8px 32px rgba(32, 41, 56, 0.08);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.home-card.is-dragging {
  border: 1.5px dashed var(--brand);
  background: #f7f9ff;
}

.home-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
}

.home-card-title {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
}

.home-textarea {
  width: 100%;
  min-height: 132px;
  resize: vertical;
  padding: 12px 14px;
  border: 1.5px solid var(--line);
  border-radius: 10px;
  background: var(--card);
  color: var(--text);
  font: inherit;
  font-size: var(--fs-body);
  line-height: 1.7;
  outline: 0;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.home-textarea::placeholder {
  color: var(--muted);
}

.home-textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(65, 118, 230, 0.12);
}

.composer-tools {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
}

.upload-chips {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.upload-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 7px 12px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: var(--card);
  color: var(--secondary);
  font-size: 13px;
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}

.upload-chip:hover {
  color: var(--brand);
  border-color: var(--brand);
  background: var(--brand-weak);
}

.upload-chip svg {
  flex: 0 0 auto;
}

.composer-send {
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 50%;
  background: var(--brand);
  color: #fff;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  flex: 0 0 auto;
  transition: background 0.15s ease, opacity 0.15s ease;
}

.composer-send:hover:not(:disabled) {
  background: #2f61c9;
}

.composer-send:disabled {
  background: var(--brand-disabled, #a0baf0);
  cursor: not-allowed;
}

.upload-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.file-chip {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px 6px 10px;
  border: 1px solid var(--brand-line);
  border-radius: 8px;
  background: var(--brand-weak);
  color: var(--secondary);
  font-size: 12px;
  max-width: 100%;
}

.file-chip-name {
  color: var(--text);
  font-weight: 600;
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-chip-meta {
  color: var(--secondary);
  white-space: nowrap;
}

.file-chip-meta.is-error {
  color: var(--danger);
}

.file-chip-remove {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
  padding: 2px 4px;
}

.file-chip-remove:hover {
  color: var(--danger);
}

.file-progress {
  position: absolute;
  left: 0;
  bottom: -2px;
  height: 2px;
  width: 40%;
  border-radius: 2px;
  background: var(--brand);
  animation: file-progress-move 1s ease-in-out infinite;
}

@keyframes file-progress-move {
  0% { left: 0; width: 20%; }
  50% { left: 40%; width: 45%; }
  100% { left: 80%; width: 20%; }
}

.example-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

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

.example-chip {
  padding: 5px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--secondary);
  font-size: 13px;
  cursor: pointer;
  text-align: left;
}

.example-chip:hover {
  color: var(--brand);
  border-color: var(--brand-line);
  background: var(--brand-weak);
}

.composer-hint {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

/* 已登录：iframe 上方 44px 工具条 + 上传面板 */
.workbar {
  flex: 0 0 auto;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-1);
  padding: 0 var(--space-2);
  background: var(--card);
  border-bottom: 1px solid var(--line);
  position: relative;
  z-index: 15;
}

.workbar.is-dragging {
  background: #f7f9ff;
  box-shadow: inset 0 0 0 1.5px var(--brand);
}

.upload-panel {
  position: absolute;
  top: 100px;
  left: 12px;
  z-index: 25;
  width: 380px;
  max-width: calc(100vw - 24px);
  padding: var(--space-2);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  box-shadow: 0 12px 32px rgba(32, 41, 56, 0.14);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.upload-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 14px;
  font-weight: 600;
}

.upload-panel-close {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}

.upload-panel-hint {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

@media (max-width: 720px) {
  .home-anon-main {
    padding: var(--space-2) var(--space-2) var(--space-3);
  }

  .home-hero,
  .home-card {
    width: 100%;
  }

  .home-card {
    padding: 18px;
  }

  .home-subtitle {
    padding-left: 0;
  }

  .composer-tools {
    flex-wrap: wrap;
  }

  .upload-chips {
    flex: 1 1 100%;
    flex-wrap: wrap;
  }

  .composer-send {
    margin-left: auto;
  }

  .example-row {
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 4px;
  }

  .example-chip {
    flex: 0 0 auto;
    max-width: 260px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .upload-panel {
    left: 8px;
    right: 8px;
    width: auto;
    top: 96px;
  }

  .file-chip-name {
    max-width: 140px;
  }
}

/* ---------------- 充值套餐卡（修复：四张卡横排、边框/间距正常） ---------------- */
.package-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 12px;
}
.package-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: flex-start;
  text-align: left;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  cursor: pointer;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.package-card:hover { border-color: var(--brand); box-shadow: 0 4px 16px rgba(65,118,230,.10); }
.package-card .package-head { width: 100%; }
.package-card .package-name { font-weight: 600; font-size: 13.5px; }
.package-card .package-price { font-size: 24px; font-weight: 700; letter-spacing: -.3px; }
.package-card .package-credits { color: var(--brand); font-weight: 600; font-size: 13px; }
.package-card .choice-desc { color: var(--muted); font-size: 12px; line-height: 1.55; }


/* ---------------- 充值页：宽版两列布局 ---------------- */
.recharge-main-wide { max-width: 1240px; }
.recharge-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 460px;
  gap: 24px;
  align-items: start;
}
.recharge-grid .recharge-card { width: 100%; }
.recharge-col-main, .recharge-col-side { min-width: 0; }
.recharge-col-side .recharge-packages { margin: 0; }
.recharge-col-side .package-grid { grid-template-columns: 1fr 1fr; }
@media (max-width: 820px) {
  .recharge-grid { grid-template-columns: 1fr; }
  .recharge-col-side .package-grid { grid-template-columns: 1fr 1fr; }
}


/* 自定义金额提示 */
.amount-hint { color: var(--muted); font-size: 12px; margin-top: 6px; }
.amount-input-lg { cursor: text; }


/* 充值页宽度兜底：撑满容器再按 max-width 居中 */
.recharge-main.recharge-main-wide {
  width: 100%;
  max-width: 1320px;
  margin: 0 auto;
  align-self: center;
}
