/* ══════════════════════════════════════════════════════════════════════
   Account Center (会员中心 / 算力与积分) — V3.0 原型 page 38/39 组件
   Classes ported verbatim from 原型 assets/app.css, mapped onto tokens.css.
   Loaded after styles.css — restates legacy .hero/.hero-actions/.section-title
   so the prototype hero/plan-card/kpi components render correctly in V4.
   ══════════════════════════════════════════════════════════════════════ */

:root {
  --primary-strong: var(--brand-strong);
  --shadow-sm: var(--shadow-soft);
  --shadow-md: var(--shadow);
}

/* ── Hero ── */
.hero {
  padding: 26px;
  background: linear-gradient(135deg, var(--surface) 0%, color-mix(in srgb, var(--primary-soft) 60%, var(--surface)) 48%, color-mix(in srgb, var(--tech-soft) 55%, var(--surface)) 100%);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(280px, 0.6fr);
  gap: 24px;
  align-items: center;
  overflow: hidden;
  position: relative;
  min-height: 0;
  border-bottom: 1px solid var(--line);
}
.hero::after {
  content: "";
  position: absolute;
  width: 240px;
  height: 240px;
  border-radius: 50%;
  right: -70px;
  bottom: -120px;
  background: color-mix(in srgb, var(--primary) 9%, transparent);
}
.hero-copy { position: relative; z-index: 1; }
.hero-label { color: var(--primary-strong); font-weight: 800; font-size: 13px; }
.hero h2 { font-size: 30px; line-height: 1.25; margin: 8px 0; color: var(--text); letter-spacing: 0; }
.hero p { color: var(--muted); max-width: 700px; margin: 0; font-size: 15px; }
.hero-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 18px;
}
.hero-visual {
  min-height: 180px;
  background: rgba(255, 255, 255, 0.62);
  border: 1px solid rgba(255, 255, 255, 0.8);
  border-radius: 20px;
  box-shadow: var(--shadow-md);
  display: grid;
  place-items: center;
  position: relative;
  z-index: 1;
  padding: 18px;
}
html[data-theme="dark"] .hero-visual {
  background: rgba(20, 30, 27, 0.7);
  border-color: var(--line);
}
.mini-dashboard { width: 100%; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.mini-tile {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
}
.mini-tile strong { display: block; font-size: 20px; color: var(--text); }
.mini-tile span { color: var(--muted); font-size: 11px; }

/* ── Sections ── */
.section { margin-top: 20px; }
.section-header { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin: 0 0 12px; }
.section-title {
  display: block;
  font-size: 17px;
  font-weight: 850;
  margin: 0;
  color: var(--text);
}
.section-subtitle { color: var(--muted); font-size: 13px; margin: 4px 0 0; }

/* ── Grid / Card ── */
.grid { display: grid; gap: 18px; min-width: 0; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  min-width: 0;
}
.card-pad { padding: 16px; }
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 12px; }
.card-title { font-size: 15px; font-weight: 800; margin: 0; color: var(--text); }
.card-note { color: var(--muted); font-size: 12px; margin: 4px 0 0; }
.card-actions { display: flex; gap: 8px; }

/* ── Plan cards ── */
.plan-card {
  padding: 22px;
  display: flex;
  flex-direction: column;
  position: relative;
}
.plan-card.recommended {
  border-color: color-mix(in srgb, var(--primary) 55%, var(--line));
  box-shadow: 0 18px 45px color-mix(in srgb, var(--primary) 12%, transparent);
}
.plan-ribbon { position: absolute; right: 14px; top: 14px; }
.plan-name { font-size: 18px; font-weight: 850; color: var(--text); }
.plan-price { font-size: 32px; font-weight: 900; margin: 12px 0; color: var(--text); }
.plan-price small { font-size: 13px; color: var(--muted); font-weight: 600; }
.feature-list {
  list-style: none;
  padding: 0;
  margin: 14px 0;
  display: flex;
  flex-direction: column;
  gap: 9px;
}
.feature-list li { display: flex; gap: 8px; font-size: 13px; color: var(--text); }
.feature-list li::before { content: "✓"; color: var(--success); font-weight: 900; }

