body.mobile { background: #EDEDED; }

.app {
  max-width: 430px;
  margin: 0 auto;
  min-height: 100vh;
  background: var(--bg);
  position: relative;
  padding-bottom: 40px;
}
.app.has-tabbar { padding-bottom: 86px; }
.app.has-footerbar { padding-bottom: 104px; }

.topbar {
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 18px;
  background: var(--bg);
  position: sticky;
  top: 0;
  z-index: 50;
}
.topbar .back {
  width: 32px; height: 32px; margin-left: -6px;
  display: flex; align-items: center; justify-content: center;
  color: var(--ink-2); font-size: 20px;
}
.topbar h1 { font-size: 16px; font-weight: 600; margin: 0; }
.topbar .spacer { width: 32px; }

.page { padding: 4px 16px 24px; }
.page-tight { padding: 0 16px 24px; }

.section-title { font-size: 13px; color: var(--ink-2); margin: 22px 2px 10px; }

/* ---------------- merchant home ---------------- */
.merchant-head { padding: 10px 18px 18px; }
.merchant-head .name { font-size: 22px; font-weight: 600; letter-spacing: .2px; }
.status-dot {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; color: var(--green); margin-top: 6px;
}
.status-dot::before {
  content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--green);
}
.status-dot.orange { color: var(--accent); }
.status-dot.orange::before { background: var(--accent); }
.status-dot.grey { color: var(--ink-3); }
.status-dot.grey::before { background: var(--ink-3); }

.stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.stat-card {
  background: #fff; border-radius: 12px; padding: 16px 12px 14px;
  text-align: center; box-shadow: var(--shadow);
}
.stat-card .label { font-size: 11px; color: var(--ink-3); margin-bottom: 6px; white-space: nowrap; }
.stat-card .num { font-size: 24px; font-weight: 600; color: var(--ink); line-height: 1.2; }
.stat-card .num.accent { color: var(--accent); }

.action-stack { display: flex; flex-direction: column; gap: 10px; margin-top: 22px; }
.action-stack .btn { height: 48px; border-radius: 12px; font-size: 15px; }

