/*
 * customer.css — 客户前端（快速充值 / 套餐充值）设计令牌与组件样式。
 *
 * 设计契约复用自 C2A commit 15a6fce（只读参考 web/src/styles/index.css、
 * workspace.css、lib/antd-theme.ts、components/ui/card.tsx、button.tsx）：
 *   主色 #3454bf、白底、圆角 12px（--radius .75rem）、1px 浅边框、
 *   克制阴影、focus-visible 双环、disabled 半透明 + 光标禁止、loading 旋转指示。
 * 详细来源与适配说明见 docs/C2A-UI-REUSE.md。
 *
 * 本文件仅由客户页面（index.html / plans.html）引入，
 * 管理后台仍使用 style.css，互不影响。
 */

:root {
  /* 颜色：对齐 C2A 主题变量（HSL 原值见注释） */
  --cu-primary: #3454bf; /* 226.2 57.2% 47.6% */
  --cu-primary-hover: #2a45a0;
  --cu-primary-soft: hsl(226.2 57.2% 47.6% / 0.08);
  --cu-primary-line: hsl(226.2 57.2% 47.6% / 0.35);
  --cu-ink: hsl(220 20% 10%);
  --cu-muted: hsl(220 10% 46%);
  --cu-line: hsl(220 13% 91%);
  --cu-line-strong: hsl(220 13% 82%);
  --cu-bg: #ffffff;
  --cu-surface: #ffffff;
  --cu-surface-alt: hsl(210 20% 97%);
  --cu-danger: hsl(0 72% 44%);
  --cu-success: hsl(150 45% 30%);

  /* 形状与阴影 */
  --cu-radius: 12px; /* C2A --radius: 0.75rem */
  --cu-radius-sm: 8px; /* C2A antd borderRadius: 10 的紧凑档 */
  --cu-radius-pill: 999px;
  --cu-shadow-sm: 0 1px 2px hsl(220 20% 10% / 0.05);
  --cu-shadow-card: 0 1px 2px hsl(220 20% 10% / 0.04), 0 18px 32px -28px hsl(220 20% 10% / 0.38);

  /* 字体：仅系统字体，符合现有 CSP（font-src 'self'，禁止外部字体） */
  --cu-font: "Inter", "PingFang SC", "Microsoft YaHei", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  --cu-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --cu-ring: 0 0 0 2px #ffffff, 0 0 0 4px hsl(226.2 57.2% 47.6% / 0.45);
  --cu-page: 1160px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--cu-bg);
  color: var(--cu-ink);
  font-family: var(--cu-font);
  font-size: 15px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a {
  color: var(--cu-primary);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

a:hover {
  color: var(--cu-primary-hover);
}

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

:where(a, button, input, select, textarea):focus-visible {
  outline: 2px solid var(--cu-primary);
  outline-offset: 2px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: fixed;
  top: -64px;
  left: 16px;
  z-index: 100;
  padding: 10px 16px;
  border-radius: var(--cu-radius-sm);
  border: 1px solid var(--cu-line);
  background: #ffffff;
  color: var(--cu-primary);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  box-shadow: var(--cu-shadow-sm);
  transition: top 0.15s ease;
}

.skip-link:focus {
  top: 12px;
}

/* ---------- 顶栏与导航 ---------- */

.mast {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 20px;
  max-width: var(--cu-page);
  margin: 0 auto;
  padding: 22px 32px;
  border-bottom: 1px solid var(--cu-line);
}

.wordmark {
  color: var(--cu-ink);
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.5px;
  text-decoration: none;
  white-space: nowrap;
}

.wordmark span {
  margin-left: 6px;
  font-size: 16px;
  font-weight: 450;
  color: var(--cu-muted);
}

.nav {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.nav a {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 6px 14px;
  border-radius: var(--cu-radius-pill);
  color: var(--cu-muted);
  font-size: 13px;
  font-weight: 550;
  text-decoration: none;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.nav a:hover {
  background: var(--cu-surface-alt);
  color: var(--cu-ink);
}

.nav a[aria-current="page"] {
  background: var(--cu-primary-soft);
  color: var(--cu-primary);
  font-weight: 650;
}

/* ---------- 页面骨架 ---------- */

.customer {
  display: grid;
  grid-template-columns: minmax(0, 0.92fr) minmax(0, 1.08fr);
  gap: 56px;
  max-width: var(--cu-page);
  margin: 56px auto 24px;
  padding: 0 32px;
}

.intro {
  min-width: 0;
  padding-top: 20px;
}

.workspace {
  min-width: 0;
  padding: 28px 30px 30px;
  border: 1px solid var(--cu-line);
  border-radius: var(--cu-radius);
  background: var(--cu-surface);
  box-shadow: var(--cu-shadow-card);
}

/* ---------- 排版 ---------- */

.eyebrow {
  margin: 0 0 14px;
  color: var(--cu-muted);
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 2px;
  text-transform: uppercase;
}

h1 {
  margin: 0 0 20px;
  font-size: clamp(32px, 3.4vw, 46px);
  font-weight: 650;
  line-height: 1.3;
  letter-spacing: -1.2px;
  overflow-wrap: anywhere;
}

h2 {
  margin: 0 0 18px;
  font-size: 23px;
  font-weight: 650;
  line-height: 1.4;
  letter-spacing: -0.4px;
  overflow-wrap: anywhere;
}

.workspace h2 {
  font-size: 20px;
}

h3 {
  margin: 0 0 8px;
  font-size: 16px;
  font-weight: 650;
  line-height: 1.45;
}

.lede {
  max-width: 34ch;
  margin: 0;
  color: var(--cu-muted);
  font-size: 15px;
  line-height: 1.85;
}

.hint {
  margin: 10px 0 0;
  color: var(--cu-muted);
  font-size: 12.5px;
  line-height: 1.8;
}

.section-heading {
  margin-bottom: 6px;
}

.section-heading .eyebrow {
  margin-bottom: 8px;
}

/* ---------- 套餐上下文（/plans/:id） ---------- */

.plan-context {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  margin-top: 24px;
  padding: 12px 14px;
  border: 1px solid var(--cu-line);
  border-radius: var(--cu-radius-sm);
  background: var(--cu-surface-alt);
  font-size: 13px;
  line-height: 1.6;
}

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

.plan-context-name {
  font-weight: 650;
  overflow-wrap: anywhere;
}

.plan-context-hint {
  flex-basis: 100%;
  color: var(--cu-muted);
  font-size: 12.5px;
}

.plan-context-link {
  margin-left: auto;
  font-size: 12.5px;
  font-weight: 600;
  white-space: nowrap;
}

.plan-state {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: var(--cu-radius-pill);
  border: 1px solid var(--cu-line);
  background: #ffffff;
  color: var(--cu-muted);
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
}

.plan-state[data-state="on"] {
  border-color: var(--cu-primary-line);
  background: var(--cu-primary-soft);
  color: var(--cu-primary);
}

.plan-state[data-state="off"] {
  border-color: var(--cu-line-strong);
  background: var(--cu-surface-alt);
  color: var(--cu-muted);
}

/* ---------- 步骤条 ---------- */

.steps {
  display: flex;
  gap: 8px;
  margin: 0 0 26px;
  padding: 0 0 20px;
  border-bottom: 1px solid var(--cu-line);
  list-style: none;
}

.steps li {
  flex: 1 1 0;
  min-width: 0;
  color: var(--cu-muted);
  font-size: 12px;
  line-height: 1.5;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.steps span {
  display: block;
  margin-bottom: 6px;
  color: var(--cu-line-strong);
  font-family: var(--cu-mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.5px;
}

.steps li.done span,
.steps li[aria-current="step"] span {
  color: var(--cu-primary);
}

.steps li.done {
  color: var(--cu-ink);
}

.steps li[aria-current="step"] {
  color: var(--cu-primary);
  font-weight: 650;
}

/* ---------- 表单控件 ---------- */

label {
  display: block;
  margin: 18px 0 8px;
  font-size: 13px;
  font-weight: 600;
}

.label-row {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 4px 12px;
}

.label-row label {
  margin-bottom: 8px;
}

.label-row a {
  font-size: 12px;
  font-weight: 550;
  text-decoration: none;
}

.label-row a:hover {
  text-decoration: underline;
}

input:not([type="checkbox"]),
textarea,
select {
  display: block;
  width: 100%;
  max-width: 100%;
  padding: 11px 13px;
  border: 1px solid var(--cu-line-strong);
  border-radius: var(--cu-radius-sm);
  background: #ffffff;
  color: var(--cu-ink);
  font-size: 14px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

input:not([type="checkbox"]):hover,
textarea:hover,
select:hover {
  border-color: var(--cu-primary-line);
}

input:not([type="checkbox"]):focus,
textarea:focus,
select:focus {
  border-color: var(--cu-primary);
  box-shadow: var(--cu-ring);
  outline: none;
}

input::placeholder,
textarea::placeholder {
  color: var(--cu-muted);
  font-size: 13px;
  font-weight: 400;
}

textarea {
  min-height: 108px;
  font-family: var(--cu-mono);
  font-size: 12px;
  line-height: 1.75;
  resize: vertical;
}

select:disabled,
input:disabled,
textarea:disabled {
  background: var(--cu-surface-alt);
  color: var(--cu-muted);
  cursor: not-allowed;
}

#code {
  font-family: var(--cu-mono);
  font-size: 14px;
  letter-spacing: 1.5px;
}

.check {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-top: 18px;
  font-size: 13px;
  font-weight: 400;
  line-height: 1.75;
  cursor: pointer;
}

.check input {
  flex: 0 0 auto;
  width: 17px;
  height: 17px;
  margin-top: 3px;
  accent-color: var(--cu-primary);
}

/* ---------- 按钮（对齐 C2A Button：10/12 圆角、disabled 50%、loading 指示） ---------- */

button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  padding: 10px 18px;
  border: 1px solid var(--cu-line-strong);
  border-radius: var(--cu-radius-sm);
  background: #ffffff;
  color: var(--cu-ink);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.4;
  cursor: pointer;
  text-align: center;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

button:hover:not(:disabled) {
  background: var(--cu-surface-alt);
}

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

.primary {
  border-color: var(--cu-primary);
  background: var(--cu-primary);
  color: #ffffff;
}

.primary:hover:not(:disabled) {
  border-color: var(--cu-primary-hover);
  background: var(--cu-primary-hover);
  color: #ffffff;
}

.quiet {
  border-color: transparent;
  background: transparent;
  color: var(--cu-muted);
}

.quiet:hover:not(:disabled) {
  background: var(--cu-surface-alt);
  color: var(--cu-ink);
}

button[aria-busy="true"] {
  position: relative;
  padding-right: 38px;
  cursor: progress;
}

button[aria-busy="true"]::after {
  content: "";
  position: absolute;
  top: 50%;
  right: 15px;
  width: 13px;
  height: 13px;
  margin-top: -7px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  opacity: 0.85;
  animation: cu-spin 0.75s linear infinite;
}

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

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 22px;
}

.actions .primary {
  flex: 1 1 180px;
}

.actions .quiet {
  flex: 0 0 auto;
}

/* ---------- 提示与信息列表 ---------- */

.notice {
  margin: 20px 0 0;
  padding: 12px 14px;
  border: 1px solid var(--cu-primary-line);
  border-radius: var(--cu-radius-sm);
  background: var(--cu-primary-soft);
  color: var(--cu-ink);
  font-size: 13px;
  line-height: 1.75;
}

.workspace .notice {
  margin: 0 0 18px;
}

.error {
  margin: 12px 0 0;
  padding: 10px 12px;
  border: 1px solid hsl(0 72% 44% / 0.28);
  border-radius: var(--cu-radius-sm);
  background: hsl(0 72% 44% / 0.06);
  color: var(--cu-danger);
  font-size: 13px;
  line-height: 1.75;
  overflow-wrap: anywhere;
}

.facts {
  margin: 0 0 18px;
  padding: 0;
  border-top: 1px solid var(--cu-line);
}

.facts > div {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 0;
  border-bottom: 1px solid var(--cu-line);
  font-size: 13px;
  line-height: 1.65;
}

.facts dt {
  flex: 0 0 auto;
  color: var(--cu-muted);
}

.facts dd {
  margin: 0;
  min-width: 0;
  text-align: right;
  overflow-wrap: anywhere;
}

.mono {
  font-family: var(--cu-mono);
  font-size: 12px;
}

#captcha {
  border-color: var(--cu-primary-line);
}

#captcha button {
  margin-top: 10px;
}

#resumeField textarea {
  margin-bottom: 10px;
}

#resumeField button {
  min-height: 38px;
}