/* ── Chips ── */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font-size: 12px;
  cursor: pointer;
  transition: 0.18s;
}
.chip.active {
  border-color: color-mix(in srgb, var(--primary) 40%, var(--line));
  background: var(--primary-soft);
  color: var(--primary-strong);
}
.chip-row { display: flex; gap: 8px; flex-wrap: wrap; }

/* ── Buttons (prototype btn family) ── */
.btn {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  height: 38px;
  padding: 0 13px;
  border-radius: 9px;
  font-weight: 700;
  font-size: 13px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  transition: 0.18s;
  white-space: nowrap;
}
.btn:hover { transform: translateY(-1px); box-shadow: var(--shadow-sm); border-color: var(--line-strong); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-strong); border-color: var(--primary-strong); }
.btn-tech { background: var(--tech); border-color: var(--tech); color: #fff; }
.btn-tech:hover { background: color-mix(in srgb, var(--tech) 85%, var(--text)); border-color: color-mix(in srgb, var(--tech) 85%, var(--text)); }
.btn-sm { height: 32px; padding: 0 11px; border-radius: 10px; font-size: 13px; }
.btn-lg { height: 44px; padding: 0 20px; }

/* ── KPI ── */
.kpi { padding: 14px; position: relative; overflow: hidden; }
.kpi::after {
  content: "";
  position: absolute;
  width: 72px;
  height: 72px;
  border-radius: 50%;
  right: -20px;
  top: -22px;
  background: var(--primary-soft);
}
.kpi.tech::after { background: var(--tech-soft); }
.kpi.blue::after { background: color-mix(in srgb, var(--blue) 10%, var(--surface)); }
.kpi.warn::after { background: var(--warning-soft); }
.kpi-label { font-size: 12px; color: var(--muted); display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.kpi-value { font-size: 24px; font-weight: 850; letter-spacing: -0.03em; margin: 8px 0 2px; color: var(--text); }
.kpi-foot { font-size: 12px; color: var(--muted); }
.trend-up { color: var(--success); }
.trend-down { color: var(--danger); }

/* ── Badges ── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 7px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 750;
  background: var(--surface-3);
  color: var(--muted);
  white-space: nowrap;
}
.badge-success { background: var(--success-soft); color: var(--success); }
.badge-warning { background: var(--warning-soft); color: var(--warning); }
.badge-danger { background: var(--danger-soft); color: var(--danger); }
.badge-primary { background: var(--primary-soft); color: var(--primary-strong); }
.badge-tech { background: var(--tech-soft); color: var(--tech); }

/* ── Charts ── */
.chart {
  height: 210px;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px;
  background: linear-gradient(180deg, var(--surface), var(--surface-2));
  position: relative;
  overflow: hidden;
}
.bars { height: 100%; display: flex; align-items: flex-end; gap: 10px; }
.bar {
  flex: 1;
  border-radius: 8px 8px 3px 3px;
  background: linear-gradient(180deg, var(--primary), color-mix(in srgb, var(--primary) 45%, transparent));
  min-width: 12px;
  position: relative;
}
.bar.tech { background: linear-gradient(180deg, var(--tech), color-mix(in srgb, var(--tech) 45%, transparent)); }
.bar-label {
  position: absolute;
  bottom: -24px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 10px;
  color: var(--muted);
  white-space: nowrap;
}
.donut {
  width: 140px;
  height: 140px;
  border-radius: 50%;
  position: relative;
}
.donut::after { content: ""; position: absolute; inset: 26px; background: var(--surface); border-radius: 50%; }
.donut-center {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  z-index: 1;
  text-align: center;
  font-weight: 850;
  color: var(--text);
}
.donut-center small { display: block; color: var(--muted); font-weight: 600; }
.donut-layout {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 32px;
  min-height: 210px;
}
.pack-badge { margin-top: 14px; }
.stat-row { display: flex; align-items: center; gap: 12px; }
.stat-row + .stat-row { margin-top: 12px; }
.stat-name { width: 92px; font-size: 12px; color: var(--muted); }
.stat-bar { flex: 1; height: 8px; background: var(--surface-3); border-radius: 999px; overflow: hidden; }
.stat-bar span { display: block; height: 100%; background: var(--primary); border-radius: inherit; }
.stat-value { width: 44px; text-align: right; font-size: 12px; font-weight: 750; color: var(--text); }

/* ── Progress ── */
.progress-wrap { margin-top: 8px; }
.progress { height: 8px; background: var(--surface-3); border-radius: 999px; overflow: hidden; }
.progress > span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--primary), color-mix(in srgb, var(--primary) 65%, transparent));
  border-radius: inherit;
}

