/* ============================================================
   WorkBuddy Points · 完整复刻版 UI
   配色：浅灰背景 + emerald 主色 + 深色卡片
   ============================================================ */

:root {
  --bg: #f3f4f6;
  --bg-2: #e5e7eb;
  --card: #ffffff;
  --dark: #111827;
  --dark-2: #1f2937;
  --text: #111827;
  --text-2: #4b5563;
  --text-3: #9ca3af;
  --primary: #10b981;
  --primary-dark: #059669;
  --primary-light: #d1fae5;
  --warn: #f59e0b;
  --warn-bg: #fffbeb;
  --err: #ef4444;
  --err-bg: #fef2f2;
  --border: #e5e7eb;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(0,0,0,0.07), 0 1px 2px rgba(0,0,0,0.05);
  --shadow-lg: 0 4px 6px -1px rgba(0,0,0,0.07), 0 2px 4px -1px rgba(0,0,0,0.04);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
}

/* ---------- 顶部导航 ---------- */
.topbar {
  position: sticky; top: 0; z-index: 50;
  background: var(--card);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow);
}
.topbar__inner {
  max-width: 1200px; margin: 0 auto;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 20px; height: 56px;
}
.brand {
  display: flex; align-items: center; gap: 10px;
  text-decoration: none; color: inherit;
}
.brand__text {
  font-size: 1.05rem; font-weight: 700; letter-spacing: -0.02em;
  display: flex; flex-direction: column; line-height: 1.2;
}
.brand__text small {
  font-size: 0.65rem; font-weight: 500; color: var(--text-3); letter-spacing: 0.02em;
}
.topbar__nav {
  display: flex; gap: 4px;
}
.nav-link {
  padding: 6px 14px; border-radius: 6px;
  font-size: 0.88rem; color: var(--text-2); text-decoration: none;
  transition: all .15s;
}
.nav-link:hover { background: var(--bg); color: var(--text); }
.nav-link.is-active {
  background: var(--primary-light); color: var(--primary-dark);
  font-weight: 600;
}
.topbar__right {
  display: flex; align-items: center; gap: 8px;
}
.balance-pill {
  display: inline-flex; align-items: center; gap: 4px;
  background: var(--primary-light); color: var(--primary-dark);
  padding: 4px 10px; border-radius: 20px;
  font-size: 0.8rem; font-weight: 600;
}
.balance-pill__label { font-weight: 500; opacity: .8; }
.nav-user__name {
  font-size: 0.85rem; color: var(--text-2); font-weight: 500;
  max-width: 100px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: none; border-radius: 8px; padding: 8px 16px;
  font-size: 0.9rem; font-weight: 500; cursor: pointer;
  background: var(--bg); color: var(--text);
  transition: all .15s; line-height: 1.4;
}
.btn:hover { opacity: .9; transform: translateY(-1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.btn--primary { background: var(--primary); color: #fff; }
.btn--primary:hover { background: var(--primary-dark); }
.btn--ghost { background: transparent; color: var(--text-2); border: 1px solid var(--border); }
.btn--ghost:hover { background: var(--bg); }
.btn--dark { background: var(--dark); color: #fff; }
.btn--dark:hover { background: var(--dark-2); }
.btn--outline { background: transparent; color: var(--text-2); border: 1px solid var(--border); }
.btn--outline:hover { border-color: var(--text-3); }
.btn--sm { padding: 5px 12px; font-size: 0.82rem; }
.btn--block { width: 100%; }

/* ---------- 页面主体 ---------- */
.page {
  max-width: 1200px; margin: 0 auto; padding: 24px 20px 40px;
}
.page-header {
  display: flex; align-items: flex-end; justify-content: space-between;
  margin-bottom: 20px; gap: 16px; flex-wrap: wrap;
}
.page-header__tag {
  font-size: 0.72rem; font-weight: 700; color: var(--primary);
  letter-spacing: 0.08em; text-transform: uppercase;
}
.page-header__title {
  font-size: 1.6rem; font-weight: 700; color: var(--text); margin-top: 2px;
}
.page-header__right {
  display: flex; gap: 8px;
}

/* ---------- 网格 ---------- */
.grid-2 {
  display: grid; grid-template-columns: 1fr 1fr; gap: 20px;
  margin-bottom: 20px;
}
@media (max-width: 900px) {
  .grid-2 { grid-template-columns: 1fr; }
  .topbar__nav { display: none; }
}

/* ---------- 卡片 ---------- */
.card {
  background: var(--card); border-radius: var(--radius);
  box-shadow: var(--shadow); border: 1px solid var(--border);
  padding: 20px;
}
.card--dark {
  background: var(--dark); color: #fff; border-color: var(--dark-2);
}
.card__header {
  display: flex; align-items: flex-start; justify-content: space-between;
  margin-bottom: 16px; gap: 8px;
}
.card__header--dark { margin-bottom: 14px; }
.card__tag {
  display: block; font-size: 0.68rem; font-weight: 700;
  color: var(--primary); letter-spacing: 0.06em; text-transform: uppercase;
  margin-bottom: 2px;
}
.card--dark .card__tag { color: #34d399; }
.card__title {
  font-size: 1.15rem; font-weight: 700;
}
.card--dark .card__title { color: #fff; }

/* ---------- 账户积分卡片 ---------- */
.balance-overview__body {
  display: flex; gap: 20px; align-items: stretch;
}
.balance-overview__main {
  flex: 1; min-width: 0;
}
.balance-overview__side {
  flex: 1; min-width: 0;
}
.balance-overview__divider {
  width: 1px; background: rgba(255,255,255,0.1); align-self: stretch;
}
.balance-overview__label {
  font-size: 0.8rem; color: var(--text-3); margin-bottom: 4px;
}
.card--dark .balance-overview__label { color: rgba(255,255,255,0.55); }
.balance-overview__value {
  font-size: 2.6rem; font-weight: 800; letter-spacing: -0.03em;
  line-height: 1.1; margin-bottom: 2px;
}
.card--dark .balance-overview__value { color: #fff; }
.balance-overview__unit {
  font-size: 0.7rem; color: var(--text-3); letter-spacing: 0.05em;
}
.card--dark .balance-overview__unit { color: rgba(255,255,255,0.4); }
.balance-overview__hint {
  font-size: 0.78rem; color: var(--text-3); margin: 8px 0 12px; line-height: 1.5;
}
.card--dark .balance-overview__hint { color: rgba(255,255,255,0.45); }
.badge {
  display: inline-block; padding: 2px 8px; border-radius: 4px;
  font-size: 0.72rem; font-weight: 600;
}
.badge--warn { background: rgba(245,158,11,0.15); color: var(--warn); }

/* ---------- 充值套餐 ---------- */
.recharge-options { display: flex; flex-direction: column; gap: 10px; margin-bottom: 16px; }
.recharge-option {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px; border-radius: 10px;
  border: 1.5px solid var(--border); cursor: pointer;
  transition: all .15s; background: var(--card);
}
.recharge-option:hover { border-color: var(--primary); }
.recharge-option.is-active {
  border-color: var(--primary); background: #ecfdf5;
}
.recharge-option input { display: none; }
.recharge-option__check {
  width: 18px; height: 18px; border-radius: 50%;
  border: 2px solid var(--border); flex-shrink: 0;
  display: grid; place-items: center;
  transition: all .15s;
}
.recharge-option.is-active .recharge-option__check {
  border-color: var(--primary); background: var(--primary);
}
.recharge-option.is-active .recharge-option__check::after {
  content: ''; width: 6px; height: 6px; border-radius: 50%; background: #fff;
}
.recharge-option__info {
  flex: 1; display: flex; flex-direction: column; gap: 1px;
}
.recharge-option__name {
  font-size: 0.9rem; font-weight: 600;
}
.recharge-option__points {
  font-size: 0.78rem; color: var(--text-3);
}
.recharge-option__badge {
  display: inline-block; margin-left: 6px;
  font-size: 0.65rem; font-weight: 600;
  background: var(--primary-light); color: var(--primary-dark);
  padding: 1px 6px; border-radius: 4px;
}
.recharge-option__price {
  font-size: 0.95rem; font-weight: 700; color: var(--text);
  white-space: nowrap;
}

/* ---------- 表格 ---------- */
.table-wrap { overflow-x: auto; }
.data-table {
  width: 100%; border-collapse: collapse; font-size: 0.82rem;
}
.data-table th {
  text-align: left; padding: 10px 8px;
  font-weight: 600; color: var(--text-3);
  border-bottom: 1px solid var(--border); white-space: nowrap;
}
.data-table td {
  padding: 10px 8px; border-bottom: 1px solid var(--border);
  color: var(--text-2); white-space: nowrap;
}
.data-table tr:last-child td { border-bottom: none; }
.empty-row td {
  text-align: center; color: var(--text-3); padding: 32px 8px;
}

/* ---------- 模型消耗等级 ---------- */
.model-table { margin-top: 12px; }
.model-table__head {
  display: grid; grid-template-columns: 1fr 120px 80px;
  gap: 12px; padding: 0 4px 8px;
  font-size: 0.72rem; font-weight: 600; color: var(--text-3);
  border-bottom: 1px solid var(--border);
}
.model-group { margin-top: 12px; }
.model-group__title {
  font-size: 0.78rem; font-weight: 700; color: var(--text);
  margin-bottom: 8px; display: flex; align-items: center; gap: 6px;
}
.model-group__title small {
  font-weight: 400; color: var(--text-3);
}
.model-row {
  display: grid; grid-template-columns: 1fr 120px 80px;
  gap: 12px; align-items: center;
  padding: 7px 4px; border-radius: 6px;
}
.model-row:hover { background: var(--bg); }
.model-row__info {
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
}
.model-row__name {
  font-size: 0.84rem; font-weight: 600; color: var(--text);
}
.model-row__tag {
  font-size: 0.68rem; padding: 1px 6px; border-radius: 4px;
  background: var(--primary-light); color: var(--primary-dark);
  font-weight: 500;
}
.model-row__tag--sub {
  background: var(--bg); color: var(--text-2);
}
.bar-track {
  width: 100%; height: 6px; border-radius: 3px;
  background: var(--bg-2); overflow: hidden;
}
.bar-fill {
  height: 100%; border-radius: 3px; transition: width .4s ease;
}
.bar-fill--ok { background: var(--primary); }
.bar-fill--warn { background: var(--warn); }
.bar-fill--err { background: var(--err); }
.status {
  font-size: 0.72rem; font-weight: 600; padding: 2px 8px;
  border-radius: 4px; text-align: center; display: inline-block;
}
.status--ok { background: #ecfdf5; color: var(--primary-dark); }
.status--warn { background: var(--warn-bg); color: #b45309; }
.status--err { background: var(--err-bg); color: #b91c1c; }

/* ---------- 兑换码区 ---------- */
.redeem-card-compact { margin-top: 4px; }
.redeem-inline__row {
  display: flex; gap: 10px; margin-top: 8px;
}
.redeem-inline__row .input { flex: 1; }
.redeem-hint {
  font-size: 0.78rem; color: var(--text-3); margin-top: 8px;
}

/* ---------- 输入框 ---------- */
.input {
  width: 100%; padding: 10px 14px;
  border: 1.5px solid var(--border); border-radius: 8px;
  font-size: 0.92rem; background: var(--card); color: var(--text);
  outline: none; transition: border-color .15s;
}
.input:focus { border-color: var(--primary); }
.input.is-error { border-color: var(--err); }
.input.is-success { border-color: var(--primary); }
.form-label {
  display: block; font-size: 0.82rem; font-weight: 600;
  color: var(--text-2); margin-bottom: 4px;
}

/* ---------- 结果提示 ---------- */
.redeem-result {
  margin-top: 10px; padding: 10px 14px; border-radius: 8px;
  font-size: 0.85rem; font-weight: 500;
}
.redeem-result--success { background: #ecfdf5; color: var(--primary-dark); }
.redeem-result--error { background: var(--err-bg); color: #b91c1c; }

/* ---------- 警告条 ---------- */
.alert {
  display: flex; align-items: flex-start; gap: 8px;
  padding: 10px 12px; border-radius: 8px; font-size: 0.8rem;
  margin-bottom: 10px; line-height: 1.5;
}
.alert--warn {
  background: var(--warn-bg); color: #92400e; border: 1px solid #fde68a;
}
.alert svg { flex-shrink: 0; margin-top: 1px; }

/* ---------- 弹窗 ---------- */
.modal { position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center; }
.modal[aria-hidden="true"] { visibility: hidden; opacity: 0; pointer-events: none; }
.modal[aria-hidden="true"] .modal__panel { transform: translateY(12px) scale(.98); }
.modal__backdrop { position: absolute; inset: 0; background: rgba(0,0,0,0.35); }
.modal__panel { position: relative; width: 92%; max-width: 400px; transition: all .2s; }
.modal__card {
  background: var(--card); border-radius: var(--radius);
  box-shadow: var(--shadow-lg); padding: 24px;
}
.modal__close {
  position: absolute; top: 14px; right: 16px;
  background: none; border: none; font-size: 1.5rem; color: var(--text-3);
  cursor: pointer; line-height: 1;
}
.modal__tabs {
  display: flex; gap: 8px; margin-bottom: 16px;
}
.modal__tab {
  flex: 1; padding: 8px; border-radius: 8px; border: none;
  background: var(--bg); color: var(--text-2); font-size: 0.9rem;
  font-weight: 600; cursor: pointer; transition: all .15s;
}
.modal__tab.is-active { background: var(--primary); color: #fff; }
.modal__form { display: flex; flex-direction: column; gap: 12px; }
.modal__result {
  padding: 10px 12px; border-radius: 8px; font-size: 0.85rem; font-weight: 500;
}
.modal__result--success { background: #ecfdf5; color: var(--primary-dark); }
.modal__result--error { background: var(--err-bg); color: #b91c1c; }
.modal__note {
  margin-top: 14px; font-size: 0.78rem; color: var(--text-3); text-align: center;
}

/* ---------- 页脚 ---------- */
.footer {
  max-width: 1200px; margin: 0 auto; padding: 20px;
  display: flex; justify-content: space-between; align-items: center;
  font-size: 0.78rem; color: var(--text-3); border-top: 1px solid var(--border);
}
.footer__status { display: flex; align-items: center; gap: 6px; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--primary); }

/* ---------- Toast ---------- */
.toast {
  position: fixed; bottom: 28px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: var(--dark); color: #fff; padding: 10px 20px; border-radius: 8px;
  font-size: 0.88rem; font-weight: 500; z-index: 200;
  box-shadow: var(--shadow-lg); opacity: 0; transition: all .25s ease;
  pointer-events: none; white-space: nowrap;
}
.toast.is-visible { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- 通用 ---------- */
.link { font-size: 0.82rem; color: var(--text-3); text-decoration: none; }
.link:hover { color: var(--primary); }
.text-muted { font-size: 0.82rem; color: var(--text-3); }
.icon-chart { color: var(--text-3); }
.no-scroll { overflow: hidden; }