/* ---------- 页脚 ---------- */

.footnote {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 28px;
  margin-top: 8px;
  padding-top: 18px;
  border-top: 1px solid var(--cu-line);
  color: var(--cu-muted);
  font-size: 12px;
  line-height: 1.8;
}

footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 16px;
  max-width: var(--cu-page);
  margin: 28px auto 40px;
  padding: 0 32px;
  color: var(--cu-muted);
  font-size: 12px;
}

footer a {
  color: var(--cu-muted);
  text-decoration: none;
}

footer a:hover {
  color: var(--cu-primary);
  text-decoration: underline;
}

#turnstileMount {
  margin: 0 0 18px;
}

/* ---------- 套餐列表页 ---------- */

.plans-page {
  max-width: var(--cu-page);
  margin: 48px auto 24px;
  padding: 0 32px;
}

.plans-hero {
  max-width: 62ch;
}

.plans-hero h1 {
  margin-bottom: 14px;
}

.plans-hero .lede {
  max-width: none;
}

.plans-note {
  margin: 14px 0 0;
  color: var(--cu-muted);
  font-size: 12.5px;
  line-height: 1.85;
}

.plan-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin: 32px 0 0;
  padding: 0;
  list-style: none;
}

.plan-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  height: 100%;
  padding: 22px;
  border: 1px solid var(--cu-line);
  border-radius: var(--cu-radius);
  background: var(--cu-surface);
  color: var(--cu-ink);
  text-decoration: none;
  box-shadow: var(--cu-shadow-sm);
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