/* ── List rows (权益/账单) ── */
.list { display: flex; flex-direction: column; }
.list-foot { margin-top: 16px; }
.list-row { display: flex; align-items: center; gap: 14px; padding: 13px 0; border-top: 1px solid var(--line); }
.list-row:first-child { border-top: 0; padding-top: 0; }
.list-row:last-child { padding-bottom: 0; }
.list-icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: var(--surface-3);
  display: grid;
  place-items: center;
  flex: 0 0 40px;
  font-size: 15px;
}
.list-body { min-width: 0; flex: 1; }
.list-title { font-weight: 750; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text); }
.list-meta { color: var(--muted); font-size: 12px; margin-top: 3px; display: flex; gap: 8px; flex-wrap: wrap; }
.list-actions { display: flex; gap: 7px; align-items: center; }

/* ── Tables (流水/购买记录) ── */
.table-wrap { overflow: auto; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }
.table-wrap table { width: 100%; border-collapse: collapse; min-width: 760px; }
.table-wrap th,
.table-wrap td {
  text-align: left;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
.table-wrap th {
  font-size: 12px;
  color: var(--muted);
  background: var(--surface-2);
  font-weight: 800;
  white-space: nowrap;
}
.table-wrap td { font-size: 13px; color: var(--text); }
.table-wrap tr:last-child td { border-bottom: 0; }
.table-main { font-weight: 750; }
.table-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.table-num { font-variant-numeric: tabular-nums; white-space: nowrap; }

/* ── Form controls / search (原型 app.css) ── */
.input, .select, .textarea { border: 1px solid var(--line); background: var(--surface); border-radius: 12px; color: var(--text); outline: none; transition: .18s; }
.input, .select { height: 42px; padding: 0 12px; }
.textarea { width: 100%; min-height: 120px; padding: 12px; resize: vertical; }
.input:focus, .select:focus, .textarea:focus { border-color: #e8a2b5; box-shadow: 0 0 0 3px rgba(230, 85, 126, .12); }
.search { min-width: 260px; flex: 1; max-width: 420px; position: relative; }
.search .input { width: 100%; padding-left: 38px; }
.search-icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.field label { display: block; font-size: 13px; font-weight: 750; margin-bottom: 7px; }
.field .input, .field .select { width: 100%; }
.field-note { font-size: 12px; color: var(--muted); margin-top: 5px; }

/* ── Filter bar / Tabs ── */
.filter-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); overflow: auto; }
.tab { border: 0; background: transparent; padding: 11px 13px; color: var(--muted); font-weight: 750; cursor: pointer; white-space: nowrap; border-bottom: 2px solid transparent; }
.tab.active { color: var(--primary-strong); border-bottom-color: var(--primary); }

