/* ── 设计令牌 ─────────────────────────────────────────────── */
:root {
  /* 中性 */
  --bg:           #fafaf9;
  --surface:      #ffffff;
  --surface-2:    #f5f5f4;
  --surface-3:    #ebebe9;

  /* 文字层级 */
  --text:         #18181b;
  --text-2:       #52525b;
  --text-3:       #71717a;
  --text-4:       #a1a1aa;
  --text-5:       #d4d4d8;

  /* 边框 */
  --border:       rgba(24, 24, 27, 0.06);
  --border-2:     rgba(24, 24, 27, 0.10);
  --border-3:     rgba(24, 24, 27, 0.14);

  /* 强调色 — 深鸢尾紫 */
  --accent:       #5b50ec;
  --accent-2:     #4f46e5;
  --accent-soft:  rgba(91, 80, 236, 0.08);
  --accent-soft-2:rgba(91, 80, 236, 0.14);
  --accent-ring:  rgba(91, 80, 236, 0.20);

  /* 状态色 */
  --success:      #16a34a;
  --success-soft: rgba(22, 163, 74, 0.10);
  --warning:      #d97706;
  --warning-soft: rgba(217, 119, 6, 0.10);
  --danger:       #dc2626;
  --danger-soft:  rgba(220, 38, 38, 0.08);

  /* 阴影 */
  --shadow-sm:  0 1px 2px rgba(24, 24, 27, 0.04);
  --shadow:     0 1px 3px rgba(24, 24, 27, 0.04), 0 1px 2px rgba(24, 24, 27, 0.03);
  --shadow-md:  0 4px 12px rgba(24, 24, 27, 0.05), 0 2px 4px rgba(24, 24, 27, 0.04);
  --shadow-lg:  0 12px 32px rgba(24, 24, 27, 0.08), 0 4px 8px rgba(24, 24, 27, 0.04);

  /* 圆角 */
  --r-sm:  6px;
  --r:     10px;
  --r-md:  14px;
  --r-lg:  18px;

  /* 字体 */
  --sans:  'Geist', 'Noto Sans SC', -apple-system, system-ui, sans-serif;
  --mono:  'Geist Mono', 'SF Mono', monospace;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
  font-family: var(--sans);
  background-color: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
  font-feature-settings: 'cv11', 'ss01', 'ss03';
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a { color: inherit; }

/* ── 顶部导航 ─────────────────────────────────────────── */
.hd {
  position: sticky;
  top: 0;
  z-index: 100;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(250, 250, 249, 0.86));
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.72) inset;
}

.hd-inner {
  max-width: 880px;
  margin: 0 auto;
  padding: 0 24px;
  height: 64px;
  display: flex;
  align-items: center;
  gap: 16px;
}

.hd-logo {
  display: flex;
  align-items: center;
  gap: 11px;
  text-decoration: none;
  min-width: 0;
}

.hd-emblem {
  width: 34px;
  height: 34px;
  border-radius: 11px;
  background:
    radial-gradient(circle at 30% 20%, rgba(255, 255, 255, 0.35), transparent 32%),
    linear-gradient(135deg, var(--accent), #3730a3);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  flex-shrink: 0;
  box-shadow:
    0 8px 18px rgba(91, 80, 236, 0.24),
    0 1px 0 rgba(255, 255, 255, 0.28) inset;
}

.hd-emblem svg { display: block; }

.hd-brand {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.hd-title {
  font-size: 15px;
  font-weight: 650;
  color: var(--text);
  letter-spacing: -0.018em;
  line-height: 1.15;
  white-space: nowrap;
}

.hd-sub {
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 500;
  color: var(--text-4);
  letter-spacing: 0.02em;
  line-height: 1.1;
  text-transform: uppercase;
  white-space: nowrap;
}

.hd-sep { flex: 1; }

.hd-nav {
  display: flex;
  align-items: center;
  gap: 3px;
  padding: 3px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.68);
  box-shadow: var(--shadow-sm);
}

.hd-nav a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 11px;
  border-radius: 9px;
  font-size: 13px;
  font-weight: 560;
  color: var(--text-3);
  text-decoration: none;
  transition: color 0.15s, background 0.15s, box-shadow 0.15s;
  letter-spacing: -0.005em;
  line-height: 1;
}