.plan-card:hover {
  border-color: var(--cu-primary-line);
  box-shadow: var(--cu-shadow-card);
  transform: translateY(-2px);
  color: var(--cu-ink);
}

.plan-card:focus-visible {
  border-color: var(--cu-primary);
  outline: 2px solid var(--cu-primary);
  outline-offset: 2px;
}

.plan-card[data-enabled="off"] {
  background: var(--cu-surface-alt);
}

.plan-badge {
  align-self: flex-start;
  padding: 3px 10px;
  border-radius: var(--cu-radius-pill);
  background: var(--cu-primary-soft);
  color: var(--cu-primary);
  font-size: 11.5px;
  font-weight: 650;
  letter-spacing: 0.2px;
}

.plan-card[data-enabled="off"] .plan-badge {
  background: #ffffff;
  color: var(--cu-muted);
}

.plan-name {
  margin: 4px 0 0;
  font-size: 19px;
  font-weight: 650;
  line-height: 1.35;
  letter-spacing: -0.3px;
}

.plan-summary {
  margin: 0;
  color: var(--cu-ink);
  font-size: 13.5px;
  line-height: 1.7;
}

.plan-note {
  margin: 0;
  color: var(--cu-muted);
  font-size: 12.5px;
  line-height: 1.75;
}

