/* 心动触达 · 客户站设计系统（三套主题：浅色 / 深色 / 护眼，导航栏手动切换） */
:root {
  --bg: #0a0a12;
  --bg-2: #10101c;
  --surface: rgba(255, 255, 255, .04);
  --border: rgba(255, 255, 255, .08);
  --text: #f2f2f7;
  --muted: #9898a8;
  --rose: #ff5c8a;
  --violet: #a06bff;
  --green: #4ade80;
  --red: #f87171;
  --orange: #fbbf24;
  --grad: linear-gradient(120deg, #ff5c8a 0%, #c65bff 55%, #7c6bff 100%);
  --radius: 16px;
  /* 语义变量（随主题切换） */
  --nav-bg: rgba(10, 10, 18, .6);
  --panel: #14141f;
  --panel-2: #1c1c2c;
  --inset: #0c0c14;
  --input-bg: rgba(255, 255, 255, .05);
  --text-soft: #c9c9d6;
  --border-soft: rgba(255, 255, 255, .05);
  --hover: rgba(255, 255, 255, .02);
  --hover-strong: rgba(255, 255, 255, .08);
  --accent-soft: #ffb3c8;
  --mask: rgba(5, 5, 10, .7);
  --switch-off: rgba(255, 255, 255, .12);
  --badge-gray-bg: rgba(255, 255, 255, .08);
  --shadow-modal: 0 30px 80px rgba(0, 0, 0, .6);
  --shadow-toast: 0 10px 30px rgba(0, 0, 0, .5);
}

/* ---------- 浅色（默认） ---------- */
[data-theme="light"] {
  --bg: #f3f4fa;
  --bg-2: #e9ebf5;
  --surface: #ffffff;
  --border: #e1e4f0;
  --text: #212130;
  --muted: #6d6d80;
  --nav-bg: rgba(255, 255, 255, .75);
  --panel: #ffffff;
  --panel-2: #ffffff;
  --inset: #eef0f7;
  --input-bg: #f6f7fc;
  --text-soft: #4b4b5e;
  --border-soft: #e8eaf3;
  --hover: rgba(25, 25, 50, .04);
  --hover-strong: rgba(25, 25, 50, .07);
  --accent-soft: #d6336c;
  --mask: rgba(35, 35, 60, .45);
  --switch-off: rgba(25, 25, 50, .14);
  --badge-gray-bg: rgba(25, 25, 50, .08);
  --shadow-modal: 0 30px 80px rgba(35, 35, 70, .18);
  --shadow-toast: 0 10px 30px rgba(35, 35, 70, .14);
}

/* ---------- 森林绿 ---------- */
[data-theme="green"] {
  --bg: #bcd2b6;
  --bg-2: #adc6a6;
  --surface: #e2efdd;
  --border: #97b78e;
  --text: #1c2c21;
  --muted: #49604d;
  --nav-bg: rgba(226, 239, 221, .82);
  --panel: #e2efdd;
  --panel-2: #e2efdd;
  --inset: #c9dcc1;
  --input-bg: #eef6e9;
  --text-soft: #344638;
  --border-soft: #acc5a4;
  --hover: rgba(38, 66, 44, .07);
  --hover-strong: rgba(38, 66, 44, .11);
  --accent-soft: #2e7d4f;
  --mask: rgba(28, 45, 32, .48);
  --switch-off: rgba(38, 66, 44, .2);
  --badge-gray-bg: rgba(38, 66, 44, .13);
  --shadow-modal: 0 30px 80px rgba(32, 52, 37, .22);
  --shadow-toast: 0 10px 30px rgba(32, 52, 37, .16);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  background: var(--bg); color: var(--text);
  font-family: "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
  line-height: 1.7; min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  transition: background .25s, color .25s;
}
a { color: inherit; }
::selection { background: rgba(255, 92, 138, .35); }

.aurora {
  position: fixed; inset: 0; z-index: -1;
  background:
    radial-gradient(ellipse 60% 45% at 75% -5%, rgba(255, 92, 138, .14), transparent 60%),
    radial-gradient(ellipse 55% 40% at 10% 20%, rgba(124, 107, 255, .11), transparent 60%),
    radial-gradient(ellipse 70% 50% at 50% 110%, rgba(198, 91, 255, .09), transparent 60%),
    var(--bg);
}
[data-theme="green"] .aurora {
  background:
    radial-gradient(ellipse 60% 45% at 75% -5%, rgba(90, 155, 105, .2), transparent 60%),
    radial-gradient(ellipse 55% 40% at 10% 20%, rgba(75, 140, 100, .16), transparent 60%),
    radial-gradient(ellipse 70% 50% at 50% 110%, rgba(105, 165, 115, .14), transparent 60%),
    var(--bg);
}

/* ---------- 顶部导航 ---------- */
.topnav {
  position: sticky; top: 0; z-index: 100;
  backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
  background: var(--nav-bg);
  border-bottom: 1px solid var(--border);
}
.topnav-inner {
  max-width: 1180px; margin: 0 auto; padding: 0 24px;
  height: 62px; display: flex; align-items: center; gap: 26px;
}
.logo { display: flex; align-items: center; gap: 9px; font-weight: 900; font-size: 18px; text-decoration: none; }
.logo-mark {
  width: 30px; height: 30px; border-radius: 9px; background: var(--grad);
  display: grid; place-items: center; box-shadow: 0 4px 14px rgba(255, 92, 138, .35);
}
.logo-mark svg { width: 16px; height: 16px; }
.nav-links { display: flex; gap: 4px; flex: 1; }
.nav-links a {
  padding: 7px 14px; border-radius: 9px; font-size: 14.5px;
  color: var(--muted); text-decoration: none; transition: all .2s;
}
.nav-links a:hover { color: var(--text); background: var(--surface); }
.nav-links a.active { color: var(--text); background: rgba(255, 92, 138, .13); }
.nav-user { display: flex; align-items: center; gap: 12px; font-size: 14px; color: var(--muted); }
.nav-user .uname { color: var(--text); font-weight: 500; }
.nav-user-block { display: flex; flex-direction: column; align-items: flex-end; gap: 0; }
.nav-points { font-size: 12px; color: var(--muted); line-height: 1.4; }
.nav-points b { color: var(--accent-soft); font-size: 13px; }
.checkin-link { color: var(--accent-soft); text-decoration: none; font-size: 12px; }
.checkin-link:hover { text-decoration: underline; }
.checkin-link.done { color: var(--muted); pointer-events: none; }
.link-btn { color: var(--muted); text-decoration: none; font-size: 14px; }
.link-btn:hover { color: var(--rose); }

/* ---------- 主题切换 ---------- */
.theme-switch {
  display: flex; gap: 3px; padding: 3px;
  border-radius: 999px; background: var(--surface); border: 1px solid var(--border);
}
.theme-switch button {
  border: none; background: transparent; color: var(--muted);
  font-size: 12.5px; font-family: inherit; padding: 4px 11px;
  border-radius: 999px; cursor: pointer; transition: all .2s;
}
.theme-switch button:hover { color: var(--text); }
.theme-switch button.active { background: var(--grad); color: #fff; font-weight: 700; }

/* ---------- 布局 ---------- */
.page { max-width: 1180px; margin: 0 auto; padding: 36px 24px 80px; }
.page-head { margin-bottom: 26px; display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.page-title { font-size: 26px; font-weight: 900; letter-spacing: -.5px; }
.page-desc { color: var(--muted); font-size: 14px; margin-top: 4px; }

/* ---------- 卡片 ---------- */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 24px;
  margin-bottom: 20px;
}
.card-title { font-size: 16px; font-weight: 700; margin-bottom: 16px; display: flex; align-items: center; gap: 8px; }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 10px 20px; border-radius: 999px; border: none;
  font-size: 14px; font-weight: 700; font-family: inherit;
  cursor: pointer; text-decoration: none; transition: all .2s;
}
.btn-primary { background: var(--grad); color: #fff; box-shadow: 0 5px 18px rgba(198, 91, 255, .3); }
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 8px 26px rgba(255, 92, 138, .4); }
.btn-ghost { background: var(--surface); color: var(--text); border: 1px solid var(--border); }
.btn-ghost:hover { background: var(--hover-strong); }
.btn-danger { background: rgba(248, 113, 113, .14); color: var(--red); border: 1px solid rgba(248, 113, 113, .3); }
.btn-danger:hover { background: rgba(248, 113, 113, .24); }
.btn-sm { padding: 6px 14px; font-size: 13px; }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none !important; }

