:root {
  --bg: #f4f1ea;
  --card: #ffffff;
  --ink: #22302b;
  --muted: #7b8a84;
  --line: #e7e2d8;
  --green: #2f5d50;
  --green-deep: #24463c;
  --green-light: #4a8571;
  --gold: #c9a45c;
  --gold-soft: #f3e8d2;
  --danger: #c4553f;
  --shadow: 0 10px 30px rgba(36, 70, 60, .10);
  --shadow-lg: 0 18px 46px rgba(36, 70, 60, .14);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", sans-serif;
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
}

body { max-width: 520px; margin: 0 auto; min-height: 100vh; }

.hidden { display: none !important; }

/* ================= 登录 ================= */
.login {
  min-height: 100vh;
  padding: 26px 20px 18px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  background:
    radial-gradient(120% 60% at 20% 0%, rgba(74, 133, 113, .55), transparent 60%),
    radial-gradient(100% 50% at 90% 10%, rgba(201, 164, 92, .35), transparent 55%),
    linear-gradient(165deg, #24463c 0%, #356455 55%, #2b5246 100%);
}

.login-card {
  background: rgba(255, 255, 255, .97);
  border-radius: 22px;
  padding: 30px 26px 24px;
  box-shadow: 0 24px 60px rgba(12, 30, 24, .32);
  animation: rise .5s cubic-bezier(.2, .8, .3, 1) both;
}

.brand-badge {
  width: 74px; height: 74px;
  margin: 0 auto 14px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 8px 22px rgba(36, 70, 60, .18), inset 0 0 0 3px rgba(201, 164, 92, .35);
  display: flex; align-items: center; justify-content: center;
}
.brand-badge img { width: 56px; height: 56px; object-fit: contain; }

.login-card h1 {
  margin: 0;
  text-align: center;
  font-size: 22px;
  letter-spacing: 3px;
  color: var(--green-deep);
  font-weight: 700;
}
.login-card .sub {
  margin: 8px 0 26px;
  text-align: center;
  color: var(--muted);
  font-size: 12.5px;
  letter-spacing: 1px;
}

.login-card label {
  display: block;
  margin: 14px 0 7px;
  font-size: 13px;
  color: var(--muted);
  padding-left: 2px;
}

.login-card input {
  width: 100%;
  padding: 13px 15px;
  border: 1px solid var(--line);
  border-radius: 12px;
  font-size: 16px;
  letter-spacing: 1px;
  background: #fbfaf7;
  color: var(--ink);
  outline: none;
  transition: border-color .18s, box-shadow .18s;
}
.login-card input:focus {
  border-color: var(--green-light);
  box-shadow: 0 0 0 3px rgba(74, 133, 113, .14);
  background: #fff;
}
.login-card input::placeholder { color: #b6bdb9; font-size: 14px; letter-spacing: 0; }

.btn {
  display: block;
  width: 100%;
  border: 0;
  border-radius: 13px;
  padding: 14px;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 1px;
  cursor: pointer;
  transition: transform .12s, box-shadow .2s, opacity .2s;
}
.btn.primary {
  margin-top: 22px;
  color: #fff;
  background: linear-gradient(120deg, var(--green) 0%, var(--green-light) 100%);
  box-shadow: 0 12px 26px rgba(47, 93, 80, .28);
}
.btn.primary:active { transform: scale(.985); }
.btn:disabled { opacity: .6; }

.login-card .hint {
  margin: 16px 0 0;
  text-align: center;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.6;
}
.login-foot {
  margin: 22px 0 0;
  text-align: center;
  font-size: 11px;
  color: rgba(255, 255, 255, .55);
  letter-spacing: .5px;
}

/* ================= 主界面 ================= */
.app {
  padding-bottom: 84px;
  animation: fade .4s ease both;
}

.hero {
  position: relative;
  padding: 18px 16px 0;
  background:
    radial-gradient(120% 70% at 15% 0%, rgba(201, 164, 92, .28), transparent 55%),
    linear-gradient(160deg, var(--green-deep) 0%, #356455 60%, #2b5246 100%);
  border-radius: 0 0 28px 28px;
  color: #fff;
}

.hero-top { display: flex; align-items: center; gap: 12px; }
.hero-logo {
  width: 42px; height: 42px;
  border-radius: 50%;
  object-fit: contain;
  background: rgba(255, 255, 255, .92);
  padding: 5px;
  box-shadow: 0 6px 16px rgba(0, 0, 0, .18);
}
.hero-text { display: flex; flex-direction: column; line-height: 1.35; }
.hero-text b { font-size: 17px; letter-spacing: 2px; }
.hero-text span { font-size: 11.5px; color: rgba(255, 255, 255, .72); letter-spacing: .5px; }

.hero-exit {
  margin-left: auto;
  border: 1px solid rgba(255, 255, 255, .35);
  background: rgba(255, 255, 255, .12);
  color: rgba(255, 255, 255, .9);
  font-size: 12px;
  padding: 6px 12px;
  border-radius: 999px;
  cursor: pointer;
  backdrop-filter: blur(4px);
}

.who {
  margin: 16px 0 0 2px;
  font-size: 13.5px;
  color: rgba(255, 255, 255, .82);
  letter-spacing: .5px;
}
.who b { color: #fff; font-weight: 600; }

/* 余额卡：跟在头部内容后面，底部用力下探，盖住 hero 下沿形成悬浮感 */
.balance-card {
  position: relative;
  margin: 16px 0 -46px;
  background: var(--card);
  border-radius: 20px;
  padding: 20px 20px 16px;
  box-shadow: var(--shadow-lg);
}
.bc-label {
  font-size: 11.5px;
  letter-spacing: 2px;
  color: var(--muted);
}
.bc-amount {
  margin: 6px 0 4px;
  display: flex;
  align-items: baseline;
  gap: 4px;
  color: var(--green-deep);
}
.bc-amount i {
  font-style: normal;
  font-size: 19px;
  font-weight: 600;
  color: var(--gold);
}
.bc-amount span {
  font-size: 34px;
  font-weight: 700;
  letter-spacing: .5px;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}
.bc-split {
  display: flex;
  align-items: center;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px dashed var(--line);
}
.bc-split > div {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.bc-split em {
  font-style: normal;
  font-size: 17px;
  font-weight: 600;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.bc-split span { font-size: 11.5px; color: var(--muted); }
.bc-divider {
  flex: 0 0 1px !important;
  width: 1px; height: 26px;
  background: var(--line);
  margin: 0 16px;
}

/* 三个小统计 */
.quick-stats {
  display: flex;
  gap: 10px;
  margin: 56px 16px 7px;
}
.qs {
  flex: 1;
  background: var(--card);
  border-radius: 14px;
  padding: 12px 8px;
  text-align: center;
  box-shadow: 0 6px 18px rgba(36, 70, 60, .06);
}
.qs em {
  display: block;
  font-style: normal;
  font-size: 17px;
  font-weight: 700;
  color: var(--green);
  font-variant-numeric: tabular-nums;
}
.qs span { font-size: 11px; color: var(--muted); }

/* 区块标题 */
.sec-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 22px 20px 10px;
}
.sec-head h2 {
  margin: 0;
  font-size: 15px;
  letter-spacing: 1px;
  color: var(--ink);
  font-weight: 600;
}
.sec-head h2::before {
  content: '';
  display: inline-block;
  width: 3px; height: 13px;
  border-radius: 2px;
  background: linear-gradient(180deg, var(--gold), var(--green-light));
  margin-right: 8px;
  vertical-align: 1px;
}
.sec-head .link {
  margin-left: auto;
  border: 0;
  background: none;
  color: var(--muted);
  font-size: 12.5px;
  cursor: pointer;
  padding: 4px;
}
.sec-note { margin-left: auto; font-size: 12px; color: var(--muted); }

/* ========== 卡券 ========== */
.cards-row {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding: 2px 16px 10px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.cards-row::-webkit-scrollbar { display: none; }

.cards-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  padding: 2px 16px 10px;
}

.ticket {
  position: relative;
  flex: 0 0 78%;
  border-radius: 16px;
  padding: 16px 16px 14px;
  color: #fff;
  overflow: hidden;
  box-shadow: 0 12px 26px rgba(36, 70, 60, .18);
  background: linear-gradient(135deg, #2f5d50, #4a8571);
}
.cards-list .ticket { flex: none; }

.ticket::after {
  content: '';
  position: absolute;
  right: -30px; top: -34px;
  width: 100px; height: 100px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .10);
}

.ticket.gold { background: linear-gradient(135deg, #a9762f, #d2a862); }
.ticket.blue { background: linear-gradient(135deg, #33586c, #5d8fa5); }
.ticket.rose { background: linear-gradient(135deg, #8d4a4a, #b4746a); }

.t-title {
  font-size: 13.5px;
  font-weight: 600;
  letter-spacing: .3px;
  position: relative;
  z-index: 1;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 18px;
  padding-right: 6px;
}
.t-remain {
  margin-top: 10px;
  display: flex;
  align-items: baseline;
  gap: 4px;
  position: relative;
  z-index: 1;
}
.t-remain b {
  font-size: 26px;
  font-weight: 700;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.t-remain span { font-size: 12px; color: rgba(255, 255, 255, .8); }

.t-foot {
  margin-top: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
  color: rgba(255, 255, 255, .78);
  position: relative;
  z-index: 1;
  letter-spacing: .3px;
}
.t-badge {
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .18);
  color: #fff;
  font-size: 10.5px;
}
.t-badge.warn { background: rgba(255, 236, 200, .28); color: #ffecd0; }

.cards-empty, .records-empty {
  margin: 6px 16px;
  padding: 26px 18px;
  background: var(--card);
  border-radius: 16px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.8;
  box-shadow: 0 6px 18px rgba(36, 70, 60, .05);
}
/* 在横向卡片容器里时撑满整行 */
.cards-empty { flex: 0 0 100%; width: 100%; margin: 0; }

/* 卡券 / 记录页：收起余额卡与统计，给内容腾出空间 */
.app.compact .balance-card,
.app.compact .quick-stats { display: none; }
.app.compact .hero { padding-bottom: 18px; }

/* ========== 记录 ========== */
.records { padding: 0 16px; }

.r-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 15px;
  background: var(--card);
  border-radius: 14px;
  margin-bottom: 9px;
  box-shadow: 0 5px 16px rgba(36, 70, 60, .05);
  animation: rise .35s ease both;
}
.r-ico {
  flex: 0 0 38px;
  width: 38px; height: 38px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 15px;
  font-weight: 700;
  background: var(--gold-soft);
  color: #a47a33;
}
.r-ico.card { background: rgba(74, 133, 113, .14); color: var(--green); }
.r-ico.recharge { background: rgba(201, 164, 92, .18); color: #a9762f; }

.r-main { flex: 1; min-width: 0; }
.r-title {
  font-size: 14.5px;
  font-weight: 600;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.r-sub {
  margin-top: 4px;
  font-size: 11.5px;
  color: var(--muted);
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.r-sub .tag {
  color: #a47a33;
  background: var(--gold-soft);
  border-radius: 6px;
  padding: 1px 6px;
}
.r-sub .revoked { color: var(--danger); }

.r-amt {
  text-align: right;
  font-variant-numeric: tabular-nums;
  flex: 0 0 auto;
}
.r-amt b { font-size: 16px; font-weight: 700; color: var(--ink); }
.r-amt span { display: block; font-size: 11px; color: var(--muted); margin-top: 3px; }
.r-amt.out b { color: var(--green); }
.r-amt.in b { color: #a9762f; }
.r-amt.off { opacity: .55; text-decoration: line-through; }

/* 分段控件 */
.seg {
  margin-left: auto;
  display: flex;
  background: #eae5db;
  border-radius: 999px;
  padding: 3px;
}
.seg-btn {
  border: 0;
  background: none;
  padding: 6px 13px;
  border-radius: 999px;
  font-size: 12.5px;
  color: var(--muted);
  cursor: pointer;
  transition: background .18s, color .18s;
}
.seg-btn.active {
  background: #fff;
  color: var(--green-deep);
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(36, 70, 60, .10);
}

/* 底部导航 */
.tabbar {
  position: fixed;
  left: 0; right: 0;
  bottom: 0;
  max-width: 520px;
  margin: 0 auto;
  display: flex;
  background: rgba(255, 255, 255, .94);
  backdrop-filter: blur(12px);
  border-top: 1px solid var(--line);
  padding: 7px 0 calc(7px + env(safe-area-inset-bottom));
  z-index: 20;
}
.tab {
  flex: 1;
  border: 0;
  background: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 4px 0;
  color: var(--muted);
  font-size: 11.5px;
  cursor: pointer;
  transition: color .18s;
}
.tab .tab-ico { font-size: 17px; line-height: 1; }
.tab.active { color: var(--green); font-weight: 600; }
.tab.active .tab-ico { color: var(--gold); }

/* toast */
.toast {
  position: fixed;
  left: 50%;
  bottom: 96px;
  transform: translateX(-50%);
  background: rgba(34, 48, 43, .92);
  color: #fff;
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 13px;
  max-width: 84vw;
  text-align: center;
  z-index: 40;
  box-shadow: 0 10px 26px rgba(0, 0, 0, .22);
  animation: toastIn .22s ease both;
}
.toast.err { background: rgba(160, 60, 45, .95); }

@keyframes rise {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}
@keyframes fade {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes toastIn {
  from { opacity: 0; transform: translate(-50%, 8px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

/* 桌面端：居中显示，像一台手机 */
@media (min-width: 600px) {
  body {
    box-shadow: 0 0 0 1px rgba(36, 70, 60, .08), 0 30px 70px rgba(36, 70, 60, .12);
    min-height: 100vh;
  }
}

/* 概览底部的文字入口 */
.foot-actions {
  padding: 4px 16px 96px;
  text-align: center;
}
.foot-link {
  border: 0;
  background: none;
  color: var(--muted);
  font-size: 12.5px;
  padding: 8px 14px;
  border-radius: 999px;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-color: rgba(123, 138, 132, .45);
}

/* ========== 修改查询码弹层 ========== */
.sheet {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.sheet-mask {
  position: absolute;
  inset: 0;
  background: rgba(20, 35, 30, .48);
  backdrop-filter: blur(2px);
  animation: fade .2s ease both;
}
.sheet-card {
  position: relative;
  width: 100%;
  max-width: 520px;
  background: var(--card);
  border-radius: 22px 22px 0 0;
  padding: 22px 20px calc(20px + env(safe-area-inset-bottom));
  box-shadow: 0 -10px 40px rgba(20, 40, 32, .22);
  animation: sheetUp .26s cubic-bezier(.2, .8, .3, 1) both;
}
.sheet-card::before {
  content: '';
  display: block;
  width: 38px;
  height: 4px;
  border-radius: 999px;
  background: var(--line);
  margin: -6px auto 14px;
}
.sheet-card h3 {
  margin: 0;
  font-size: 18px;
  color: var(--green-deep);
  letter-spacing: .5px;
}
.sheet-tip {
  margin: 10px 0 4px;
  font-size: 13px;
  line-height: 1.75;
  color: var(--muted);
}
.sheet-card label {
  display: block;
  margin: 16px 0 7px;
  font-size: 12.5px;
  color: var(--muted);
}
.sheet-card input {
  width: 100%;
  border: 1px solid var(--line);
  background: #faf8f4;
  border-radius: 12px;
  padding: 13px 14px;
  font-size: 16px;
  letter-spacing: 2px;
  color: var(--ink);
  outline: none;
  transition: border-color .18s, box-shadow .18s;
}
.sheet-card input:focus {
  border-color: var(--green-light);
  box-shadow: 0 0 0 3px rgba(74, 133, 113, .12);
}
.sheet-card .btn { width: 100%; margin-top: 16px; }
.btn.ghost {
  background: none;
  border: 0;
  color: var(--muted);
  font-size: 13px;
  padding: 12px 0 4px;
  box-shadow: none;
}

@keyframes sheetUp {
  from { opacity: 0; transform: translateY(24px); }
  to { opacity: 1; transform: none; }
}