.plan-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: auto;
  padding-top: 14px;
  border-top: 1px solid var(--cu-line);
}

.plan-enter {
  color: var(--cu-primary);
  font-size: 13px;
  font-weight: 650;
  white-space: nowrap;
}

.plan-card[data-enabled="off"] .plan-enter {
  color: var(--cu-muted);
}

.plans-flow {
  margin: 36px 0 0;
  padding: 20px 22px;
  border: 1px solid var(--cu-line);
  border-radius: var(--cu-radius);
  background: var(--cu-surface-alt);
}

.plans-flow h2 {
  margin-bottom: 8px;
  font-size: 15px;
}

.plans-flow ol {
  margin: 0;
  padding-left: 20px;
  color: var(--cu-muted);
  font-size: 13px;
  line-height: 1.85;
}

.plans-flow li {
  overflow-wrap: anywhere;
}

/* Responsive layout. */

@media (max-width: 1023px) {
  .customer {
    grid-template-columns: minmax(0, 1fr);
    max-width: 640px;
    gap: 28px;
    margin-top: 32px;
  }

  .intro {
    padding-top: 0;
  }

  .lede {
    max-width: none;
  }

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

@media (max-width: 720px) {
  .mast,
  .plans-page,
  footer {
    padding-left: 20px;
    padding-right: 20px;
  }

  .customer {
    padding: 0 20px;
    margin-top: 24px;
  }

  .workspace {
    padding: 22px 20px 24px;
  }

  .plans-page {
    margin-top: 32px;
  }

  h1 {
    font-size: clamp(28px, 8vw, 34px);
    line-height: 1.32;
  }

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

@media (max-width: 450px) {
  .mast,
  .plans-page,
  footer {
    padding-left: 16px;
    padding-right: 16px;
  }

  .customer {
    padding: 0 16px;
  }

  .workspace {
    padding: 20px 16px 22px;
  }

  .steps {
    gap: 6px;
  }

  .steps li {
    font-size: 11px;
  }

  .actions {
    gap: 8px;
  }

  .actions .primary,
  .actions .quiet {
    flex: 1 1 100%;
    min-height: 44px;
  }

  .facts > div {
    gap: 10px;
  }

  .plan-card {
    padding: 18px;
  }

  .plan-context-link {
    margin-left: 0;
  }
}

/* ---------- 动效偏好 ---------- */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }

  .plan-card:hover {
    transform: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .skip-link {
    transition: none;
  }
}

.intro-link{display:inline-flex;gap:10px;align-items:center;margin-top:24px;padding:12px 0;font-size:13px;font-weight:600;text-decoration:none}.intro-link:hover{text-decoration:underline}.plan-card-top{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-bottom:14px}.plan-mark{display:inline-flex;align-items:center;justify-content:center;width:46px;height:46px;border:1px solid var(--cu-primary-line);border-radius:12px;background:var(--cu-primary-soft);font:600 20px var(--cu-font);color:var(--cu-primary)}