/* ---------- 统计卡 ---------- */
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 24px; }
.stat-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 22px;
}
.stat-card .num {
  font-size: 30px; font-weight: 900;
  background: var(--grad); -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
}
.stat-card .label { font-size: 13px; color: var(--muted); margin-top: 2px; }

/* ---------- 表格 ---------- */
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th {
  text-align: left; padding: 10px 12px; color: var(--muted);
  font-weight: 500; font-size: 13px; border-bottom: 1px solid var(--border);
}
.table td { padding: 12px; border-bottom: 1px solid var(--border-soft); vertical-align: middle; }
.table tr:hover td { background: var(--hover); }
.table .empty { text-align: center; color: var(--muted); padding: 40px 0; }

/* ---------- 徽章 ---------- */
.badge { display: inline-block; padding: 3px 11px; border-radius: 999px; font-size: 12px; font-weight: 500; }
.badge.green { background: rgba(74, 222, 128, .13); color: var(--green); }
.badge.red { background: rgba(248, 113, 113, .13); color: var(--red); }
.badge.orange { background: rgba(251, 191, 36, .13); color: var(--orange); }
.badge.gray { background: var(--badge-gray-bg); color: var(--muted); }
.badge.rose { background: rgba(255, 92, 138, .13); color: var(--accent-soft); }