.hd-nav a svg {
  display: block;
  opacity: 0.72;
}

.hd-nav a:hover {
  color: var(--text);
  background: rgba(245, 245, 244, 0.84);
}

.hd-nav a.on {
  color: var(--text);
  background: var(--surface);
  box-shadow: 0 1px 2px rgba(24, 24, 27, 0.08);
}

.hd-nav a.on svg {
  color: var(--accent);
  opacity: 1;
}

.hd-logout {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 10px;
  border-radius: var(--r-sm);
  background: none;
  border: 1px solid var(--border-2);
  color: var(--text-3);
  font-family: var(--sans);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: color 0.15s, background 0.15s, border-color 0.15s;
  letter-spacing: -0.005em;
  flex-shrink: 0;
}

.hd-logout:hover {
  color: var(--danger);
  background: var(--danger-soft);
  border-color: rgba(220, 38, 38, 0.18);
}

.hd-badge {
  padding: 4px 8px;
  border: 1px solid var(--border);
  border-radius: 100px;
  background: var(--surface);
  color: var(--text-3);
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.04em;
  box-shadow: var(--shadow-sm);
}

/* ── 主版心 ──────────────────────────────────────────────── */
.wrap {
  max-width: 880px;
  margin: 0 auto;
  padding: 40px 24px 140px;
}
.wrap.auth-wrap { max-width: 980px; }

/* ── Hero ────────────────────────────────────────────────── */
.hero {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 32px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--border);
}

.hero-info { min-width: 0; }

.hero-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 100px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.02em;
  margin-bottom: 10px;
}

.hero-eyebrow-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
}

.hero-title {
  font-size: 26px;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--text);
  line-height: 1.2;
  margin-bottom: 6px;
}

.hero-sub {
  font-size: 14px;
  color: var(--text-3);
  letter-spacing: -0.005em;
}

.hero-quota {
  text-align: right;
  flex-shrink: 0;
}

.hero-quota-num {
  font-family: var(--mono);
  font-size: 20px;
  font-weight: 500;
  color: var(--text);
  letter-spacing: -0.02em;
  font-feature-settings: 'tnum';
}

.hero-quota-num span {
  color: var(--text-4);
  font-weight: 400;
}

.hero-quota-lbl {
  font-size: 12px;
  color: var(--text-3);
  margin-top: 2px;
}

.hero-quota-bar {
  width: 140px;
  height: 4px;
  background: var(--surface-3);
  border-radius: 100px;
  overflow: hidden;
  margin-top: 8px;
  margin-left: auto;
}

.hero-quota-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 100px;
  width: 0%;
  transition: width 0.35s;
}

.hero-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

/* ── 步骤指示器 ──────────────────────────────────────────── */
.stepper {
  display: flex;
  align-items: center;
  margin-bottom: 28px;
}

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

.stp-node {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 1.5px solid var(--border-3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-4);
  background: var(--surface);
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  flex-shrink: 0;
}

.stp-lbl {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-4);
  white-space: nowrap;
  transition: color 0.25s;
  letter-spacing: -0.005em;
}

.stp.active .stp-node {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  box-shadow: 0 0 0 4px var(--accent-soft);
}

.stp.active .stp-lbl { color: var(--text); font-weight: 600; }

.stp.done .stp-node {
  background: var(--success);
  border-color: var(--success);
  color: #fff;
  font-size: 0;
  position: relative;
}

.stp.done .stp-node::after {
  content: '';
  position: absolute;
  width: 8px;
  height: 4px;
  border-left: 1.5px solid #fff;
  border-bottom: 1.5px solid #fff;
  transform: rotate(-45deg) translate(0.5px, -1px);
}

.stp.done .stp-lbl { color: var(--text-2); }

.stp-line {
  flex: 1;
  height: 1px;
  background: var(--border-2);
  margin: 0 12px;
  position: relative;
  overflow: hidden;
}

.stp-line::after {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--success);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.stp-line.done::after { transform: scaleX(1); }

