/* ============================================================
   VitaKey Lite - C-end WeChat Mini Program Prototype
   Shared stylesheet (design tokens per docs/原型设计规范.md)
   ============================================================ */

:root {
  --primary: #12B48C;
  --primary-600: #0E9E79;
  --primary-050: #E9F8F2;
  --primary-grad: linear-gradient(135deg, #16C89A, #0E9E79);

  --accent-blue: #3E80F0;
  --warn: #F59E0B;
  --warn-050: #FEF3E2;
  --danger: #EF4444;
  --danger-050: #FDEDED;
  --success: #16A34A;
  --success-050: #E9F8EE;

  --bg: #F4F7F9;
  --card: #FFFFFF;
  --text: #1F2A37;
  --text-2: #6B7A8D;
  --text-3: #98A5B3;
  --line: #EDF1F4;

  --radius-card: 16px;
  --radius-btn: 12px;
  --radius-pill: 999px;
  --shadow: 0 6px 20px rgba(18, 52, 74, .06);
  --font: -apple-system, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  padding: 0;
  font-family: var(--font);
  color: var(--text);
  background: #E7EBEE;
  -webkit-font-smoothing: antialiased;
}

body.page-body {
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 28px 12px 48px;
}

a { text-decoration: none; color: inherit; }
button { font-family: var(--font); }

/* ---------------- Phone frame ---------------- */
.phone-frame {
  width: 390px;
  max-width: 100%;
  height: 844px;
  background: #0b0e10;
  border-radius: 44px;
  padding: 10px;
  box-shadow: 0 30px 60px rgba(15, 30, 40, .25), 0 2px 6px rgba(15,30,40,.15);
  position: relative;
  flex: 0 0 auto;
}
.phone-frame::before {
  /* notch */
  content: "";
  position: absolute;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  width: 120px;
  height: 22px;
  background: #0b0e10;
  border-radius: 0 0 16px 16px;
  z-index: 30;
}
.screen {
  width: 100%;
  height: 100%;
  background: var(--bg);
  border-radius: 34px;
  overflow: hidden;
  position: relative;
  display: flex;
  flex-direction: column;
}

/* ---------------- Status bar ---------------- */
.status-bar {
  flex: 0 0 auto;
  height: 46px;
  padding: 0 26px 0 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 15px;
  font-weight: 600;
  position: relative;
  z-index: 20;
}
.status-bar.on-dark { color: #fff; }
.status-bar.on-light { color: var(--text); }
.status-icons { display: flex; align-items: center; gap: 5px; }
.status-icons svg { display: block; }

/* WeChat mini-program capsule */
.capsule {
  position: absolute;
  top: 44px;
  right: 14px;
  height: 30px;
  border-radius: var(--radius-pill);
  background: rgba(255,255,255,.34);
  border: 1px solid rgba(255,255,255,.5);
  display: flex;
  align-items: center;
  padding: 0 2px;
  z-index: 25;
  backdrop-filter: blur(2px);
}
.capsule.on-light { background: rgba(31,42,55,.06); border-color: rgba(31,42,55,.08); }
.capsule span {
  width: 44px;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  color: #fff;
}
.capsule.on-light span { color: var(--text); }
.capsule span:first-child { border-right: 1px solid rgba(255,255,255,.5); }
.capsule.on-light span:first-child { border-right: 1px solid rgba(31,42,55,.12); }

/* ---------------- Simple nav header (light) ---------------- */
.nav-header {
  flex: 0 0 auto;
  background: var(--card);
  border-bottom: 1px solid var(--line);
  position: relative;
}
.nav-row {
  height: 46px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  padding: 0 70px;
}
.nav-back {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text);
}
.nav-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ---------------- Hero header (teal gradient) ---------------- */
.hero-header {
  flex: 0 0 auto;
  background: var(--primary-grad);
  position: relative;
  color: #fff;
  padding-bottom: 18px;
}
.hero-header .nav-back,
.hero-header .nav-title { color: #fff; }
.hero-header .nav-header-inline {
  height: 46px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

/* ---------------- Content area ---------------- */
.content {
  flex: 1 1 auto;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 16px 16px 110px;
}
.content.no-tabbar { padding-bottom: 24px; }
.content::-webkit-scrollbar { display: none; }

/* ---------------- Cards ---------------- */
.card {
  background: var(--card);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow);
  padding: 18px;
  margin-bottom: 14px;
}
.card-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  margin: 0 0 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.card-title .more {
  font-size: 12px;
  font-weight: 400;
  color: var(--text-3);
}
.section-gap { height: 14px; }

/* ---------------- Buttons ---------------- */
.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 48px;
  border-radius: var(--radius-btn);
  font-size: 16px;
  font-weight: 700;
  border: none;
  cursor: pointer;
  width: 100%;
  gap: 6px;
}
.btn-primary { background: var(--primary-grad); color: #fff; box-shadow: 0 8px 18px rgba(18,180,140,.28); }
.btn-secondary { background: var(--primary-050); color: var(--primary-600); }
.btn-outline { background: #fff; color: var(--primary-600); border: 1.5px solid var(--primary); }
.btn-warn { background: linear-gradient(135deg,#FBBF54,#F59E0B); color: #fff; }
.btn-sm { height: 36px; font-size: 13px; border-radius: var(--radius-btn); padding: 0 14px; width: auto; flex-shrink: 0; white-space: nowrap; }
.btn-row { display: flex; gap: 10px; }
.btn-row .btn { flex: 1; }
.btn[disabled] { opacity: .4; pointer-events: none; }

/* fixed bottom action bar (for pages w/o tab bar) */
.bottom-bar {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  background: #fff;
  border-top: 1px solid var(--line);
  padding: 10px 16px calc(10px + env(safe-area-inset-bottom, 10px));
  z-index: 15;
}
.bottom-bar.with-tabbar { bottom: 64px; box-shadow: 0 -6px 16px rgba(18,52,74,.05); }

/* ---------------- Tags / pills ---------------- */
.pill {
  display: inline-flex;
  align-items: center;
  height: 24px;
  padding: 0 10px;
  border-radius: var(--radius-pill);
  font-size: 12px;
  font-weight: 700;
  gap: 4px;
}
.pill-primary { background: var(--primary-050); color: var(--primary-600); }
.pill-warn { background: var(--warn-050); color: #B45309; }
.pill-danger { background: var(--danger-050); color: var(--danger); }
.pill-success { background: var(--success-050); color: var(--success); }
.pill-grey { background: var(--line); color: var(--text-2); }

.demo-tag {
  font-size: 11px;
  color: var(--text-3);
  text-align: right;
}

/* ---------------- Alert / notice bar ---------------- */
.notice-bar {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  border-radius: 12px;
  padding: 12px 14px;
  font-size: 13px;
  line-height: 1.6;
}
.notice-warn { background: linear-gradient(135deg,#FFF7EC,#FFEFD9); border: 1px solid #FCD9A0; color: #92400E; }
.notice-warn b { color: #B45309; }
.notice-primary { background: var(--primary-050); color: var(--primary-600); border: 1px solid #BFEBDD; }

/* ---------------- Tab bar ---------------- */
.tab-bar {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 64px;
  background: #fff;
  border-top: 1px solid var(--line);
  display: flex;
  z-index: 20;
  padding-bottom: env(safe-area-inset-bottom, 0);
}
.tab-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  font-size: 10.5px;
  color: var(--text-3);
}
.tab-item svg { width: 22px; height: 22px; }
.tab-item.active { color: var(--primary); }
.tab-item.center { position: relative; }
.tab-item.center .tab-center-icon {
  position: absolute;
  top: -22px;
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: var(--primary-grad);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 16px rgba(18,180,140,.4);
  border: 4px solid #fff;
}
.tab-item.center .tab-center-icon svg { width: 24px; height: 24px; stroke: #fff; }
.tab-item.center span { margin-top: 28px; }

/* ---------------- Forms ---------------- */
.field { margin-bottom: 14px; }
.field label {
  display: block;
  font-size: 13px;
  color: var(--text-2);
  margin-bottom: 6px;
  font-weight: 600;
}
.field input, .field select, .field textarea {
  width: 100%;
  border: 1px solid var(--line);
  background: #FAFBFC;
  border-radius: var(--radius-btn);
  padding: 11px 12px;
  font-size: 14.5px;
  color: var(--text);
  font-family: var(--font);
}
.field textarea { resize: none; min-height: 70px; }
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none;
  border-color: var(--primary);
  background: #fff;
}
.row-between { display: flex; align-items: center; justify-content: space-between; }
.link-chevron { color: var(--text-3); }

/* ---------------- Assessment options ---------------- */
.progress-track {
  height: 6px;
  background: rgba(255,255,255,.35);
  border-radius: var(--radius-pill);
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: #fff;
  border-radius: var(--radius-pill);
  transition: width .25s ease;
}
.option-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.option-grid .option-card:last-child:nth-child(odd) { grid-column: 1 / -1; }
.option-card {
  background: #fff;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-card);
  height: 76px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  box-shadow: var(--shadow);
  cursor: pointer;
  position: relative;
  text-align: center;
  padding: 6px 10px;
}
.option-card.selected {
  border-color: var(--primary);
  background: var(--primary-050);
  color: var(--primary-600);
}
.option-card .check-badge {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--primary);
  display: none;
  align-items: center;
  justify-content: center;
}
.option-card.selected .check-badge { display: flex; }

/* ---------------- Home hero ---------------- */
.brand-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 20px 14px;
}
.brand-name { font-size: 20px; font-weight: 800; letter-spacing: .5px; }
.brand-sub { font-size: 12px; opacity: .88; margin-top: 2px; }
.hero-cta-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 6px 0 20px;
}
.cta-ring {
  width: 168px;
  height: 168px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 25%, rgba(255,255,255,.28), rgba(255,255,255,0) 60%), var(--primary-grad);
  border: 5px solid rgba(255,255,255,.55);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  color: #fff;
  box-shadow: 0 14px 30px rgba(6,60,45,.28);
  text-align: center;
}
.cta-ring .cta-big { font-size: 21px; font-weight: 800; line-height: 1.4; }
.cta-ring .cta-small { font-size: 11px; opacity: .85; margin-top: 4px; }
.hero-caption { font-size: 12.5px; opacity: .92; margin-top: 14px; text-align: center; }

/* ---------------- SKU / plan cards ---------------- */
.sku-card {
  background: #fff;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow);
  padding: 16px;
  margin-bottom: 12px;
  position: relative;
  cursor: pointer;
}
.sku-card.selected { border-color: var(--primary); background: var(--primary-050); }
.sku-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.sku-name { font-size: 15.5px; font-weight: 700; }
.sku-radio {
  width: 20px; height: 20px; border-radius: 50%;
  border: 2px solid var(--line); flex: 0 0 auto;
  display: flex; align-items: center; justify-content: center;
  background: #fff;
}
.sku-card.selected .sku-radio { border-color: var(--primary); background: var(--primary); }
.sku-card.selected .sku-radio::after {
  content: ""; width: 8px; height: 8px; border-radius: 50%; background: #fff;
}
.sku-desc { font-size: 12.5px; color: var(--text-2); line-height: 1.6; margin-bottom: 10px; }
.sku-bottom { display: flex; align-items: baseline; justify-content: space-between; }
.sku-price { color: var(--danger); font-weight: 800; font-size: 19px; }
.sku-price small { font-size: 12px; font-weight: 600; }
.sku-period { font-size: 12px; color: var(--text-3); }

/* ---------------- Order rows ---------------- */
.order-row { display: flex; gap: 12px; padding: 10px 0; }
.order-thumb {
  width: 64px; height: 64px; border-radius: 10px; flex: 0 0 auto;
  background: linear-gradient(135deg,#0E9E79,#16C89A);
  display: flex; align-items: center; justify-content: center;
  font-size: 24px;
}
.order-info { flex: 1; min-width: 0; }
.order-info .name { font-size: 14.5px; font-weight: 700; margin-bottom: 4px; }
.order-info .desc { font-size: 12px; color: var(--text-2); line-height: 1.5; }
.order-price { font-size: 15px; font-weight: 800; color: var(--text); white-space: nowrap; }

.price-row { display: flex; justify-content: space-between; font-size: 13.5px; color: var(--text-2); padding: 7px 0; }
.price-row.total { color: var(--text); font-weight: 700; font-size: 15px; border-top: 1px dashed var(--line); margin-top: 4px; padding-top: 12px; }
.price-row.total b { color: var(--danger); font-size: 19px; }

.pay-method-row { display: flex; align-items: center; gap: 10px; padding: 4px 0; }
.pay-method-row .name { flex: 1; font-size: 14.5px; font-weight: 600; }

/* ---------------- Icon grid (home quick entries) ---------------- */
.icon-grid { display: grid; grid-template-columns: repeat(4,1fr); gap: 10px; }
.icon-grid-item { display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: 12px; color: var(--text-2); }
.icon-grid-item .ic {
  width: 44px; height: 44px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 20px;
  background: var(--primary-050);
}

/* ---------------- Profile header ---------------- */
.profile-head { display: flex; align-items: center; gap: 14px; padding: 6px 4px 18px; }
.avatar {
  width: 58px; height: 58px; border-radius: 50%;
  background: rgba(255,255,255,.25); border: 2px solid rgba(255,255,255,.7);
  display: flex; align-items: center; justify-content: center; font-size: 26px; color: #fff;
}
.profile-name { font-size: 18px; font-weight: 800; }
.profile-phone { font-size: 13px; opacity: .85; margin-top: 3px; }

.order-status-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 4px; text-align: center; margin-top: 4px; }
.order-status-item { display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: 12.5px; color: var(--text-2); position: relative; }
.order-status-item .ic { font-size: 22px; }
.badge-dot {
  position: absolute; top: -4px; right: 30%;
  min-width: 16px; height: 16px; border-radius: 999px; background: var(--danger); color: #fff;
  font-size: 10px; display: flex; align-items: center; justify-content: center; padding: 0 3px; font-weight: 700;
}

/* recommend-pay style */
.doctor-card { display: flex; gap: 12px; align-items: center; }
.doctor-avatar {
  width: 52px; height: 52px; border-radius: 50%; background: var(--primary-050); color: var(--primary-600);
  display: flex; align-items: center; justify-content: center; font-size: 24px; flex: 0 0 auto;
}
.doctor-name { font-weight: 800; font-size: 15.5px; }
.doctor-meta { font-size: 12px; color: var(--text-2); margin-top: 2px; }

/* schedule echo card */
.echo-card { text-align: center; padding: 26px 16px; }
.echo-icon {
  width: 62px; height: 62px; border-radius: 50%; background: var(--primary-050); color: var(--primary-600);
  display: flex; align-items: center; justify-content: center; font-size: 30px; margin: 0 auto 14px;
}
.echo-title { font-size: 16px; font-weight: 800; margin-bottom: 6px; }
.echo-detail { font-size: 14.5px; color: var(--text); background: var(--bg); border-radius: 12px; padding: 12px; margin: 12px 0; line-height: 1.7; }
.echo-detail b { color: var(--primary-600); }

/* punch grid (adjust.html) */
.punch-grid { display: grid; grid-template-columns: repeat(7,1fr); gap: 8px; }
.punch-cell {
  aspect-ratio: 1/1; border-radius: 10px; display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; color: var(--text-3); background: var(--bg); border: 1px solid var(--line);
}
.punch-cell.done { background: var(--primary-050); color: var(--primary-600); border-color: #BFEBDD; }
.punch-cell.today { border: 1.5px solid var(--primary); color: var(--primary-600); background: #fff; }

.audio-item { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.audio-item:last-child { border-bottom: none; }
.audio-ic { width: 42px; height: 42px; border-radius: 10px; background: var(--bg); display: flex; align-items: center; justify-content: center; font-size: 20px; color: var(--text-3); }
.audio-name { font-size: 14px; font-weight: 600; color: var(--text-2); }
.audio-lock { font-size: 11px; color: var(--text-3); margin-top: 2px; }

/* index directory page */
.index-wrap { max-width: 980px; margin: 0 auto; padding: 32px 20px 60px; }
.index-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px,1fr)); gap: 16px; }
.index-item {
  background: #fff; border-radius: var(--radius-card); box-shadow: var(--shadow); padding: 18px;
  border: 1px solid var(--line);
}
.index-item .num { font-size: 12px; color: var(--primary); font-weight: 800; }
.index-item .t { font-size: 16px; font-weight: 800; margin: 6px 0 6px; }
.index-item .d { font-size: 12.5px; color: var(--text-2); line-height: 1.6; }

/* radar / curve svg text */
.radar-grid { fill: none; stroke: #E3ECEB; stroke-width: 1; }
.radar-axis { stroke: #E9F0EF; stroke-width: 1; }
.radar-data { fill: rgba(18,180,140,.22); stroke: var(--primary); stroke-width: 2; stroke-linejoin: round; }
.radar-dot { fill: var(--primary); }
.radar-label { font-size: 11.5px; fill: var(--text-2); font-weight: 600; }
.radar-score { font-size: 15px; font-weight: 800; fill: var(--primary-600); }

.toast-overlay {
  position: absolute; inset: 0; background: rgba(15,25,30,.42);
  display: none; align-items: center; justify-content: center; z-index: 60;
}
.toast-overlay.show { display: flex; }
.toast-box {
  background: #fff; border-radius: 16px; padding: 26px 30px; text-align: center; min-width: 200px;
  box-shadow: 0 20px 40px rgba(0,0,0,.25);
}
.toast-box .ic { font-size: 34px; margin-bottom: 10px; }
.toast-box .t { font-size: 15px; font-weight: 700; }
.toast-box .s { font-size: 12px; color: var(--text-2); margin-top: 6px; }
