/* Ordo 账户控制台 · 浅色
 * 极简、高密度专业 SaaS 控制台架构（对齐 Qoder 个人中心规范）
 * 颜色一律取自 tokens-light.css，字体取自 site.css。
 * 顺序：tokens-light.css → site.css → account.css
 */

.acct-body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
}

/* ── 控制台主框架（Qoder 双栏架构） ─────────────────────────────────── */
.acct-shell {
  flex: 1 0 auto;
  display: flex;
  max-width: 1200px;
  width: 100%;
  margin: 32px auto 64px;
  padding: 0 24px;
  gap: 36px;
  align-items: flex-start;
  box-sizing: border-box;
}

/* ── 左侧固定侧栏 ───────────────────────────────────────────────────── */
.acct-sidebar {
  width: 230px;
  flex-shrink: 0;
  box-sizing: border-box;
}

.acct-user-header {
  padding: 4px 12px 18px;
  margin-bottom: 8px;
  border-bottom: 1px solid var(--line);
}

.user-meta-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.user-display-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-tier-tag {
  font-size: 11px;
  font-weight: 500;
  padding: 1px 6px;
  border-radius: 4px;
  background: var(--surface2);
  color: var(--text-muted);
  border: 1px solid var(--line);
  line-height: 1.4;
}

.user-email-row {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.acct-nav-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.acct-nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 12px;
  border-radius: 8px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 14px;
  font-family: var(--sans);
  cursor: pointer;
  text-align: left;
  box-sizing: border-box;
  transition: background .12s ease, color .12s ease;
}

.acct-nav-item:hover {
  background: var(--surface2);
  color: var(--text);
}

.acct-nav-item.is-active {
  background: var(--surface2);
  color: var(--text);
  font-weight: 500;
}

.nav-svg {
  width: 16px;
  height: 16px;
  flex: none;
  opacity: .8;
}

.nav-divider {
  height: 1px;
  background: var(--line);
  margin: 8px 12px;
}

.nav-item-logout {
  color: var(--text-muted);
}

.nav-item-logout:hover {
  color: var(--danger);
  background: var(--danger-soft);
}

/* ── 右侧主工作区 ───────────────────────────────────────────────────── */
.acct-workspace {
  flex: 1;
  min-width: 0;
  box-sizing: border-box;
}

.workspace-view {
  display: block;
}

.workspace-view[hidden] {
  display: none !important;
}

.view-header {
  margin-bottom: 20px;
}

.view-title {
  font-size: 20px;
  font-weight: 600;
  color: var(--text);
  margin: 0;
  font-family: var(--sans);
  letter-spacing: -.01em;
}

.view-sub-section {
  margin-top: 36px;
}

.section-title-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}

.section-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  margin: 0;
  font-family: var(--sans);
}

/* ── Qoder 卡片风格 ─────────────────────────────────────────────────── */
.qoder-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(21, 22, 26, .04);
}

.profile-card {
  padding: 0;
}

.qoder-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
}

.qoder-row:last-child {
  border-bottom: none;
}

.qoder-label {
  width: 140px;
  color: var(--text-muted);
  flex-shrink: 0;
}

.qoder-value {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  color: var(--text);
  text-align: right;
  gap: 8px;
}

.avatar-disc {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--surface2);
  border: 1px solid var(--line);
  color: var(--text);
  font-weight: 600;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.qoder-input-display {
  display: inline-block;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 6px 14px;
  background: var(--surface);
  font-size: 14px;
  color: var(--text);
  min-width: 140px;
  text-align: right;
}

.val-mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 13px;
  color: var(--text);
}

.val-code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  color: var(--text-muted);
  background: var(--surface2);
  padding: 3px 8px;
  border-radius: 4px;
}

.btn-copy-glyph {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  background: transparent;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  color: var(--text-muted);
  padding: 0;
  transition: color .12s ease, background .12s ease;
}

.btn-copy-glyph:hover {
  color: var(--text);
  background: var(--surface2);
}

.btn-copy-glyph.is-copied {
  color: var(--ok);
}

.glyph-svg {
  width: 15px;
  height: 15px;
}

.quiet-link-action {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--text);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  padding: 4px 8px;
  border-radius: 4px;
  transition: background .12s ease, color .12s ease;
}

.quiet-link-action:hover {
  background: var(--surface2);
  color: var(--brand);
}

.quiet-arrow {
  transition: transform .12s ease;
}

.quiet-link-action:hover .quiet-arrow {
  transform: translateX(3px);
}

.binding-val {
  font-size: 13px;
  color: var(--text-muted);
}

.binding-val.is-bound {
  color: var(--ok);
  font-weight: 500;
}

.text-muted-quiet {
  font-size: 13px;
  color: var(--text-muted);
}

/* ── Qoder 数据表格 ─────────────────────────────────────────────────── */
.table-card {
  padding: 0;
}

.qoder-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  text-align: left;
}

.qoder-table th {
  padding: 12px 20px;
  background: var(--surface2);
  color: var(--text-muted);
  font-weight: 500;
  border-bottom: 1px solid var(--line);
}

.qoder-table td {
  padding: 14px 20px;
  color: var(--text);
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}

.qoder-table tr:last-child td {
  border-bottom: none;
}

.client-brand {
  font-weight: 500;
  margin-right: 6px;
}

.badge-tag {
  display: inline-block;
  font-size: 11px;
  font-weight: 500;
  padding: 1px 6px;
  border-radius: 4px;
  line-height: 1.4;
}