/* ── 卡片 ────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  box-shadow: var(--shadow);
  margin-bottom: 14px;
  overflow: hidden;
  transition: box-shadow 0.2s, border-color 0.2s;
}

.card:hover { box-shadow: var(--shadow-md); }

.card-hd {
  padding: 16px 22px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.card-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.005em;
}

.card-desc {
  margin-left: auto;
  font-size: 12px;
  color: var(--text-4);
}

.required-chip,
.required-meter {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 650;
  line-height: 1;
}

.required-chip {
  padding: 5px 8px;
  color: var(--danger);
  background: var(--danger-soft);
  border: 1px solid rgba(220, 38, 38, 0.16);
}

.required-meter {
  gap: 4px;
  margin-left: auto;
  padding: 5px 9px;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid rgba(91, 80, 236, 0.15);
}

.required-meter.complete {
  color: var(--success);
  background: var(--success-soft);
  border-color: rgba(22, 163, 74, 0.18);
}

.required-meter + .card-desc { margin-left: 0; }

.card-body { padding: 4px 22px 20px; }

/* ── 表单分区 ──────────────────────────────────────────── */
.fsec { margin-bottom: 22px; }
.fsec:last-child { margin-bottom: 0; }

.fsec-hd {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

.fsec-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-3);
  letter-spacing: -0.005em;
}

.fsec-line {
  flex: 1;
  height: 1px;
  background: var(--border);
}

.fsec-saved {
  font-size: 11px;
  font-weight: 500;
  color: var(--success);
  display: flex;
  align-items: center;
  gap: 4px;
}

.fsec-clear {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-4);
  background: none;
  border: none;
  cursor: pointer;
  font-family: var(--sans);
  transition: color 0.15s;
  padding: 0;
}

.fsec-clear:hover { color: var(--danger); }

/* ── 表单字段 ──────────────────────────────────────────── */
.fgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.ff { display: flex; flex-direction: column; gap: 6px; }
.ff.span2 { grid-column: 1 / -1; }

.lbl {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-2);
  letter-spacing: -0.005em;
}

.req-pill {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 2px 6px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 10px;
  font-weight: 700;
  line-height: 1.15;
}

.field-shell {
  position: relative;
}

.is-required .field-shell::before {
  content: '';
  position: absolute;
  left: 5px;
  top: 7px;
  bottom: 7px;
  width: 3px;
  border-radius: 999px;
  background: var(--accent);
  opacity: 0.65;
  z-index: 1;
  transition: background 0.15s, opacity 0.15s, box-shadow 0.15s;
}

.is-required input,
.is-required textarea {
  padding-left: 16px;
}

.is-required.is-filled .field-shell::before {
  background: var(--success);
  opacity: 0.8;
}

.is-required.is-missing .field-shell::before {
  background: var(--danger);
  opacity: 1;
  box-shadow: 0 0 0 3px var(--danger-soft);
}

.is-required.is-missing .lbl,
.is-required.is-missing .field-hint {
  color: var(--danger);
}

.is-required.is-missing input,
.is-required.is-missing textarea {
  border-color: rgba(220, 38, 38, 0.72);
  background:
    linear-gradient(90deg, rgba(220, 38, 38, 0.05), transparent 28%),
    var(--surface);
  box-shadow: 0 0 0 3px var(--danger-soft);
}

.field-hint {
  min-height: 16px;
  color: var(--text-4);
  font-size: 11px;
  line-height: 1.35;
  transition: color 0.15s;
}

input[type="text"],
input[type="password"],
input[type="email"],
select,
textarea {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border-2);
  border-radius: var(--r-sm);
  font-family: var(--sans);
  font-size: 14px;
  color: var(--text);
  background: var(--surface);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
  letter-spacing: -0.005em;
  line-height: 1.5;
}

input[type="text"]::placeholder,
input[type="password"]::placeholder,
input[type="email"]::placeholder,
textarea::placeholder { color: var(--text-4); }

input[type="text"]:hover,
input[type="password"]:hover,
input[type="email"]:hover,
select:hover,
textarea:hover { border-color: var(--border-3); }

input[type="text"]:focus,
input[type="password"]:focus,
input[type="email"]:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-ring);
}

.is-required.is-missing input[type="text"]:focus,
.is-required.is-missing textarea:focus {
  border-color: rgba(220, 38, 38, 0.72);
  box-shadow: 0 0 0 3px var(--danger-soft);
}