/* ── Settings rows / switches ── */
.settings-row { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 15px 0; border-top: 1px solid var(--line); }
.settings-row:first-child { border-top: 0; }
.settings-title { font-weight: 750; }
.settings-note { font-size: 12px; color: var(--muted); margin-top: 3px; }
.switch { width: 44px; height: 25px; border-radius: 999px; background: #cfd6d2; position: relative; cursor: pointer; flex: 0 0 44px; border: 0; padding: 0; }
.switch::after { content: ""; position: absolute; width: 19px; height: 19px; border-radius: 50%; background: #fff; left: 3px; top: 3px; box-shadow: 0 1px 5px rgba(0, 0, 0, .18); transition: .18s; }
.switch.on { background: var(--primary); }
.switch.on::after { left: 22px; }
.switch:disabled { opacity: .5; cursor: not-allowed; }

/* ── Alerts ── */
.alert { display: flex; align-items: flex-start; gap: 12px; padding: 14px 16px; border-radius: 14px; border: 1px solid; }
.alert-success { background: var(--success-soft); border-color: #c4eadc; color: #23604d; }
.alert-warning { background: var(--warning-soft); border-color: #f0d7a8; color: #79531d; }
.alert-danger { background: var(--danger-soft); border-color: #efc3c9; color: #85313c; }
.alert-icon { width: 24px; height: 24px; display: grid; place-items: center; flex: 0 0 24px; }
.alert-body { flex: 1; }
.alert-title { font-weight: 800; }
.alert-text { font-size: 13px; margin-top: 2px; }

/* ── Layout panes / avatars / media ── */
.two-pane { display: grid; grid-template-columns: minmax(0, 1fr) minmax(300px, 0.42fr); gap: 18px; }
.sticky-panel { position: sticky; top: 88px; align-self: start; display: grid; gap: 16px; }
.avatar { width: 42px; height: 42px; border-radius: 13px; background: linear-gradient(135deg, #f7c4d3, #d5eee6); display: grid; place-items: center; font-weight: 850; color: #6d4b55; flex: 0 0 42px; font-size: 16px; overflow: hidden; }
.avatar.lg { width: 70px; height: 70px; border-radius: 22px; font-size: 22px; }
.avatar img { width: 100%; height: 100%; object-fit: cover; border-radius: inherit; }
.profile-head { display: flex; align-items: center; gap: 18px; margin-bottom: 22px; }
.full { grid-column: 1 / -1; }
.mt-8 { margin-top: 8px; }
.mt-14 { margin-top: 14px; }
.ml-8 { margin-left: 8px; }
.spacer-16 { height: 16px; }
.card-flat { box-shadow: none; }
.card.current { border: 2px solid var(--primary); }
.media-thumb { width: 100%; aspect-ratio: 4/5; background: linear-gradient(145deg, #f7d7e0, #ecf4f1); border-radius: 10px; display: grid; place-items: center; color: #6d625f; font-weight: 800; }
.upload-zone { border: 1.5px dashed #d9cfd2; border-radius: 16px; padding: 18px; text-align: center; background: var(--surface-2); }
.upload-icon { width: 54px; height: 54px; border-radius: 18px; background: var(--primary-soft); display: grid; place-items: center; margin: 0 auto 12px; color: var(--primary-strong); }

/* ── Misc helpers ── */
.pre-wrap { white-space: pre-wrap; }
.space-between { display: flex; justify-content: space-between; align-items: flex-start; }

/* ── Notification detail / selection ── */
.detail-title { font-size: 20px; margin: 10px 0 6px; color: var(--text); }
.list-row.selected { background: var(--surface-2); border-radius: 10px; }

/* ── Extra badges / buttons ── */
.badge-blue { background: color-mix(in srgb, var(--blue) 12%, var(--surface)); color: var(--blue); }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger:hover { background: color-mix(in srgb, var(--danger) 85%, var(--text)); border-color: color-mix(in srgb, var(--danger) 85%, var(--text)); }

/* ── Responsive (原型 app.css 断点) ── */
@media (max-width: 1180px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hero { grid-template-columns: minmax(0, 1fr) 300px; }
  .two-pane { grid-template-columns: minmax(0, 1fr) 300px; }
}
@media (max-width: 900px) {
  .hero, .two-pane { grid-template-columns: 1fr; }
  .sticky-panel { position: static; }
}
@media (max-width: 640px) {
  .grid-2, .grid-3, .grid-4, .form-grid { grid-template-columns: 1fr; }
  .card-pad { padding: 14px; }
  .filter-bar { align-items: stretch; }
  .search { max-width: none; min-width: 100%; }
  .hero { padding: 19px; }
  .hero h2 { font-size: 24px; }
  .hero-visual { min-height: 130px; }
  .section { margin-top: 16px; }
  .section-header { align-items: flex-start; }
  .section-title { font-size: 18px; }
  .kpi-value { font-size: 26px; }
  .list-row { align-items: flex-start; }
  .list-actions { flex-direction: column; align-items: stretch; }
}
