:root {
  --bg: #f3f7f4;
  --panel: #ffffff;
  --ink: #1f2d28;
  --muted: #6b7d75;
  --primary: #2f8f6b;
  --primary-d: #257257;
  --primary-soft: #e7f3ed;
  --gold: #c79a3a;
  --line: #e2ebe6;
  --shadow: 0 6px 24px rgba(31, 80, 60, 0.08);
  --shadow-hover: 0 12px 40px rgba(31, 80, 60, 0.14);
  --radius: 16px;
  /* 侧栏 */
  --sidebar-bg: #1a2f25;
  --sidebar-hover: #243e32;
  --sidebar-active: #2f8f6b;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--ink);
}

/* ============ App Shell ============ */
.app-shell { display: flex; height: 100vh; overflow: hidden; }

/* 侧边栏 */
.nav-sidebar {
  width: 240px; flex: 0 0 240px; background: var(--sidebar-bg); color: #fff;
  display: flex; flex-direction: column; padding: 22px 16px 16px;
}
.nav-brand { display: flex; align-items: center; gap: 10px; font-size: 17px; font-weight: 700; margin-bottom: 24px; padding-left: 6px; }
.nav-brand .logo { font-size: 24px; }
.nav-brand small { font-size: 11px; color: rgba(255, 255, 255, 0.6); font-weight: 400; display: block; }
.nav-menu { display: flex; flex-direction: column; gap: 6px; flex: 1; }
.nav-item {
  display: flex; align-items: center; gap: 10px; padding: 11px 12px; border-radius: 12px;
  color: rgba(255, 255, 255, 0.72); font-size: 14px; font-weight: 500; cursor: pointer;
  transition: .15s; user-select: none; text-decoration: none;
}
.nav-item:hover { background: var(--sidebar-hover); color: #fff; }
.nav-item.active { background: var(--sidebar-active); color: #fff; }
.nav-item.admin-item { color: #d9b35e; }
.nav-item.admin-item:hover { background: rgba(199, 154, 58, 0.15); color: #f0d18a; }
.nav-item.admin-item.active { background: rgba(199, 154, 58, 0.22); color: #f0d18a; }
.nav-icon { width: 20px; text-align: center; font-size: 16px; }
.nav-bottom { margin-top: 8px; }
.nav-admin {
  width: 100%; text-align: left; background: transparent; border: 1px solid rgba(255, 255, 255, 0.15);
  color: rgba(255, 255, 255, 0.7); padding: 10px 12px; border-radius: 12px; cursor: pointer; font-size: 13px;
}
.nav-admin:hover { background: rgba(255, 255, 255, 0.08); color: #fff; }
.nav-user { margin-top: 12px; background: rgba(255, 255, 255, 0.08); border-radius: 14px; padding: 12px; display: flex; align-items: center; gap: 10px; }
.nav-user[hidden] { display: none !important; }
.nav-user .avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--primary-soft); display: flex; align-items: center; justify-content: center; font-size: 18px; flex: 0 0 36px; }
.nav-user .info { flex: 1; min-width: 0; }
.nav-user .name { font-size: 13px; font-weight: 600; color: #fff; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-user .points { font-size: 12px; color: var(--gold); margin-top: 2px; }
.nav-user .logout { background: transparent; border: none; color: rgba(255, 255, 255, 0.55); cursor: pointer; font-size: 12px; }
.nav-user .logout:hover { color: #fff; }

/* 主区域 */
.main-area { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.main-header {
  height: 64px; background: var(--panel); box-shadow: var(--shadow);
  display: flex; align-items: center; justify-content: space-between; padding: 0 24px; flex: 0 0 auto;
}
.main-header h1 { font-size: 18px; font-weight: 700; margin: 0; }
.header-actions { display: flex; align-items: center; gap: 12px; }
.points-badge {
  background: #fbf3df; color: #8a6d1f; border: 1px solid #ecd9a0;
  padding: 6px 12px; border-radius: 999px; font-size: 13px; font-weight: 600;
}
.btn-icon { width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--line); background: #fff; cursor: pointer; font-size: 16px; }

.page { flex: 1; overflow-y: auto; padding: 24px; }
.page-header { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 20px; }
.page-title { font-size: 21px; font-weight: 700; margin: 0; }
.page-count { font-size: 14px; color: var(--muted); }
.link { color: var(--primary-d); cursor: pointer; font-weight: 600; }

/* ============ 广场分组与卡片 ============ */
.agent-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; }
@media (max-width: 1200px) { .agent-grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 900px) { .agent-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 600px) { .agent-grid { grid-template-columns: 1fr; } }

.agent-section { margin-bottom: 30px; }
.agent-section:last-child { margin-bottom: 0; }
.group-title { font-size: 16px; font-weight: 700; margin: 0 0 14px; display: flex; align-items: center; gap: 8px; }
.group-title .g-icon { font-size: 18px; }
.group-title .g-line { flex: 1; height: 1px; background: var(--line); }

.agent-card {
  background: var(--panel); border-radius: var(--radius); padding: 20px;
  box-shadow: var(--shadow); cursor: pointer; transition: .18s; position: relative;
  display: flex; flex-direction: column; min-height: 200px;
}
.agent-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-hover); }
.agent-card.featured { grid-column: span 2; min-height: 220px; color: #fff; overflow: hidden; }
@media (max-width: 900px) { .agent-card.featured { grid-column: span 2; } }
@media (max-width: 600px) { .agent-card.featured { grid-column: span 1; } }
.agent-card.featured.bg-purple { background: linear-gradient(135deg, #667eea, #764ba2); }
.agent-card.featured.bg-green { background: linear-gradient(135deg, #2f8f6b, #1a5c45); }
.agent-card.featured.bg-orange { background: linear-gradient(135deg, #f093fb, #f5576c); }
.agent-card.featured.bg-teal { background: linear-gradient(135deg, #4facfe, #00f2fe); }
.agent-card.featured .big-icon { position: absolute; right: 18px; bottom: 14px; font-size: 84px; opacity: .18; }
.card-tag {
  display: inline-flex; align-items: center; gap: 5px; background: var(--primary-soft); color: var(--primary-d);
  font-size: 12px; font-weight: 600; padding: 5px 10px; border-radius: 999px; width: fit-content; margin-bottom: 12px;
}
.agent-card.featured .card-tag { background: rgba(255, 255, 255, 0.18); color: #fff; }
.card-title { font-size: 17px; font-weight: 700; margin-bottom: 8px; line-height: 1.3; }
.card-desc { font-size: 13px; color: var(--muted); line-height: 1.6; flex: 1; margin-bottom: 14px; }
.agent-card.featured .card-desc { color: rgba(255, 255, 255, 0.85); }
.card-foot { display: flex; align-items: center; justify-content: space-between; margin-top: auto; }
.card-cost { font-size: 13px; color: var(--gold); font-weight: 700; }
.agent-card.featured .card-cost { color: #ffeaa7; }
.card-btn { background: var(--ink); color: #fff; border: none; border-radius: 10px; padding: 8px 14px; font-size: 13px; font-weight: 600; cursor: pointer; }
.card-btn:hover { background: #000; }
.agent-card.featured .card-btn { background: #fff; color: var(--ink); }
.agent-card.featured .card-btn:hover { background: rgba(255, 255, 255, 0.9); }

/* 六维综合看健康 · 广场顶部大卡片 */
.agent-card.hero-card {
  background: linear-gradient(135deg, #1f7a5a 0%, #2f8f6b 45%, #3a6ea5 100%);
  color: #fff; min-height: 210px; margin-bottom: 8px; overflow: hidden;
}
.agent-card.hero-card .big-icon { position: absolute; right: 22px; top: 14px; font-size: 76px; opacity: .22; }
.agent-card.hero-card .card-tag { background: rgba(255, 255, 255, 0.18); color: #fff; }
.agent-card.hero-card .card-title { color: #fff; font-size: 22px; }
.agent-card.hero-card .card-desc { color: rgba(255, 255, 255, 0.88); }
.agent-card.hero-card .card-cost { color: #ffeaa7; }
.agent-card.hero-card .card-btn { background: #fff; color: var(--ink); }
.agent-card.hero-card .card-btn:hover { background: rgba(255, 255, 255, 0.9); }
.hero-badge {
  align-self: flex-start; background: rgba(255, 255, 255, 0.22); color: #fff;
  font-size: 12px; font-weight: 700; padding: 4px 10px; border-radius: 999px; margin-bottom: 10px;
}
.hero-feats { display: flex; flex-wrap: wrap; gap: 8px; margin: 4px 0 14px; }
.hero-feat { background: rgba(255, 255, 255, 0.14); color: #fff; font-size: 12px; padding: 4px 10px; border-radius: 8px; }
@media (max-width: 600px) { .agent-card.hero-card .big-icon { font-size: 56px; } }

/* ============ 面板（技能详情 / 账户） ============ */
.panel-back { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 14px; cursor: pointer; margin-bottom: 16px; }
.panel-back:hover { color: var(--primary-d); }
.skill-panel { background: var(--panel); border-radius: var(--radius); box-shadow: var(--shadow); padding: 24px; max-width: 920px; }
.skill-head { display: flex; align-items: center; gap: 16px; border-bottom: 1px solid var(--line); padding-bottom: 16px; margin-bottom: 16px; }
.skill-head .big-emoji { width: 58px; height: 58px; border-radius: 16px; background: var(--primary-soft); display: flex; align-items: center; justify-content: center; font-size: 30px; flex: 0 0 58px; }
.skill-head h2 { margin: 0; font-size: 21px; }
.skill-head .tagline { color: var(--muted); font-size: 13px; margin-top: 4px; }
.skill-head .cost { margin-left: auto; background: #fbf3df; color: #8a6d1f; padding: 8px 14px; border-radius: 999px; font-weight: 700; font-size: 14px; }
.skill-desc { color: var(--muted); font-size: 14px; line-height: 1.7; margin-bottom: 18px; }

/* 表单 */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field.full { grid-column: 1 / -1; }
.field label { font-size: 13px; font-weight: 600; }
.field input, .field select, .field textarea {
  border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; font-size: 14px;
  font-family: inherit; background: #fff; color: var(--ink); outline: none; transition: .15s;
}
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.field textarea { resize: vertical; min-height: 64px; }

/* 文件字段（形象照 / 视频上传） */
.field input[type="file"] {
  padding: 9px 12px; border-style: dashed; background: var(--primary-soft);
  cursor: pointer; font-size: 13px;
}
.field input[type="file"]::file-selector-button {
  border: 0; border-radius: 8px; padding: 6px 12px; margin-right: 10px;
  background: var(--primary); color: #fff; font-size: 13px;
  cursor: pointer; font-family: inherit;
}
.field-note { font-size: 12px; color: var(--muted); line-height: 1.5; }
.file-hint { font-size: 12px; min-height: 16px; }
.file-ok { color: var(--primary-d); font-weight: 600; word-break: break-all; }
.cost-hint { font-size: 13px; color: var(--gold); margin: 12px 0; }

/* 对话 */
.chat { margin-top: 18px; border-top: 1px dashed var(--line); padding-top: 16px; }
.msg { display: flex; gap: 10px; margin-bottom: 14px; }
.msg.user { flex-direction: row-reverse; }
.bubble { max-width: 82%; padding: 12px 14px; border-radius: 12px; font-size: 14px; line-height: 1.7; white-space: pre-wrap; word-break: break-word; }
.msg.bot .bubble { background: var(--primary-soft); border: 1px solid #d4e9df; }
.msg.user .bubble { background: var(--primary); color: #fff; }
.bubble h2 { font-size: 16px; margin: 12px 0 6px; color: var(--primary-d); line-height: 1.4; }
.bubble h3 { font-size: 15px; margin: 10px 0 5px; color: var(--primary-d); }
.bubble h4 { font-size: 14px; margin: 9px 0 4px; color: var(--ink); font-weight: 700; }
.bubble p { margin: 4px 0; }
.bubble ul { margin: 4px 0; padding-left: 20px; }
.bubble li { margin: 3px 0; }
.bubble blockquote { margin: 8px 0; padding: 8px 12px; border-left: 3px solid var(--primary); background: #eef6f1; color: var(--muted); border-radius: 0 8px 8px 0; line-height: 1.6; }
.bubble strong { color: var(--primary-d); }
.msg .avatar { width: 34px; height: 34px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 18px; background: #eef3f0; flex: 0 0 34px; }
.msg.user .avatar { background: #dcefe5; }
.thinking { color: var(--muted); font-size: 13px; }

/* 服务端生成的内联图谱（家族数字基因图谱等） */
.svg-map { margin: 10px 0 14px; padding: 8px; background: #fff; border: 1px solid var(--line); border-radius: 12px; overflow-x: auto; }
.svg-map svg { display: block; width: 100%; min-width: 520px; height: auto; }

/* 创作歌曲：封面图 / 音频播放器 / 外链 */
.song-cover { display: block; max-width: 280px; width: 100%; margin: 10px 0 6px; border-radius: 12px; box-shadow: 0 4px 16px rgba(0,0,0,0.12); }
.song-audio { display: block; width: 100%; margin: 12px 0 4px; }
.song-link { display: inline-block; margin: 8px 0 4px; padding: 8px 16px; border-radius: 999px; background: linear-gradient(135deg, #6d83f2, #9b6cf2); color: #fff; font-weight: 600; text-decoration: none; }
.song-link:hover { opacity: 0.92; }
.song-video { display: block; width: 100%; max-width: 480px; margin: 12px 0 4px; border-radius: 12px; background: #000; box-shadow: 0 4px 16px rgba(0,0,0,0.12); }

/* 账户 */
.acct-row { display: flex; justify-content: space-between; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--line); }
.acct-points { font-size: 24px; font-weight: 800; color: var(--gold); }
.acct-id { font-size: 20px; font-weight: 800; color: var(--primary); letter-spacing: 0.5px; }
.plan-card { border: 1px solid var(--line); border-radius: 12px; padding: 16px; margin: 12px 0; }
.plan-title { font-weight: 700; font-size: 15px; }
.plan-sub { color: var(--muted); font-size: 13px; margin: 4px 0 12px; }
.recharge-input { display: flex; gap: 10px; align-items: center; margin: 8px 0 12px; }
.recharge-input input { flex: 1; border: 1px solid var(--line); border-radius: 10px; padding: 9px 12px; font-size: 14px; }
.order-item { display: flex; justify-content: space-between; align-items: center; padding: 10px 0; border-bottom: 1px dashed var(--line); font-size: 13px; }
.order-status { font-size: 12px; padding: 2px 8px; border-radius: 999px; }
.status-pending { background: #fdf3df; color: #8a6d1f; }
.status-paid { background: #e3f4ea; color: #257257; }

/* 欢迎 / 空态 */
.welcome { background: var(--panel); border-radius: var(--radius); box-shadow: var(--shadow); padding: 28px; margin-bottom: 24px; }
.welcome h2 { margin: 0 0 8px; }
.welcome p { margin: 0; color: var(--muted); }
.empty-page { background: var(--panel); border-radius: var(--radius); box-shadow: var(--shadow); padding: 60px 30px; text-align: center; color: var(--muted); }
.empty-emoji { font-size: 46px; }

/* ============ 平台简介 ============ */
.about-hero { text-align: center; background: var(--panel); border-radius: var(--radius); box-shadow: var(--shadow); padding: 40px 24px 32px; margin-bottom: 24px; }
.about-logo { font-size: 52px; }
.about-hero h1 { margin: 8px 0 6px; font-size: 26px; }
.about-slogan { color: var(--muted); margin: 0; font-size: 14px; }
.about-card { background: var(--panel); border-radius: var(--radius); box-shadow: var(--shadow); padding: 22px 24px; margin-bottom: 18px; }
.about-card h3 { margin: 0 0 12px; font-size: 17px; }
.about-card h4 { margin: 16px 0 6px; font-size: 15px; color: var(--ink); }
.about-card p { color: var(--muted); line-height: 1.8; margin: 0; font-size: 14px; }
.about-skills { display: flex; flex-direction: column; gap: 10px; margin-bottom: 14px; }
.about-skill { display: flex; gap: 14px; align-items: baseline; padding: 10px 14px; background: var(--primary-soft); border-radius: 12px; }
.about-skill-t { font-weight: 700; color: var(--primary-d); flex: 0 0 140px; font-size: 14px; }
.about-skill-d { color: var(--ink); font-size: 13px; line-height: 1.6; }
.about-list { margin: 0 0 16px; padding-left: 20px; color: var(--muted); line-height: 1.9; font-size: 14px; }

/* ============ 商机报告摘要卡片 / 阅读弹窗 ============ */
.report-card { background: linear-gradient(135deg, var(--primary-soft), var(--panel)); border: 1px solid var(--primary-line, #e6dff5); border-radius: var(--radius); padding: 18px 20px; margin-bottom: 20px; cursor: pointer; transition: transform .12s ease, box-shadow .12s ease; box-shadow: var(--shadow); }
.report-card:hover { transform: translateY(-2px); box-shadow: 0 10px 28px rgba(120,90,200,.18); }
.report-card:focus { outline: 2px solid var(--primary); outline-offset: 2px; }
.report-card-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.report-card-icon { font-size: 22px; }
.report-card-title { font-weight: 700; font-size: 15px; color: var(--ink); flex: 1; }
.report-card-tag { font-size: 12px; color: var(--primary-d); white-space: nowrap; }
.report-card-sum { margin: 0; color: var(--muted); line-height: 1.8; font-size: 13.5px; }
.modal-report { max-width: 860px; width: 92%; }
.modal-report .modal-body { max-height: 72vh; overflow: auto; }
.report-body { white-space: pre-wrap; word-break: break-word; font-family: -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif; font-size: 13.5px; line-height: 1.85; color: var(--ink); margin: 0; }
.toc-body { font-family: -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif; color: var(--ink); }

/* 乔布斯样本报告弹窗（iframe 内嵌自包含报告） */
.jobs-report-modal { width: 94%; max-width: 920px; }
.jobs-report-body { padding: 0; max-height: 82vh; }
.jobs-report-frame { width: 100%; height: 80vh; border: 0; display: block; border-radius: 0 0 16px 16px; background: var(--bg); }
.sample-report-btn { margin-top: 12px; font-size: 14.5px; letter-spacing: .5px; }

/* 字段下挂的可折叠帮助面板（如中医体质养生 12 题自测） */
.quiz-help { margin-top: 8px; background: #f5f9f5; border: 1px solid #d6e7d6; border-radius: 8px; padding: 8px 12px; font-size: 13.5px; line-height: 1.7; color: #2f5a36; }
.quiz-help > summary { cursor: pointer; font-weight: 600; user-select: none; outline: none; }
.quiz-help > summary::-webkit-details-marker { color: #5a8b5a; }
.quiz-intro { margin: 8px 0 6px; color: #46664c; }
.quiz-list { margin: 4px 0 4px 20px; padding: 0; }
.quiz-list > li { margin: 6px 0; }
.quiz-no { display: inline-block; min-width: 64px; color: #5a8b5a; font-weight: 600; margin-right: 4px; }
.quiz-q { color: #1f3a23; }
.quiz-opts { display: block; margin-top: 2px; padding-left: 68px; color: #46664c; font-size: 12.5px; }
.toc-title { font-size: 18px; font-weight: 800; text-align: center; margin: 0 0 18px; color: var(--primary-d, #5b3fb0); }
.course-meta { text-align: center; font-size: 13px; color: var(--muted); margin: 0 0 18px; padding: 8px 12px; background: var(--primary-soft, #f3effb); border-radius: 8px; }
.course-meta b { color: var(--primary, #7c5cd6); font-size: 15px; }
.toc-chapter { margin-bottom: 16px; }
.toc-chapter-h { font-size: 15px; font-weight: 700; margin-bottom: 6px; padding: 8px 12px; background: var(--primary-soft, #f3effb); border-left: 3px solid var(--primary, #7c5cd6); border-radius: 6px; }
.toc-section { font-size: 13.5px; font-weight: 600; margin: 6px 0 0 14px; color: var(--ink); }
.toc-subs { margin: 2px 0 6px 28px; }
.toc-sub { font-size: 13px; color: var(--muted); line-height: 1.7; }
.toc-no { color: var(--primary, #7c5cd6); font-variant-numeric: tabular-nums; margin-right: 6px; font-weight: 700; }

/* ============ 商机合作联系二维码 ============ */
.qr-card {
  margin-top: 20px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px;
  text-align: center;
  box-shadow: var(--shadow);
}
.qr-card h3 { margin: 0 0 16px; font-size: 17px; color: var(--ink); }
.qr-img { width: 220px; max-width: 78%; height: auto; border-radius: 12px; box-shadow: 0 4px 14px rgba(0,0,0,.08); }
.qr-tip { margin: 16px 0 0; color: var(--muted); font-size: 14px; line-height: 1.7; }
.qr-modal { max-width: 340px; }

/* ============ 商城 / 学习 / 兑换 ============ */
.mall-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
@media (max-width: 1000px) { .mall-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 600px) { .mall-grid { grid-template-columns: 1fr; } }
.learn-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; }
@media (max-width: 600px) { .learn-grid { grid-template-columns: 1fr; } }
.product-card { background: var(--panel); border-radius: var(--radius); box-shadow: var(--shadow); padding: 22px; display: flex; flex-direction: column; transition: .18s; }
.product-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-hover); }
.product-icon { font-size: 42px; margin-bottom: 12px; }
.product-thumb { width: 100%; height: 180px; object-fit: cover; border-radius: 10px; margin-bottom: 12px; box-shadow: 0 4px 12px rgba(0,0,0,.08); cursor: pointer; transition: transform .18s; }
.product-thumb:hover { transform: scale(1.02); }
.product-name { font-size: 17px; font-weight: 700; margin-bottom: 8px; }
.product-gallery-modal { width: 94%; max-width: 760px; }
.product-gallery-intro { margin-bottom: 16px; line-height: 1.7; color: var(--ink); }
.product-gallery-intro span { color: var(--muted); font-size: 13px; }
.product-gallery-grid { display: flex; flex-direction: column; gap: 16px; }
.product-gallery-item { display: block; border-radius: 12px; overflow: hidden; box-shadow: 0 4px 14px rgba(0,0,0,.10); transition: transform .18s; }
.product-gallery-item:hover { transform: scale(1.01); }
.product-gallery-item img { width: 100%; height: auto; display: block; }
.product-desc { color: var(--muted); font-size: 13px; line-height: 1.7; flex: 1; margin-bottom: 14px; }
.product-price { font-size: 20px; font-weight: 800; color: var(--gold); margin-bottom: 10px; }
.product-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: auto; }
.product-tag { font-size: 12px; font-weight: 600; padding: 4px 10px; border-radius: 999px; background: var(--primary-soft); color: var(--primary-d); }
.product-tag.ok { background: #e3f4ea; color: #257257; }
.product-tag.no { background: #fdeaea; color: #b03a3a; }
.buy-btn { background: var(--primary); color: #fff; border: none; border-radius: 10px; padding: 8px 14px; font-size: 13px; font-weight: 600; cursor: pointer; white-space: nowrap; }
.buy-btn:hover { background: var(--primary-d); }
.buy-btn:disabled { background: #c7d2cc; cursor: not-allowed; }
.cta-row { display: flex; align-items: center; gap: 12px; margin-top: 22px; color: var(--muted); font-size: 14px; flex-wrap: wrap; }

/* 按钮 */
.btn { border: none; cursor: pointer; border-radius: 10px; padding: 8px 16px; font-size: 14px; font-weight: 600; transition: .15s; font-family: inherit; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-d); }
.btn-ghost { background: transparent; color: var(--primary-d); border: 1px solid var(--line); }
.btn-ghost:hover { background: var(--primary-soft); }
.btn-block { width: 100%; padding: 11px; margin-top: 6px; }

/* ============ 弹窗 ============ */
.modal-mask { position: fixed; inset: 0; background: rgba(20, 40, 32, 0.45); display: flex; align-items: center; justify-content: center; z-index: 50; padding: 16px; }
.modal-mask[hidden] { display: none !important; }
.modal { background: #fff; border-radius: 16px; width: 420px; max-width: 100%; max-height: 90vh; overflow: auto; box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25); }
.modal-wide { width: 640px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--line); font-weight: 700; }
.modal-close { border: none; background: transparent; font-size: 24px; cursor: pointer; color: var(--muted); line-height: 1; }
.modal-body { padding: 20px; }
.tabs { display: flex; gap: 8px; margin-bottom: 16px; }
.tab { flex: 1; padding: 10px; border: 1px solid var(--line); background: #fff; border-radius: 10px; cursor: pointer; font-weight: 600; color: var(--muted); }
.tab.active { background: var(--primary-soft); color: var(--primary-d); border-color: var(--primary); }
.modal-body form label { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; font-size: 13px; font-weight: 600; }
.modal-body form input { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; font-size: 14px; font-family: inherit; }
.form-msg { font-size: 13px; min-height: 18px; color: #c0392b; margin-bottom: 6px; }
.auth-tip { font-size: 12px; color: var(--muted); margin-top: 12px; text-align: center; }
.stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 8px; }
.stat-box { background: var(--primary-soft); border-radius: 12px; padding: 14px; text-align: center; }
.stat-num { font-size: 24px; font-weight: 800; color: var(--primary-d); }
.stat-label { font-size: 12px; color: var(--muted); margin-top: 4px; }

/* 管理弹窗 tab + 兑换码管理 */
.admin-tabs { display: flex; gap: 8px; }
.admin-tab { flex: 1; padding: 9px; border: 1px solid var(--line); background: #fff; border-radius: 10px; cursor: pointer; font-weight: 600; color: var(--muted); }
.admin-tab.active { background: var(--primary-soft); color: var(--primary-d); border-color: var(--primary); }
.admin-content { margin-top: 14px; }
.admin-pane { margin-top: 4px; }

.codes-toolbar { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.codes-hint { font-size: 12px; color: var(--muted); }
.code-grid-head, .code-row { display: grid; grid-template-columns: 1.4fr .8fr 1.4fr 1.2fr .7fr; gap: 10px; align-items: center; padding: 9px 12px; font-size: 13px; }
.code-grid-head { font-weight: 700; color: var(--muted); border-bottom: 1px solid var(--line); }
.code-row { border-bottom: 1px dashed var(--line); }
.code-val { font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace; font-weight: 700; letter-spacing: 1px; color: var(--ink); }
.code-pts { color: var(--gold); font-weight: 700; }
.code-status.unused { color: #257257; font-weight: 600; }
.code-status.used { color: var(--muted); }
.code-status.expired { color: #b03a3a; font-weight: 600; }
.code-exp { color: var(--muted); font-size: 12px; }
.code-copy { background: transparent; border: 1px solid var(--line); border-radius: 8px; padding: 4px 10px; font-size: 12px; cursor: pointer; color: var(--primary-d); white-space: nowrap; }
.code-copy:hover { background: var(--primary-soft); }
.gen-box { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }
.gen-box input { width: 72px; border: 1px solid var(--line); border-radius: 8px; padding: 7px 8px; font-size: 14px; font-family: inherit; outline: none; }
.gen-box input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.codes-export-row { display: flex; gap: 10px; margin: 4px 0 16px; flex-wrap: wrap; }

/* 兑换码输入（用户端） */
.redeem-panel { max-width: 640px; }
.redeem-tip { color: var(--muted); font-size: 13px; line-height: 1.7; margin: 0 0 16px; }
.redeem-input-row { display: flex; gap: 10px; }
.redeem-input-row input { flex: 1; border: 1px solid var(--line); border-radius: 10px; padding: 11px 14px; font-size: 16px; letter-spacing: 2px; text-transform: uppercase; font-family: ui-monospace, Menlo, Consolas, monospace; outline: none; }
.redeem-input-row input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.redeem-ok { margin-top: 14px; background: #e3f4ea; color: #257257; border-radius: 10px; padding: 12px 14px; font-size: 14px; font-weight: 600; }
.redeem-err { margin-top: 14px; background: #fdeaea; color: #b03a3a; border-radius: 10px; padding: 12px 14px; font-size: 14px; font-weight: 600; }

/* Toast */
.toast {
  position: fixed; bottom: 28px; left: 50%; transform: translateX(-50%);
  background: #1f2d28; color: #fff; padding: 11px 20px; border-radius: 10px; font-size: 14px; z-index: 80;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3); animation: pop .2s ease;
}
@keyframes pop { from { opacity: 0; transform: translate(-50%, 8px); } to { opacity: 1; transform: translate(-50%, 0); } }

/* ============ 移动端竖屏 ============ */
@media (max-width: 768px) {
  .app-shell { flex-direction: column; height: auto; min-height: 100vh; }
  .nav-sidebar { width: 100%; flex: none; flex-direction: row; align-items: center; padding: 8px 12px; gap: 4px; overflow-x: auto; }
  .nav-brand { display: none; }
  .nav-menu { flex-direction: row; gap: 4px; flex: 1; overflow-x: auto; padding-bottom: 2px; }
  .nav-menu::-webkit-scrollbar { height: 0; }
  .nav-item { padding: 8px 12px; white-space: nowrap; }
  .nav-bottom { display: none; }
  .nav-user { display: none; }
  .main-header { padding: 0 16px; }
  .main-header h1 { font-size: 16px; }
  .page { padding: 16px 14px; }
  .page-title { font-size: 19px; }
  .skill-panel { padding: 18px; }
  .form-grid { grid-template-columns: 1fr; }
  .panel-back { margin-bottom: 14px; }
  .stat-grid { grid-template-columns: 1fr; }
}