.topic-ff input {
  font-size: 16px;
  font-weight: 500;
  padding: 11px 14px;
  padding-left: 18px;
}

select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%2371717a' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 11px center;
  padding-right: 34px;
  cursor: pointer;
}

textarea { resize: vertical; min-height: 88px; line-height: 1.6; }

/* ── 单选切换组 (segmented control) ─────────────────────── */
.seg {
  display: inline-flex;
  padding: 3px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r);
  gap: 2px;
}

.seg-opt { position: relative; }
.seg-opt input { position: absolute; opacity: 0; width: 0; height: 0; }

.seg-lbl {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 6px 16px;
  border-radius: 7px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-3);
  transition: all 0.18s;
  letter-spacing: -0.005em;
}

.seg-lbl:hover { color: var(--text-2); }

.seg-opt input:checked + .seg-lbl {
  background: var(--surface);
  color: var(--text);
  font-weight: 600;
  box-shadow: var(--shadow-sm);
}

.practical-extra {
  display: none;
  margin-top: 14px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: var(--r);
  background: var(--surface-2);
}

.practical-extra.on { display: block; }

.practical-extra-lbl {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-2);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.practical-extra-lbl::before {
  content: '';
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--accent);
}

/* ── 按钮 ──────────────────────────────────────────────── */
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 11px 18px;
  background: var(--text);
  color: #fff;
  border: 1px solid var(--text);
  border-radius: var(--r);
  font-family: var(--sans);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, transform 0.05s;
  letter-spacing: -0.01em;
  box-shadow: var(--shadow-sm);
}

.btn-primary:hover { background: #27272a; }
.btn-primary:active { transform: translateY(0.5px); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 7px 14px;
  background: var(--surface);
  color: var(--text-2);
  border: 1px solid var(--border-2);
  border-radius: var(--r-sm);
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
  text-decoration: none;
}

.btn-secondary:hover {
  background: var(--surface-2);
  color: var(--text);
}

/* ── 最近生成 ──────────────────────────────────────────── */
.history-card {
  margin-top: 14px;
}

.history-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.history-item {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 14px;
  padding: 11px 12px;
  border: 1px solid var(--border);
  border-radius: var(--r);
  background: var(--surface-2);
}

.history-title {
  color: var(--text);
  font-size: 13px;
  font-weight: 650;
  letter-spacing: -0.005em;
  line-height: 1.3;
  word-break: break-word;
}

.history-meta {
  margin-top: 3px;
  color: var(--text-4);
  font-size: 11px;
  line-height: 1.35;
}

.history-empty {
  padding: 14px 12px;
  border: 1px dashed var(--border-2);
  border-radius: var(--r);
  color: var(--text-4);
  background: var(--surface-2);
  font-size: 13px;
  text-align: center;
}

.btn-accent {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 9px 18px;
  background: var(--accent);
  color: #fff;
  border: 1px solid var(--accent);
  border-radius: var(--r-sm);
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, box-shadow 0.15s;
  box-shadow: var(--shadow-sm);
  letter-spacing: -0.005em;
  text-decoration: none;
}

.btn-accent:hover {
  background: var(--accent-2);
  box-shadow: 0 4px 12px var(--accent-ring);
}

/* ── 错误提示 ──────────────────────────────────────────── */
.err-box {
  display: none;
  padding: 10px 14px;
  border: 1px solid rgba(220, 38, 38, 0.20);
  border-radius: var(--r);
  background: var(--danger-soft);
  color: var(--danger);
  font-size: 13px;
  margin-bottom: 16px;
  align-items: center;
  gap: 8px;
}

.err-box::before {
  content: '!';
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--danger);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
}

/* ── Step 2: 加载 ──────────────────────────────────────── */
#step-2 {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 56vh;
  text-align: center;
}

.ld-icon {
  position: relative;
  width: 56px;
  height: 56px;
  margin-bottom: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ld-icon::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: var(--accent-soft);
}

.ld-icon::after {
  content: '';
  position: absolute;
  inset: 8px;
  border-radius: 50%;
  border: 1.5px solid var(--accent);
  border-top-color: transparent;
  animation: ld-spin 0.8s linear infinite;
}

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

.ld-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.01em;
  margin-bottom: 6px;
}