/* ---------- 表单 ---------- */
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.input, .select, .textarea {
  width: 100%; padding: 11px 14px; border-radius: 11px;
  background: var(--input-bg); border: 1px solid var(--border);
  color: var(--text); font-size: 14.5px; font-family: inherit;
  outline: none; transition: border-color .2s;
}
.input:focus, .select:focus, .textarea:focus { border-color: rgba(255, 92, 138, .5); }
.select option, .input option { background: var(--panel); }
.textarea { resize: vertical; min-height: 76px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.hint { font-size: 12.5px; color: var(--muted); margin-top: 6px; }

/* ---------- 发送设置 ---------- */
.settings-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.switch-row { display: flex; align-items: center; gap: 10px; height: 44px; }
.switch { position: relative; display: inline-block; width: 46px; height: 26px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .slider {
  position: absolute; inset: 0; cursor: pointer; border-radius: 999px;
  background: var(--switch-off); border: 1px solid var(--border);
  transition: background .25s;
}
.switch .slider::before {
  content: ""; position: absolute; width: 18px; height: 18px; border-radius: 50%;
  left: 3px; top: 3px; background: #9d9dab; transition: transform .25s, background .25s;
}
.switch input:checked + .slider { background: var(--grad); border-color: transparent; }
.switch input:checked + .slider::before { transform: translateX(20px); background: #fff; }
@media (max-width: 900px) { .settings-grid { grid-template-columns: 1fr; } }

/* ---------- 弹窗 ---------- */
.modal-mask {
  position: fixed; inset: 0; z-index: 200;
  background: var(--mask); backdrop-filter: blur(6px);
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.modal {
  width: 520px; max-width: 100%; max-height: 88vh; overflow-y: auto;
  background: var(--panel); border: 1px solid var(--border);
  border-radius: 20px; padding: 28px;
  box-shadow: var(--shadow-modal);
}
.modal-title { font-size: 18px; font-weight: 900; margin-bottom: 18px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; margin-top: 22px; }
.hidden { display: none !important; }

/* ---------- 二维码 ---------- */
.qr-box { text-align: center; padding: 10px 0 4px; }
.qr-box img {
  width: 240px; height: 240px; object-fit: contain;
  border-radius: 14px; background: #fff; padding: 8px;
}
.qr-status { margin-top: 14px; font-size: 14px; color: var(--muted); }
.qr-status.ok { color: var(--green); }
.qr-status.bad { color: var(--red); }

/* ---------- 认证页 ---------- */
.auth-wrap { max-width: 400px; margin: 8vh auto 0; }
.auth-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 22px; padding: 38px 34px;
}
.auth-title { font-size: 24px; font-weight: 900; text-align: center; margin-bottom: 6px; }
.auth-sub { text-align: center; color: var(--muted); font-size: 14px; margin-bottom: 26px; }
.auth-alt { text-align: center; margin-top: 18px; font-size: 14px; color: var(--muted); }
.auth-alt a { color: var(--accent-soft); text-decoration: none; }

/* ---------- 日志 ---------- */
.log-view {
  background: var(--inset); border: 1px solid var(--border); border-radius: 12px;
  padding: 14px 16px; font-family: Consolas, monospace; font-size: 12.5px;
  line-height: 1.65; max-height: 380px; overflow-y: auto;
  white-space: pre-wrap; word-break: break-all; color: var(--text-soft);
}

/* ---------- Toast ---------- */
#toast {
  position: fixed; top: 76px; left: 50%; transform: translateX(-50%);
  z-index: 300; padding: 11px 22px; border-radius: 12px;
  background: var(--panel-2); border: 1px solid var(--border);
  font-size: 14px; box-shadow: var(--shadow-toast);
  opacity: 0; pointer-events: none; transition: opacity .25s, top .25s;
}
#toast.show { opacity: 1; }
#toast.error { border-color: rgba(248, 113, 113, .5); color: var(--red); }

/* ---------- 套餐 ---------- */
.plan-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.plan-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 22px; padding: 34px 28px; position: relative;
  transition: transform .3s, border-color .3s;
}
.plan-card:hover { transform: translateY(-6px); }
.plan-card.hot { border-color: rgba(255, 92, 138, .45); background: linear-gradient(170deg, rgba(255, 92, 138, .08), rgba(124, 107, 255, .05)); }
.plan-tag {
  position: absolute; top: -13px; left: 50%; transform: translateX(-50%);
  padding: 4px 16px; border-radius: 999px; background: var(--grad);
  font-size: 12px; font-weight: 700;
}
.plan-name { font-size: 18px; font-weight: 700; margin-bottom: 8px; }
.plan-price { font-size: 38px; font-weight: 900; margin-bottom: 4px; }
.plan-price small { font-size: 14px; color: var(--muted); font-weight: 400; }
.plan-feats { list-style: none; margin: 20px 0 26px; }
.plan-feats li { padding: 7px 0; font-size: 14px; color: var(--text-soft); }
.plan-feats li::before { content: "✓"; color: var(--rose); margin-right: 9px; font-weight: 700; }

@media (max-width: 860px) {
  .stat-grid, .plan-grid { grid-template-columns: 1fr 1fr; }
  .form-row { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .stat-grid, .plan-grid { grid-template-columns: 1fr; }
}

/* ==================== 手机版适配（≤640px） ==================== */
@media (max-width: 640px) {
  /* 顶部导航：两行布局，链接放第二行可横滑，不再隐藏 */
  .topnav-inner {
    height: auto; padding: 10px 14px; gap: 10px;
    flex-wrap: wrap;
  }
  .logo { font-size: 16px; }
  .logo-mark { width: 26px; height: 26px; }
  .nav-user-block { margin-left: auto; }
  .nav-user { gap: 8px; font-size: 13px; }
  .nav-user .uname { max-width: 80px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .theme-switch button { padding: 4px 8px; font-size: 12px; }
  .nav-links {
    display: flex; order: 3; flex-basis: 100%;
    overflow-x: auto; gap: 4px; padding-top: 2px;
    -webkit-overflow-scrolling: touch;
  }
  .nav-links a { flex-shrink: 0; padding: 8px 12px; font-size: 14px; }

  /* 页面骨架 */
  .page { padding: 20px 12px 64px; }
  .page-head { flex-direction: column; align-items: stretch; gap: 12px; }
  .page-head .btn, .page-head div[style*="flex"] { width: 100%; }
  .page-head .btn { justify-content: center; }
  .page-title { font-size: 22px; }
  .btn { min-height: 42px; justify-content: center; }
  .btn-sm { min-height: 0; }

  /* 卡片与统计卡 */
  .card { padding: 16px 14px; border-radius: 14px; }
  .card-title { font-size: 15px; }
  .stat-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .stat-card { padding: 14px; }
  .stat-card .num { font-size: 24px; }

  /* 表格：横向滑动，不挤压 */
  .table {
    display: block; overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    font-size: 13px; white-space: nowrap;
  }
  .table th, .table td { padding: 8px 10px; }
  .table .empty { white-space: normal; }

  /* 表单 / 设置 */
  .settings-grid { gap: 14px; }
  .input, .select, .textarea { font-size: 16px; }  /* 防 iOS 聚焦自动放大 */
  .modal-mask { padding: 12px; }
  .modal { width: 100%; padding: 20px 16px; border-radius: 16px; }
  .modal-foot .btn { flex: 1; }

  /* 二维码 */
  .qr-box img { width: 200px; height: 200px; }

  /* 认证页 */
  .auth-wrap { margin-top: 3vh; padding: 0 12px; }
  .auth-card { padding: 26px 20px; }

  /* 日志 / toast */
  .log-view { font-size: 11px; max-height: 280px; }
  #toast { left: 12px; right: 12px; transform: none; text-align: center; }
}

/* 表格横滑提示（仅手机端显示） */
.m-scroll-hint { display: none; }
@media (max-width: 640px) {
  .m-scroll-hint {
    display: block; font-size: 12px; color: var(--muted);
    text-align: right; margin-top: 6px;
  }
}

/* ---------- 页脚 ---------- */
.site-footer {
  text-align: center; padding: 8px 16px 40px;
  color: var(--muted); font-size: 13px;
}
