* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: "PingFang SC", "Microsoft YaHei", sans-serif;
  background: #f0f2f8;
  color: #1f2937;
}
[hidden] { display: none !important; }

.profile-shell {
  width: min(1720px, calc(100vw - 24px));
  margin: 0 auto;
  padding: 20px 16px 40px;
  display: grid;
  gap: 16px;
}
.profile-layout {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 20px;
  align-items: stretch;
}
.profile-sidebar {
  position: sticky;
  top: 20px;
  align-self: start;
}
.profile-sidebar-card {
  min-height: calc(100vh - 120px);
  background: linear-gradient(180deg, #f8faff 0%, #f3f6fc 100%);
  border: 1px solid #e3e9f4;
  border-radius: 22px;
  padding: 18px 14px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.78);
}
.profile-sidebar-title {
  margin: 0 0 12px;
  font-size: 13px;
  color: #94a3b8;
  font-weight: 600;
}
.profile-sidebar-nav {
  display: grid;
  gap: 8px;
}
.profile-nav-btn {
  height: 42px;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  background: #fff;
  color: #334155;
  text-align: left;
  padding: 0 14px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all .18s ease;
}
.profile-nav-btn:hover {
  background: #f8fafc;
  border-color: #cbd5e1;
}
.profile-nav-btn.active {
  background: linear-gradient(135deg, #eef3ff, #f7f8ff);
  color: #3150ea;
  border-color: #c8d8f6;
  box-shadow: inset 0 0 0 1px rgba(77,107,254,.06);
}
.profile-main {
  min-width: 0;
  min-height: calc(100vh - 120px);
  background: linear-gradient(180deg, #f8faff 0%, #f3f6fc 100%);
  border: 1px solid #e3e9f4;
  border-radius: 24px;
  padding: 20px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.78);
}
.profile-panel {
  display: none;
}
.profile-panel.active {
  display: grid;
  gap: 16px;
  align-content: start;
}

/* ── 顶栏 ── */
.profile-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 0;
}
.back-home {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #475569;
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: color .15s;
}
.back-home:hover { color: #1e293b; }
.topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
}
.topbar-link {
  font-size: 13px;
  color: #64748b;
  text-decoration: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
}
.topbar-link:hover { color: #1e293b; }
.logout-link { color: #94a3b8; }
.logout-link:hover { color: #ef4444; }

/* ── 会员卡片 ── */
.member-hero {
  background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
  border-radius: 18px;
  padding: 28px 24px 20px;
  color: #fff;
  position: relative;
  overflow: hidden;
}
.member-hero::before {
  content: "";
  position: absolute;
  right: -40px;
  top: -40px;
  width: 180px;
  height: 180px;
  background: radial-gradient(circle, rgba(77,107,254,.25) 0%, transparent 70%);
  pointer-events: none;
}
.member-hero-info {
  display: flex;
  align-items: center;
  gap: 16px;
}
.member-avatar {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  background: linear-gradient(135deg, #4D6BFE, #6C5CE7);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  font-weight: 700;
  flex-shrink: 0;
}
.member-meta { flex: 1; min-width: 0; }
.member-email {
  font-size: 16px;
  font-weight: 600;
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.member-badges {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
}
.badge {
  font-size: 12px;
  font-weight: 600;
  padding: 2px 10px;
  border-radius: 20px;
  line-height: 1.6;
}
.badge-free {
  background: rgba(255,255,255,.15);
  color: rgba(255,255,255,.8);
}
.badge-pro {
  background: linear-gradient(135deg, #f59e0b, #f97316);
  color: #fff;
}
.badge-warn {
  background: rgba(239,68,68,.2);
  color: #fca5a5;
  cursor: help;
  position: relative;
}
.member-hero-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.member-hero-actions {
  display: flex;
  gap: 10px;
  flex-shrink: 0;
}
.hero-btn {
  height: 40px;
  padding: 0 20px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  padding: 0 18px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all .2s;
}
.hero-btn.primary {
  background: linear-gradient(135deg, #5B7AFF, #7C6FF0);
  color: #fff;
  box-shadow: 0 2px 8px rgba(77, 107, 254, .35);
}
.hero-btn.primary:hover { opacity: .92; box-shadow: 0 4px 14px rgba(77, 107, 254, .45); }
.hero-btn.ghost {
  background: rgba(255,255,255,.12);
  color: #fff;
  border: 1px solid rgba(255,255,255,.2);
}
.hero-btn.ghost:hover { background: rgba(255,255,255,.2); }
.membership-detail {
  margin-top: 16px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 8px;
  border-top: 1px solid rgba(255,255,255,.1);
  padding-top: 14px;
}
.membership-row {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.membership-label {
  font-size: 12px;
  color: rgba(255,255,255,.5);
}
.membership-value {
  font-size: 14px;
  font-weight: 600;
  color: rgba(255,255,255,.9);
}

/* ── 通用卡片 ── */
.profile-card {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 16px;
  padding: 20px;
}
.card-title {
  margin: 0 0 16px;
  font-size: 17px;
  font-weight: 700;
  color: #0f172a;
}
.card-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.card-header-row .card-title { margin-bottom: 0; }
.card-subtle {
  font-size: 12px;
  color: #94a3b8;
}
.table-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.profile-table-pagination {
  margin-top: 14px;
}
.profile-table-pagination .pagination-info {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #64748b;
  font-size: 12px;
}
.profile-table-pagination .pagination-info label {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.profile-table-pagination .pagination-info select {
  height: 30px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  padding: 0 8px;
  background: #fff;
  color: #334155;
}
.profile-table-pagination .pagination-btns {
  display: flex;
  gap: 8px;
}
.action-btn.secondary {
  background: #fff;
  color: #4D6BFE;
  border-color: #c8d8f6;
}
.action-btn.secondary:hover {
  background: #edf4ff;
}

/* ── 额度概览 ── */
.quota-overview {
  display: flex;
  align-items: center;
  gap: 28px;
}
.quota-main { flex-shrink: 0; }
.quota-circle-wrap {
  width: 120px;
  height: 120px;
  position: relative;
}
.quota-circle {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}
.quota-bg {
  fill: none;
  stroke: #e5e7eb;
  stroke-width: 8;
}
.quota-arc {
  fill: none;
  stroke: #4D6BFE;
  stroke-width: 8;
  stroke-linecap: round;
  transition: stroke-dashoffset .6s ease;
}
.quota-center-text {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.quota-center-text strong {
  font-size: 28px;
  color: #0f172a;
  line-height: 1;
}
.quota-center-text span {
  font-size: 12px;
  color: #94a3b8;
  margin-top: 4px;
}
.quota-details {
  flex: 1;
  display: grid;
  gap: 10px;
}
.quota-detail-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: #f8fafc;
  border-radius: 10px;
  border: 1px solid #f1f5f9;
}
.quota-detail-label {
  font-size: 13px;
  color: #64748b;
}
.quota-detail-value {
  font-size: 14px;
  font-weight: 600;
  color: #0f172a;
}

/* ── 兑换码区域 ── */
.redeem-area { }
.redeem-input-row {
  display: flex;
  gap: 10px;
}
.redeem-input {
  flex: 1;
  height: 44px;
  border: 1.5px solid #e2e8f0;
  border-radius: 12px;
  padding: 0 14px;
  font-size: 15px;
  background: #f8fafc;
  transition: all .2s;
}
.redeem-input:focus {
  outline: none;
  border-color: #4D6BFE;
  background: #fff;
  box-shadow: 0 0 0 3px rgba(77,107,254,.1);
}
.redeem-hint {
  margin: 10px 0 0;
  font-size: 13px;
  color: #94a3b8;
}
.redeem-gift-row {
  margin-top: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 14px;
  border: 1px solid rgba(77, 107, 254, 0.16);
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(77, 107, 254, 0.07), rgba(34, 197, 94, 0.06));
}
.redeem-gift-row p {
  margin: 0;
  font-size: 13px;
  color: #3f57d8;
  line-height: 1.5;
}
.purchase-links {
  margin-top: 14px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.payment-method-row {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}
.payment-method-label {
  font-size: 12px;
  font-weight: 600;
  color: #64748b;
}
.payment-method-options {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.payment-method-btn {
  height: 36px;
  border-radius: 10px;
  border: 1px solid #d8e2ff;
  background: #f8fbff;
  color: #3150ea;
  padding: 0 14px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all .18s ease;
}
.payment-method-btn:hover {
  border-color: #b9cbff;
  background: #eef4ff;
}
.payment-method-btn.active {
  border-color: #4D6BFE;
  background: #eef3ff;
  box-shadow: inset 0 0 0 1px rgba(77,107,254,.1);
}
.purchase-btn {
  height: 38px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  padding: 0 16px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
  cursor: pointer;
  transition: all .2s;
  background: #4D6BFE;
  color: #fff;
  border: 1px solid #4D6BFE;
}
.purchase-btn:hover { background: #3d5ae5; border-color: #3d5ae5; }
.purchase-btn[disabled] {
  opacity: 0.65;
  cursor: not-allowed;
  pointer-events: none;
}
.purchase-btn.outline {
  background: #fff;
  color: #4D6BFE;
  border: 1.5px solid #4D6BFE;
}
.purchase-btn.outline:hover {
  background: #f0f4ff;
}

/* ── 操作按钮 ── */
.action-btn {
  height: 44px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 600;
  padding: 0 20px;
  cursor: pointer;
  border: 1px solid #e2e8f0;
  background: #fff;
  color: #334155;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all .2s;
  white-space: nowrap;
}
.action-btn:hover { background: #f8fafc; }
.action-btn.primary {
  background: #4D6BFE;
  color: #fff;
  border-color: #4D6BFE;
}
.action-btn.primary:hover { background: #3d5ae5; }
.action-btn.small {
  height: 34px;
  font-size: 13px;
  padding: 0 14px;
  border-radius: 8px;
}

/* ── 表格 ── */
.table-wrap {
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  overflow: hidden;
}
table { width: 100%; border-collapse: collapse; }
th, td {
  padding: 10px 12px;
  border-bottom: 1px solid #f1f5f9;
  text-align: left;
  font-size: 13px;
}
th { background: #f8fafc; color: #64748b; font-weight: 600; }
th { white-space: nowrap; }
tr:last-child td { border-bottom: none; }
.empty-cell { color: #94a3b8; text-align: center; padding: 20px; }
.table-action-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* ── 弹窗 ── */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 24px;
  backdrop-filter: blur(4px);
}
.modal-card {
  background: #fff;
  border-radius: 20px;
  box-shadow: 0 24px 64px rgba(0,0,0,.12);
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
}
.upgrade-modal { max-width: 480px; }
.topup-modal { max-width: 420px; }
.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px 0;
}
.payment-flow-head-side {
  display: flex;
  align-items: center;
  gap: 10px;
}
.modal-title {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
}
.modal-close {
  width: 32px;
  height: 32px;
  border: none;
  background: #f1f5f9;
  border-radius: 8px;
  font-size: 16px;
  color: #64748b;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.modal-close:hover { background: #e2e8f0; }
.modal-body { padding: 20px 24px 24px; }
.payment-flow-modal { max-width: 520px; }
.payment-flow-desc {
  margin: 6px 0 0;
  font-size: 12px;
  color: #64748b;
  line-height: 1.6;
}
.payment-flow-countdown {
  display: inline-flex;
  align-items: center;
  height: 32px;
  padding: 0 12px;
  border-radius: 999px;
  background: #eef4ff;
  border: 1px solid #d9e6ff;
  color: #3150ea;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}
.payment-flow-countdown.expired {
  background: #fff1f2;
  border-color: #fecdd3;
  color: #e11d48;
}
.payment-flow-summary {
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  background: #f8fafc;
  padding: 14px 16px;
  display: grid;
  gap: 10px;
}
.payment-flow-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 14px;
}
.payment-flow-row span {
  color: #64748b;
}
.payment-flow-row strong {
  color: #0f172a;
  text-align: right;
}
.payment-code-section {
  margin-top: 14px;
  border: 1px solid #dbeafe;
  background: #f8fbff;
  border-radius: 14px;
  padding: 14px 16px;
}
.payment-code-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}
.payment-code-head h4 {
  margin: 0;
  font-size: 14px;
  color: #0f172a;
}
.payment-code-list {
  display: grid;
  gap: 8px;
}
.payment-code-item {
  border: 1px solid #c7d2fe;
  border-radius: 12px;
  background: #fff;
  padding: 10px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.payment-code-item strong {
  font-size: 15px;
  letter-spacing: .04em;
  color: #1e293b;
}
.payment-code-item span {
  font-size: 12px;
  color: #64748b;
}
.payment-flow-actions {
  margin-top: 16px;
  display: flex;
  gap: 10px;
}

/* ── 升级弹窗 ── */
.upgrade-plans {
  display: grid;
  gap: 12px;
  margin-bottom: 20px;
}
.plan-card {
  border: 2px solid #e5e7eb;
  border-radius: 14px;
  padding: 16px 18px;
  cursor: pointer;
  transition: all .2s;
  position: relative;
  overflow: hidden;
}
.plan-card:hover { border-color: #4D6BFE; background: #fafbff; }
.plan-card.selected { border-color: #4D6BFE; background: #f0f4ff; }
.plan-card .plan-tag {
  position: absolute;
  top: 0;
  right: 0;
  background: #f59e0b;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 0 12px 0 10px;
}
.plan-card .plan-name {
  font-size: 16px;
  font-weight: 700;
  color: #0f172a;
}
.plan-card .plan-price-row {
  margin-top: 8px;
  display: flex;
  align-items: baseline;
  gap: 8px;
}
.plan-price-main {
  font-size: 28px;
  font-weight: 800;
  color: #4D6BFE;
}
.plan-price-unit {
  font-size: 13px;
  color: #64748b;
}
.plan-price-original {
  font-size: 13px;
  color: #94a3b8;
  text-decoration: line-through;
}
.plan-monthly-hint {
  margin-top: 4px;
  font-size: 12px;
  color: #94a3b8;
}
.plan-quota-hint {
  margin-top: 4px;
  font-size: 12px;
  color: #4D6BFE;
  font-weight: 500;
}
.upgrade-benefits {
  margin-top: 4px;
}
.upgrade-benefits h4 {
  margin: 0 0 10px;
  font-size: 14px;
  color: #334155;
  font-weight: 600;
}
.benefit-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
}
.benefit-list li {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: #475569;
}
.upgrade-notice, .topup-notice {
  margin: 16px 0 0;
  font-size: 12px;
  color: #94a3b8;
  text-align: center;
  line-height: 1.6;
}

/* ── 加量包弹窗 ── */
.topup-packages {
  display: grid;
  gap: 10px;
}
.topup-card {
  border: 2px solid #e5e7eb;
  border-radius: 12px;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  transition: all .2s;
}
.topup-card:hover { border-color: #4D6BFE; background: #fafbff; }
.topup-card.selected { border-color: #4D6BFE; background: #f0f4ff; }
.topup-card .topup-name {
  font-size: 15px;
  font-weight: 600;
  color: #0f172a;
}
.topup-card .topup-quota {
  font-size: 13px;
  color: #64748b;
  margin-top: 2px;
}
.topup-card .topup-price {
  font-size: 20px;
  font-weight: 800;
  color: #4D6BFE;
  white-space: nowrap;
}

/* ── 状态提示 ── */
.profile-status {
  min-height: 22px;
  font-size: 13px;
  color: #475569;
  text-align: center;
}
.profile-status.error { color: #dc2626; }
.profile-status.success { color: #059669; }

/* ── Toast ── */
.mc-toast {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(.95);
  opacity: 0;
  z-index: 99999;
  padding: 12px 28px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  background: rgba(0,0,0,.75);
  color: #fff;
  box-shadow: 0 6px 24px rgba(0,0,0,0.2);
  transition: opacity .2s, transform .2s;
  pointer-events: none;
  white-space: nowrap;
}
.mc-toast-show {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}
.mc-toast-success, .mc-toast-error, .mc-toast-info {
  background: rgba(0,0,0,.75);
  color: #fff;
}

/* ── 响应式 ── */
@media (max-width: 600px) {
  .profile-shell {
    width: min(100vw - 16px, 100%);
    padding: 14px 12px 30px;
  }
  .profile-layout {
    grid-template-columns: 1fr;
    gap: 14px;
  }
  .profile-sidebar {
    position: static;
  }
  .profile-sidebar-card,
  .profile-main {
    min-height: 0;
  }
  .profile-sidebar-card {
    padding: 10px;
  }
  .profile-sidebar-title {
    display: none;
  }
  .profile-sidebar-nav {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 2px;
  }
  .profile-nav-btn {
    flex: 0 0 auto;
    white-space: nowrap;
  }
  .member-hero { padding: 20px 16px; }
  .quota-overview { flex-direction: column; }
  .quota-circle-wrap { width: 100px; height: 100px; }
  .quota-center-text strong { font-size: 24px; }
  .redeem-input-row { flex-direction: column; }
  .redeem-gift-row {
    align-items: stretch;
    flex-direction: column;
  }
  .membership-detail { grid-template-columns: 1fr; }
  .modal-card { border-radius: 16px; }
  .plan-price-main { font-size: 24px; }
  .payment-flow-row,
  .payment-code-item {
    flex-direction: column;
    align-items: flex-start;
  }
  .payment-flow-row strong {
    text-align: left;
  }
}

/* ── AI 配置卡片 ── */
.channel-pane { display: block; }
.channel-pane[hidden] { display: none; }
.ai-config-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.ai-config-grid label {
  display: grid;
  gap: 4px;
  font-size: 12px;
  font-weight: 500;
  color: #475569;
}
.ai-config-grid input,
.ai-config-grid select {
  padding: 8px 10px;
  font-size: 13px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  background: #fff;
}
.ai-config-grid input:focus,
.ai-config-grid select:focus {
  border-color: #4D6BFE;
  outline: none;
  box-shadow: 0 0 0 2px rgba(77,107,254,0.15);
}