.notice-card {
  background: var(--accent-soft); color: var(--accent);
  border-radius: 12px; padding: 12px 14px; font-size: 13px; line-height: 1.6;
  margin-bottom: 14px;
}
.notice-card.neutral { background: #fff; color: var(--ink-2); }

/* ---------------- tabbar ---------------- */
.tabbar {
  position: fixed; bottom: 0; left: 50%; transform: translateX(-50%);
  width: 100%; max-width: 430px; height: 64px;
  background: rgba(255,255,255,.97);
  border-top: 1px solid var(--line);
  display: flex; z-index: 100;
  padding-bottom: env(safe-area-inset-bottom);
  backdrop-filter: blur(8px);
}
.tabbar a {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 3px; color: var(--ink-3); font-size: 11px;
}
.tabbar a svg { width: 22px; height: 22px; stroke-width: 1.6; }
.tabbar a.active { color: var(--accent); }

/* ---------------- consumer claim ---------------- */
.cover {
  width: 100%; aspect-ratio: 16 / 9; border-radius: 12px; overflow: hidden;
  background: #ECE7E3; position: relative;
}
.cover img { width: 100%; height: 100%; object-fit: cover; }
.cover .cover-fallback {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  color: #B7ADA6; font-size: 30px; font-weight: 600; letter-spacing: 2px;
}
.claim-head { margin-top: 16px; }
.claim-head .m-name { font-size: 18px; font-weight: 600; }
.claim-head .distance { font-size: 12px; color: var(--ink-2); margin-top: 4px; }
.claim-head .distance .locate { color: var(--accent); }

.coupon-face {
  display: flex; align-items: baseline; gap: 10px; margin-top: 20px;
}
.coupon-face .amount {
  font-size: 42px; font-weight: 700; color: var(--accent); line-height: 1;
  letter-spacing: -1px;
}
.coupon-face .amount small { font-size: 22px; font-weight: 600; margin-right: 2px; }
.coupon-face .threshold { font-size: 14px; color: var(--ink-2); }
.coupon-name { font-size: 14px; color: var(--ink); margin-top: 10px; }

.rules-card {
  background: #fff; border-radius: var(--radius); padding: 18px; margin-top: 18px;
  box-shadow: var(--shadow);
}
.rules-card .rule {
  font-size: 13px; color: var(--ink-2); line-height: 1.6;
  padding: 6px 0; display: flex; gap: 8px;
}
.rules-card .rule::before {
  content: ""; width: 4px; height: 4px; border-radius: 50%;
  background: #D8D2CD; margin-top: 8px; flex: 0 0 auto;
}

.privacy-line {
  margin: 20px 2px 0;
}
.footerbar {
  position: fixed; bottom: 0; left: 50%; transform: translateX(-50%);
  width: 100%; max-width: 430px; padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  background: rgba(245,245,245,.97); backdrop-filter: blur(8px);
  display: flex; gap: 10px; align-items: center; z-index: 90;
}
.footerbar .btn { flex: 1; }
.footerbar .share-link {
  font-size: 13px; color: var(--ink-2); padding: 0 8px; white-space: nowrap;
  text-align: center; line-height: 1.3;
}

.success-note {
  display: flex; align-items: center; gap: 8px; justify-content: center;
  color: var(--ink-2); font-size: 13px; margin-top: 12px;
}

/* ---------------- wallet ---------------- */
.segmented {
  display: flex; background: #ECECEC; border-radius: 10px; padding: 3px; margin: 8px 0 16px;
}
.segmented button {
  flex: 1; border: 0; background: transparent; color: var(--ink-2);
  height: 36px; border-radius: 8px; font-size: 13px;
}
.segmented button.active { background: #fff; color: var(--ink); font-weight: 600; box-shadow: 0 1px 4px rgba(0,0,0,.06); }

.coupon-card {
  display: flex; gap: 12px; background: #fff; border-radius: 14px;
  padding: 14px; margin-bottom: 12px; box-shadow: var(--shadow);
  align-items: stretch;
}
.coupon-card .thumb {
  width: 72px; height: 72px; border-radius: 10px; overflow: hidden; flex: 0 0 auto;
  background: var(--accent-soft); display: flex; align-items: center; justify-content: center;
  color: var(--accent); font-size: 20px; font-weight: 600;
}
.coupon-card .thumb img { width: 100%; height: 100%; object-fit: cover; }
.coupon-card .info { flex: 1; min-width: 0; }
.coupon-card .face { color: var(--accent); font-size: 19px; font-weight: 700; }
.coupon-card .face small { font-size: 12px; font-weight: 500; }
.coupon-card .m-name { font-size: 14px; margin-top: 2px; }
.coupon-card .validity { font-size: 12px; color: var(--ink-3); margin-top: 6px; }
.coupon-card .warn { font-size: 12px; color: var(--accent); margin-top: 3px; }
.coupon-card .side {
  display: flex; flex-direction: column; align-items: flex-end; justify-content: center;
  font-size: 12px; color: var(--ink-3); gap: 4px; white-space: nowrap;
}
.coupon-card.dim { opacity: .62; filter: saturate(.55); }

/* ---------------- QR display ---------------- */
.qr-page {
  min-height: 100vh; background: #fff; display: flex; flex-direction: column;
  align-items: center; padding: 26px 24px 40px;
}
.qr-page .face { font-size: 32px; font-weight: 700; color: var(--accent); }
.qr-page .face small { font-size: 18px; }
.qr-page .c-name { font-size: 16px; color: var(--ink); margin-top: 4px; }
#main { width: 100%; display: flex; flex-direction: column; align-items: center; }
.qr-card {
  margin-top: 26px; width: 100%; max-width: 320px; background: #fff;
  border: 1px solid var(--line); border-radius: 16px; padding: 18px;
  display: flex; flex-direction: column; align-items: center;
}
.qr-card img { width: 100%; max-width: 260px; aspect-ratio: 1; image-rendering: pixelated; }
.qr-tip { font-size: 12px; color: var(--ink-3); margin-top: 20px; text-align: center; }
.qr-code-text {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 20px; letter-spacing: 4px; color: var(--ink); margin-top: 16px;
  font-variant-numeric: tabular-nums;
}
.qr-footer { margin-top: 26px; padding-top: 20px; font-size: 12px; color: var(--ink-3); text-align: center; width: 100%; }
.qr-state { text-align: center; padding: 60px 20px; }
.check-circle {
  width: 74px; height: 74px; border-radius: 50%; background: var(--green-soft);
  color: var(--green); display: flex; align-items: center; justify-content: center;
  margin: 0 auto 18px; font-size: 36px;
}

/* ---------------- scan ---------------- */
.scan-shell { background: #1C1C1C; min-height: 100vh; color: #fff; }
.scan-top {
  position: relative; height: 50vh; min-height: 320px; background: #111;
  display: flex; align-items: center; justify-content: center; overflow: hidden;
}
.scan-top video, .scan-top canvas { width: 100%; height: 100%; object-fit: cover; }
.scan-frame {
  position: absolute; width: 62vw; max-width: 260px; aspect-ratio: 1;
  box-shadow: 0 0 0 200vmax rgba(0,0,0,.42); border-radius: 6px;
}
.scan-frame span { position: absolute; width: 26px; height: 26px; border-color: var(--accent); border-style: solid; }
.scan-frame span:nth-child(1) { top: -1px; left: -1px; border-width: 2px 0 0 2px; }
.scan-frame span:nth-child(2) { top: -1px; right: -1px; border-width: 2px 2px 0 0; }
.scan-frame span:nth-child(3) { bottom: -1px; left: -1px; border-width: 0 0 2px 2px; }
.scan-frame span:nth-child(4) { bottom: -1px; right: -1px; border-width: 0 2px 2px 0; }
.scan-hint {
  position: absolute; bottom: 20px; left: 0; right: 0; text-align: center;
  font-size: 13px; color: rgba(255,255,255,.72);
}
.scan-bottom { background: #fff; color: var(--ink); border-radius: 18px 18px 0 0; margin-top: -18px; position: relative; padding: 22px 20px 30px; min-height: 48vh; }
.scan-bottom .manual-link {
  display: block; text-align: center; font-size: 13px; color: var(--ink-2);
  margin-top: 22px; background: none; border: 0; width: 100%;
}
.confirm-card { background: #fff; border-radius: 16px; padding: 20px; margin: 16px; box-shadow: var(--shadow); }
.code-last4 { font-family: Consolas, monospace; letter-spacing: 2px; }
.fee-preview { background: #FAFAFA; border-radius: 10px; padding: 12px 14px; font-size: 13px; color: var(--ink-2); margin-top: 4px; }
.fee-preview b { color: var(--ink); }
.scan-success { text-align: center; padding: 46px 20px; background: #fff; border-radius: 16px; margin: 16px; }

/* ---------------- misc forms ---------------- */
.upload-box {
  border: 1px dashed var(--line-strong); border-radius: 12px; background: #fff;
  min-height: 110px; display: flex; align-items: center; justify-content: center;
  color: var(--ink-3); font-size: 13px; overflow: hidden; position: relative;
}
.upload-box img { width: 100%; height: 100%; object-fit: cover; position: absolute; inset: 0; }
.upload-box input { position: absolute; inset: 0; opacity: 0; }

.list-row {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 14px 0; border-bottom: 1px solid var(--line);
}
.list-row:last-child { border-bottom: 0; }
.list-row .main { min-width: 0; }
.list-row .title { font-size: 14px; }
.list-row .sub { font-size: 12px; color: var(--ink-3); margin-top: 4px; }
.list-row .value { font-size: 14px; font-weight: 500; white-space: nowrap; }

.records-tabs { display: flex; gap: 8px; margin: 8px 0 14px; }
.records-tabs button {
  border: 1px solid var(--line-strong); background: #fff; color: var(--ink-2);
  border-radius: 8px; height: 32px; padding: 0 12px; font-size: 12px;
}
.records-tabs button.active { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }

.balance-hero { text-align: center; padding: 30px 20px 24px; }
.balance-hero .label { font-size: 13px; color: var(--ink-2); }
.balance-hero .amount { font-size: 40px; font-weight: 700; margin-top: 6px; letter-spacing: -1px; }
.balance-hero .amount small { font-size: 20px; }
.balance-hero .hint { font-size: 12px; color: var(--ink-3); margin-top: 8px; }

.login-wrap { padding: 48px 26px 30px; }
.brand { font-size: 24px; font-weight: 600; letter-spacing: .5px; }
.brand-sub { font-size: 13px; color: var(--ink-3); margin-top: 6px; }
.login-form { margin-top: 34px; }
.dev-note {
  margin-top: 18px; background: var(--accent-soft); color: #A85A3A;
  font-size: 12px; padding: 10px 12px; border-radius: 10px; line-height: 1.6;
}