.ld-hint {
  font-size: 13px;
  color: var(--text-3);
  margin-bottom: 32px;
}

.ld-steps {
  display: flex;
  flex-direction: column;
  gap: 4px;
  width: 100%;
  max-width: 360px;
  text-align: left;
}

.ld-stp {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: var(--r);
  background: transparent;
  transition: all 0.3s;
}

.ld-stp.go   { background: var(--accent-soft); }
.ld-stp.done { background: transparent; }

.ld-dot {
  position: relative;
  width: 16px;
  height: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.ld-dot::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-5);
  transition: all 0.3s;
}

.ld-stp.go .ld-dot::before {
  background: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft-2);
}

.ld-stp.done .ld-dot::before {
  width: 0;
  height: 0;
  background: transparent;
}

.ld-stp.done .ld-dot::after {
  content: '';
  width: 9px;
  height: 5px;
  border-left: 1.5px solid var(--success);
  border-bottom: 1.5px solid var(--success);
  transform: rotate(-45deg) translate(1px, -1px);
  position: absolute;
}

.ld-stp-text {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-3);
  transition: color 0.3s;
}

.ld-stp.go   .ld-stp-text { color: var(--text); font-weight: 500; }
.ld-stp.done .ld-stp-text { color: var(--text-3); }

.ld-timer {
  margin-top: 24px;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text-4);
  font-feature-settings: 'tnum';
}

/* ── Step 3: 预览 ──────────────────────────────────────── */
.pv-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 20px;
}

.pv-title {
  font-size: 22px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.02em;
}

.pv-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 100px;
  background: var(--success-soft);
  color: var(--success);
  font-size: 12px;
  font-weight: 600;
}

.pf { margin-bottom: 12px; }
.pf:last-child { margin-bottom: 0; }

.pf-lbl {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-3);
  margin-bottom: 5px;
  letter-spacing: -0.005em;
}

.pf textarea {
  width: 100%;
  border: 1px solid var(--border-2);
  border-radius: var(--r-sm);
  padding: 8px 12px;
  font-family: var(--sans);
  font-size: 13.5px;
  color: var(--text);
  line-height: 1.65;
  resize: none;
  overflow: hidden;
  background: var(--surface);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.pf textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-ring);
}

.pf.ro textarea {
  background: var(--surface-2);
  color: var(--text-2);
  cursor: default;
  border-color: var(--border);
}

.pgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.pgrid .span2 { grid-column: 1 / -1; }

.div {
  height: 1px;
  background: var(--border);
  margin: 16px 0;
}

/* ── 课中实施表 ────────────────────────────────────────── */
.step-tbl {
  border: 1px solid var(--border-2);
  border-radius: var(--r);
  overflow: hidden;
  margin-bottom: 12px;
}

.step-tbl:last-child { margin-bottom: 0; }

.step-tbl-hd {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 14px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
}

.step-seal {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  background: var(--text);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-family: var(--mono);
}

.step-stage-ta {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  resize: none;
  overflow: hidden;
  padding: 0;
  box-shadow: none !important;
}

.step-stage-ta:focus { box-shadow: none; }

.step-tbl-body {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
}

.step-cell {
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
}

.step-cell:last-child { border-right: none; }

.step-cell-lbl {
  font-size: 10.5px;
  font-weight: 600;
  color: var(--text-3);
  letter-spacing: -0.005em;
  padding: 8px 12px 4px;
}

.step-cell textarea {
  flex: 1;
  border: none;
  border-radius: 0;
  padding: 4px 12px 12px;
  font-family: var(--sans);
  font-size: 13px;
  color: var(--text);
  background: transparent;
  resize: none;
  overflow: hidden;
  outline: none;
  min-height: 76px;
  line-height: 1.6;
  box-shadow: none !important;
}

.step-cell textarea:focus { background: var(--accent-soft); }

/* ── 配额 / 指标卡 ─────────────────────────────────────── */
.metric-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 16px;
}

.metric-cell {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 14px 16px;
  box-shadow: var(--shadow);
}

.metric-lbl {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-3);
  margin-bottom: 6px;
}

.metric-val {
  font-family: var(--mono);
  font-size: 22px;
  font-weight: 500;
  color: var(--text);
  line-height: 1.1;
  letter-spacing: -0.02em;
  font-feature-settings: 'tnum';
}

