:root {
  --bg: #f4f1ea;
  --ink: #171717;
  --muted: #5c5c5c;
  --line: #d8d4cb;
  --card: #fffdf8;
  --accent: #0f766e;
  --accent-ink: #083d38;
  --warn: #b54708;
  --danger: #b42318;
  --ok: #067647;
}
* { box-sizing: border-box; letter-spacing: 0; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--ink); font: 15px/1.45 "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif; }
button, input { font: inherit; }
button { cursor: pointer; }
.app { max-width: 430px; min-height: 100vh; margin: 0 auto; background: var(--bg); }
.top {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 18px 16px 14px; background: var(--bg); border-bottom: 1px solid var(--line);
}
.brand { font-size: 20px; font-weight: 700; }
.uid { color: var(--muted); font-size: 12px; }
.page { padding: 16px 16px 88px; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.h { font-size: 13px; color: var(--muted); font-weight: 600; }
.primary, .ghost, .danger, .icon-btn {
  border: 1px solid transparent; border-radius: 8px; padding: 10px 12px; min-height: 40px;
}
.primary { background: var(--accent); color: #fff; }
.ghost { background: var(--card); color: var(--ink); border-color: var(--line); }
.danger { background: #fff; color: var(--danger); border-color: #f0b4b0; }
.icon-btn { width: 40px; padding: 0; display: inline-flex; align-items: center; justify-content: center; background: var(--card); border-color: var(--line); }
.list { display: grid; gap: 10px; }
.item-row { display: flex; align-items: flex-start; gap: 10px; }
.item-row .item { flex: 1; min-width: 0; }
.pick { width: 22px; height: 22px; margin-top: 16px; flex: 0 0 22px; }
.item {
  background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 14px;
}
.item h3 { margin: 0 0 6px; font-size: 16px; }
.meta { color: var(--muted); font-size: 13px; }
.pill { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.pill.authorized { background: #d1fadf; color: var(--ok); }
.pill.expiring { background: #feefc7; color: var(--warn); }
.pill.expired, .pill.unauthorized, .pill.cookie_invalid { background: #fee4e2; color: var(--danger); }
.hint-bad { margin-top: 8px; color: var(--danger); font-size: 13px; font-weight: 600; }
.hint-wait { margin-top: 8px; color: var(--muted); font-size: 13px; font-weight: 600; }
.bar { height: 6px; background: #ece8df; border-radius: 99px; overflow: hidden; margin-top: 10px; }
.bar > span { display: block; height: 100%; background: var(--accent); }
.bar.warn > span { background: var(--warn); }
.bar.bad > span { background: var(--danger); }
.empty { padding: 36px 8px; text-align: center; color: var(--muted); }
.fab {
  position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%);
  width: min(398px, calc(100% - 32px));
}
.fab .ghost { width: 100%; margin-bottom: 8px; }
a.ghost, a.primary {
  display: inline-flex; align-items: center; justify-content: center;
  text-decoration: none; box-sizing: border-box;
}
#btnSwitchXiaomi { width: 100%; margin-top: 10px; }
.overlay {
  position: fixed; inset: 0; background: rgba(23,23,23,.46); display: none; align-items: flex-end; justify-content: center;
}
.overlay.show { display: flex; }
.sheet {
  width: min(430px, 100%); background: var(--bg); border-radius: 12px 12px 0 0; padding: 16px 16px 24px;
}
.qrbox {
  width: 280px; height: 280px; margin: 12px auto; background: #fff; border: 1px solid var(--line); border-radius: 8px;
  display: flex; align-items: center; justify-content: center; overflow: hidden;
}
.qrbox img, .qrbox canvas {
  width: 280px; height: 280px;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}
.status { text-align: center; color: var(--muted); min-height: 24px; }
.hidden { display: none !important; }
.actions { display: flex; gap: 8px; margin-top: 12px; }
.actions > * { flex: 1; }
.log {
  white-space: pre-wrap; background: #111; color: #d6d3d1; border-radius: 8px; padding: 12px; font-size: 12px; max-height: 220px; overflow: auto;
}

.hint { text-align: center; color: #0f766e; font-size: 14px; margin-top: 4px; }
.qrbox img { -webkit-touch-callout: default; pointer-events: auto; }
.wallet {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  background: var(--card); border: 1px solid var(--line); border-radius: 8px;
  padding: 12px 14px; margin-bottom: 14px;
}
.wallet .brand { font-size: 22px; }

.top-actions { display: flex; align-items: center; gap: 8px; }
.field-label { display: block; margin: 12px 0 6px; font-size: 13px; color: var(--muted); font-weight: 600; }
.field {
  width: 100%; border: 1px solid var(--line); border-radius: 8px; background: #fff;
  padding: 10px 12px; min-height: 40px; color: var(--ink);
}
.code-row { display: flex; gap: 8px; align-items: stretch; }
.code-row .field { flex: 1; }
.code-row .ghost { flex: 0 0 112px; white-space: nowrap; }
.captcha-img {
  flex: 0 0 168px; height: 44px; border: 1px solid var(--line); border-radius: 8px;
  background: #fff; cursor: pointer; object-fit: cover;
}
#loginHint { text-align: left; min-height: 20px; margin-top: 8px; }

.vip-box {
  margin: 14px 0 8px;
  display: flex;
  gap: 10px;
}
.vip-stat {
  flex: 1;
  background: #f4f1ea;
  border-radius: 8px;
  padding: 10px 12px;
}
.vip-stat .n {
  font-size: 22px;
  font-weight: 700;
  color: var(--accent-ink);
  line-height: 1.2;
}
.vip-stat .l {
  font-size: 12px;
  color: var(--muted);
  margin-top: 4px;
}
.chip-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 12px;
}
.chip {
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--card);
  color: var(--ink);
}
.chip.on {
  border-color: var(--accent);
  background: #d1fadf;
  color: var(--accent-ink);
  font-weight: 700;
}
.pay-link {
  display: block;
  text-align: center;
  text-decoration: none;
  width: 100%;
  margin-top: 12px;
}
#payRemark, #rechargeNote {
  margin-top: 10px;
  word-break: break-all;
}
#rechargeStatus { margin: 8px 0; }

#rechargeChannels { margin-bottom: 4px; }

#rechargeChannels { margin: 0 0 8px; }
#rechargeChannels .chip { font-weight: 700; }
#authTabs { grid-template-columns: 1fr 1fr 1fr; margin: 0 0 12px; }

.overlay.center { align-items: center; justify-content: center; padding: 16px; }
.dialog { width: min(320px, 100%); background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 22px 16px 16px; }
.dialog-text { text-align: center; font-size: 15px; line-height: 1.5; }
.dialog-actions { display: flex; gap: 8px; margin-top: 16px; }
.dialog-actions > * { flex: 1; }

.ledger-item { padding: 10px 0; border-bottom: 1px solid var(--line); }
.ledger-item .row { margin: 0; }
.ledger-item .amt { font-weight: 700; }
.ledger-item .amt.plus { color: var(--ok); }
.ledger-item .amt.minus { color: var(--danger); }
#giftHint { margin: -6px 0 10px; color: var(--accent); }

.auth-warn { font-size: 13px; color: var(--muted); margin: 0 0 12px; }
.auth-warn-count {
  display: inline;
  margin: 0;
  padding: 0;
  min-height: 0;
  border: 0;
  background: none;
  color: var(--danger);
  font-weight: 700;
  text-decoration: underline;
  cursor: pointer;
}
.search-row { display: flex; gap: 8px; align-items: stretch; margin-bottom: 12px; }
.search-row .field { flex: 1; width: auto; margin: 0; }
.search-row .icon-btn { flex: 0 0 40px; }
.dialog-text.list { white-space: pre-wrap; text-align: left; }

button.item { width: 100%; text-align: left; }
.vip-stat .n.gain { color: var(--ok); }
.page#detail .actions { flex-wrap: wrap; }