.badge-tag-green {
  background: rgba(22, 111, 66, .10);
  color: var(--ok);
}

.cell-mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  color: var(--text-muted);
}

.cell-status-ok {
  color: var(--ok);
  font-weight: 500;
}

.table-action-link {
  color: var(--brand);
  text-decoration: none;
  font-weight: 500;
}

.table-action-link:hover {
  text-decoration: underline;
}

.btn-danger-outline {
  border: 1px solid var(--danger);
  color: var(--danger);
  background: transparent;
  border-radius: 6px;
  padding: 5px 12px;
  font-size: 12px;
  font-family: var(--sans);
  cursor: pointer;
  transition: background .12s ease, color .12s ease;
}

.btn-danger-outline:hover {
  background: var(--danger-soft);
}

.btn-danger-solid {
  background: var(--danger);
  color: #ffffff;
  border: none;
  border-radius: 6px;
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 500;
  font-family: var(--sans);
  cursor: pointer;
  transition: opacity .12s ease;
}

.btn-danger-solid:hover {
  opacity: .88;
}

/* ── Tab 2：用量指标网格 ─────────────────────────────────────────────── */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}

.metric-clean-box {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px 20px;
  box-shadow: 0 1px 3px rgba(21, 22, 26, .04);
}

.metric-name {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.metric-num {
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  letter-spacing: -.02em;
}

.metric-sub {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 6px;
}

/* ── 额度变动流水 & 订单列表 ─────────────────────────────────────────── */
.clean-events-box, .clean-orders-box {
  padding: 8px 20px;
  font-size: 13px;
  color: var(--text-muted);
}

.event-row, .order-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}

.event-row:last-child, .order-row:last-child {
  border-bottom: none;
}

.event-main, .order-main {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.event-kind, .order-title {
  font-weight: 500;
  color: var(--text);
  font-size: 13px;
}

.event-time, .order-time {
  font-size: 11px;
  color: var(--text-muted);
}

.event-delta {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 13px;
  font-weight: 600;
  color: var(--ok);
}

.event-delta.negative {
  color: var(--text);
}

.order-side {
  display: flex;
  align-items: center;
  gap: 14px;
}

.order-price {
  font-weight: 600;
  font-size: 14px;
  color: var(--text);
}

.order-status {
  font-size: 12px;
  color: var(--text-muted);
}

.order-status.paid {
  color: var(--ok);
  font-weight: 500;
}

.order-status.closed {
  color: var(--danger);
}

/* ── 套餐列表 ───────────────────────────────────────────────────────── */
.clean-plans-wrap,
.plans-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
}

.plan-row {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 16px;
  box-shadow: 0 1px 3px rgba(21, 22, 26, .04);
}

.plan-row b {
  display: block;
  font-size: 15px;
  color: var(--text);
  margin-bottom: 4px;
}

.plan-row span {
  font-size: 13px;
  color: var(--text-muted);
}

.plan-btn {
  background: var(--brand-fill);
  color: var(--brand-ink);
  border: none;
  border-radius: 6px;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 600;
  font-family: var(--sans);
  cursor: pointer;
  width: 100%;
  transition: opacity .12s ease;
}

.plan-btn:hover {
  opacity: .88;
}

/* ── 支付抽屉 ───────────────────────────────────────────────────────── */
.clean-checkout-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 24px;
  margin-bottom: 24px;
  box-shadow: var(--shadow);
}

.clean-checkout-card[hidden] {
  display: none !important;
}

.checkout-clean-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.checkout-clean-title {
  display: flex;
  align-items: center;
  gap: 8px;
}

.checkout-title-text {
  font-size: 16px;
  font-weight: 600;
  margin: 0;
  color: var(--text);
}

.btn-clean-close {
  background: transparent;
  border: none;
  font-size: 20px;
  line-height: 1;
  color: var(--text-muted);
  cursor: pointer;
}

.checkout-detail-row {
  display: flex;
  justify-content: space-between;
  font-size: 14px;
  margin-bottom: 16px;
  color: var(--text);
}

.checkout-price-bold {
  font-weight: 700;
  font-size: 16px;
}

.qrcode-clean-wrap {
  display: flex;
  justify-content: center;
  margin: 16px 0;
}

.qrcode-clean-wrap svg {
  width: 160px;
  height: 160px;
}

.hint-quiet, .status-quiet {
  text-align: center;
  font-size: 13px;
  color: var(--text-muted);
  margin: 4px 0;
}

.checkout-actions-row {
  display: flex;
  justify-content: center;
  margin-top: 16px;
}

/* ── 辅助类 ─────────────────────────────────────────────────────────── */
.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.global-status-toast {
  font-size: 13px;
  color: var(--text-muted);
  text-align: center;
  margin: 16px 0 0;
}

/* ── 响应式适配 ─────────────────────────────────────────────────────── */
@media (max-width: 900px) {
  .acct-shell {
    flex-direction: column;
    gap: 20px;
    padding: 0 16px;
    margin: 20px auto 40px;
  }
  .acct-sidebar {
    width: 100%;
  }
  .acct-nav-list {
    flex-direction: row;
    flex-wrap: wrap;
  }
  .acct-nav-item {
    width: auto;
    flex: 1 1 auto;
  }
  .nav-divider {
    display: none;
  }
  .metrics-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 600px) {
  .metrics-grid {
    grid-template-columns: 1fr;
  }
  .qoder-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
  .qoder-label {
    width: 100%;
  }
  .qoder-value {
    width: 100%;
    justify-content: flex-start;
  }
}