.metric-sub {
  font-size: 11px;
  color: var(--text-4);
  margin-top: 4px;
}

/* ── 大配额条（账户页）─────────────────────────────────── */
.quota-large {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-family: var(--mono);
  font-size: 14px;
  color: var(--text-2);
  margin-bottom: 10px;
  font-feature-settings: 'tnum';
}

.quota-large strong {
  color: var(--text);
  font-weight: 500;
}

.quota-bar-large {
  height: 8px;
  background: var(--surface-2);
  border-radius: 100px;
  overflow: hidden;
  border: 1px solid var(--border);
}

.quota-bar-large > div {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  border-radius: 100px;
  width: 0%;
  transition: width 0.35s;
}

/* ── 使用记录表格 ──────────────────────────────────────── */
.usage-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.usage-table th,
.usage-table td {
  border-bottom: 1px solid var(--border);
  padding: 10px 8px;
  text-align: left;
  letter-spacing: -0.005em;
}

.usage-table th {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-3);
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.usage-table td { color: var(--text-2); }
.usage-table tr:last-child td { border-bottom: none; }
.usage-table td:nth-child(n+3) { font-family: var(--mono); font-feature-settings: 'tnum'; }

.admin-table td:nth-child(n+3) { font-family: var(--sans); }

.admin-table select {
  width: 100%;
  min-width: 92px;
  border: 1px solid var(--border-2);
  border-radius: var(--r-sm);
  background: var(--surface);
  color: var(--text-2);
  padding: 7px 9px;
  font-family: var(--sans);
  font-size: 13px;
}

.admin-user-name {
  color: var(--text);
  font-weight: 600;
  margin-bottom: 3px;
}

.admin-user-email {
  color: var(--text-4);
  font-family: var(--mono);
  font-size: 11px;
}

.admin-save {
  width: 64px;
  padding-inline: 10px;
}

.admin-status {
  min-height: 18px;
  color: var(--text-4);
  font-size: 12px;
}

.admin-status.err { color: var(--danger); }

/* ── 登录页两栏 ──────────────────────────────────────── */
.auth-board {
  display: grid;
  grid-template-columns: minmax(260px, 0.9fr) minmax(320px, 1fr);
  gap: 20px;
  align-items: stretch;
}

.auth-board-register {
  grid-template-columns: minmax(300px, 1fr) minmax(360px, 0.95fr);
}

.auth-copy {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 32px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  overflow: hidden;
  min-height: 360px;
}

.auth-copy::before {
  content: '';
  position: absolute;
  top: -40%;
  right: -20%;
  width: 280px;
  height: 280px;
  background: radial-gradient(circle, var(--accent-soft) 0%, transparent 70%);
  pointer-events: none;
}

.auth-copy-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 100px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.02em;
  margin-bottom: 14px;
  position: relative;
  width: fit-content;
}

.auth-copy-eyebrow::before {
  content: '';
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
}

.auth-copy-title {
  font-size: 22px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.02em;
  line-height: 1.3;
  margin-bottom: 10px;
  position: relative;
}

.auth-copy-desc {
  font-size: 14px;
  color: var(--text-3);
  line-height: 1.7;
  position: relative;
}

.auth-stamp {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 20px;
  position: relative;
}

.auth-stamp span {
  padding: 4px 10px;
  border-radius: 100px;
  border: 1px solid var(--border-2);
  background: var(--surface);
  color: var(--text-3);
  font-size: 11px;
  font-weight: 600;
  font-family: var(--mono);
  letter-spacing: 0.06em;
}

.auth-card {
  display: flex;
  flex-direction: column;
}

.auth-card .card-body { padding: 24px 22px 22px; }

.auth-card .card-hd {
  align-items: flex-start;
  padding-bottom: 6px;
}

.auth-card-sub {
  margin-top: 3px;
  font-size: 12px;
  color: var(--text-4);
  font-weight: 400;
}

.auth-card .ff + .ff { margin-top: 14px; }

.auth-actions {
  display: flex;
  gap: 8px;
  margin-top: 18px;
}

.auth-actions .btn-primary { flex: 1; width: auto; }
.auth-actions .btn-secondary { flex: 0 0 auto; padding: 10px 16px; font-size: 14px; }

.auth-msg {
  min-height: 18px;
  font-size: 12px;
  color: var(--success);
  margin-top: 12px;
  letter-spacing: -0.005em;
}

.auth-msg.err { color: var(--danger); }

.auth-switch {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
  color: var(--text-3);
  font-size: 13px;
  text-align: center;
}

.auth-switch a {
  color: var(--accent);
  font-weight: 600;
  text-decoration: none;
}

.auth-switch a:hover { text-decoration: underline; }

/* ── 底部固定栏 ────────────────────────────────────────── */
.sticky {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(250, 250, 249, 0.85);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-top: 1px solid var(--border);
  padding: 12px 24px;
  z-index: 200;
}

.sticky-inner {
  max-width: 880px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 10px;
}

.btn-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: var(--surface);
  border: 1px solid var(--border-2);
  border-radius: var(--r-sm);
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-2);
  cursor: pointer;
  transition: all 0.15s;
}

.btn-back:hover { background: var(--surface-2); color: var(--text); }

.spacer { flex: 1; }

.btn-json {
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 500;
  color: var(--text-3);
  background: none;
  border: none;
  cursor: pointer;
  padding: 7px 11px;
  border-radius: var(--r-sm);
  transition: all 0.15s;
}

.btn-json:hover { color: var(--text); background: var(--surface-2); }

.btn-dl {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 18px;
  background: var(--accent);
  color: #fff;
  border: 1px solid var(--accent);
  border-radius: var(--r-sm);
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, box-shadow 0.15s;
  box-shadow: var(--shadow-sm);
  letter-spacing: -0.005em;
}

.btn-dl:hover {
  background: var(--accent-2);
  box-shadow: 0 4px 12px var(--accent-ring);
}

.btn-dl:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ── 工具 ──────────────────────────────────────────────── */
.hidden { display: none !important; }

/* ── 响应式 ─────────────────────────────────────────────── */
@media (max-width: 640px) {
  .hd-inner { height: 58px; padding: 0 16px; gap: 10px; }
  .hd-emblem { width: 30px; height: 30px; border-radius: 9px; }
  .hd-sub, .hd-badge { display: none; }
  .hd-title { font-size: 14px; }
  .hd-nav a { padding: 7px 9px; }
  .hd-nav a span { display: none; }
  .hd-logout span { display: none; }
  .hd-logout { padding: 6px 8px; }
  .wrap { padding: 24px 16px 130px; }
  .hero { flex-direction: column; align-items: flex-start; }
  .hero-quota { text-align: left; width: 100%; }
  .hero-quota-bar { margin-left: 0; width: 100%; }
  .hero-actions { width: 100%; flex-wrap: wrap; }
  .auth-board { grid-template-columns: 1fr; }
  .auth-copy { min-height: auto; padding: 24px; }
  .fgrid, .pgrid { grid-template-columns: 1fr; }
  .metric-grid { grid-template-columns: 1fr; }
  .step-tbl-body { grid-template-columns: 1fr 1fr; }
  .step-cell:nth-child(2n) { border-right: none; }
  .step-cell:nth-child(1), .step-cell:nth-child(2) { border-bottom: 1px solid var(--border); }
  .sticky { padding: 10px 16px; }
  .stp-lbl { display: none; }
  .card-desc { display: none; }
  .usage-table { display: block; overflow-x: auto; white-space: nowrap; }
  .history-item { grid-template-columns: 1fr; }
  .history-item .btn-secondary { width: 100%; }
  .auth-actions { flex-direction: column; }
  .auth-actions .btn-secondary { width: 100%; }
}

/* ── 入场动画 ─────────────────────────────────────────── */
@keyframes fade-up {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.hero, .stepper, .card, .metric-grid, .auth-board {
  animation: fade-up 0.35s cubic-bezier(0.4, 0, 0.2, 1) both;
}

.stepper { animation-delay: 0.05s; }
.card:nth-of-type(1) { animation-delay: 0.10s; }
.card:nth-of-type(2) { animation-delay: 0.15s; }
.card:nth-of-type(3) { animation-delay: 0.20s; }
.card:nth-of-type(4) { animation-delay: 0.25s; }
