:root {
  --bg: #f3f5f7;
  --card: #ffffff;
  --text: #172033;
  --muted: #667085;
  --line: #e6e9ee;
  --primary: #e6452e;
  --primary-dark: #c73622;
  --accent: #1677ff;
  --ink: #101828;
  --ok: #07865f;
  --warn: #b35a00;
  --fail: #b42318;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
  background: #dfe4ea;
  color: var(--text);
}

button,
input,
select {
  font: inherit;
}

button {
  border: 0;
  border-radius: 999px;
  background: #eef1f5;
  color: var(--text);
  min-height: 40px;
  padding: 0 16px;
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

button.primary,
.primary {
  background: var(--primary);
  color: #fff;
}

button.primary:hover,
.primary:hover {
  background: var(--primary-dark);
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  max-width: 320px;
  font-size: 28px;
  line-height: 1.16;
  letter-spacing: 0;
}

h2 {
  font-size: 19px;
  letter-spacing: 0;
}

h3 {
  font-size: 16px;
  line-height: 1.35;
  letter-spacing: 0;
}

p {
  color: var(--muted);
  line-height: 1.55;
}

.app-shell {
  width: min(100%, 430px);
  min-height: 100vh;
  margin: 0 auto;
  background: var(--bg);
  position: relative;
  padding-bottom: 78px;
  box-shadow: 0 0 0 1px rgba(16, 24, 40, 0.08);
}

.hero {
  padding: 18px 18px 20px;
  color: #fff;
  background:
    linear-gradient(145deg, rgba(230, 69, 46, 0.96), rgba(22, 119, 255, 0.9)),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='430' height='290' viewBox='0 0 430 290'%3E%3Cg fill='none' stroke='rgba(255,255,255,.22)' stroke-width='1'%3E%3Cpath d='M-20 232 C74 160 150 260 240 164 S374 120 450 188'/%3E%3Cpath d='M-28 116 C82 38 156 182 252 94 S366 48 456 90'/%3E%3Cpath d='M22 278 C106 214 178 238 230 204 300 158 346 160 430 222'/%3E%3C/g%3E%3C/svg%3E");
  background-size: cover;
  border-bottom-left-radius: 26px;
  border-bottom-right-radius: 26px;
}

.status-row,
.hero-actions,
.section-head,
.coupon-title,
.wallet-row,
.activity-card,
.actions {
  display: flex;
  align-items: center;
}

.status-row {
  justify-content: space-between;
  margin-bottom: 22px;
  font-weight: 700;
}

.ghost-btn {
  min-height: 32px;
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.35);
}

.hero-main {
  display: grid;
  gap: 12px;
}

.hero-main p,
.hero .eyebrow {
  color: rgba(255, 255, 255, 0.82);
}

.hero-actions {
  gap: 10px;
  margin-top: 2px;
}

.hero-actions button:not(.primary) {
  background: rgba(255, 255, 255, 0.92);
}

.eyebrow {
  color: var(--primary);
  font-size: 13px;
  font-weight: 700;
}

.activity-card {
  justify-content: space-between;
  gap: 16px;
  margin-top: 18px;
  padding: 14px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.16);
  border: 1px solid rgba(255, 255, 255, 0.26);
  backdrop-filter: blur(8px);
}

.activity-card h2 {
  margin-top: 6px;
  color: #fff;
}

.activity-card p {
  margin-top: 4px;
  color: rgba(255, 255, 255, 0.82);
  font-size: 13px;
}

.card-stat {
  flex: 0 0 72px;
  min-height: 72px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  text-align: center;
  background: rgba(255, 255, 255, 0.18);
}

.card-stat span {
  color: rgba(255, 255, 255, 0.76);
  font-size: 12px;
}

.card-stat strong {
  font-size: 18px;
}

main {
  padding: 14px;
}

.tab-view {
  display: none;
}

.tab-view.active {
  display: block;
}

.quick-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 9px;
  margin-top: -2px;
}

.quick-item {
  min-height: 76px;
  padding: 10px 6px;
  border-radius: 16px;
  background: var(--card);
  display: grid;
  gap: 4px;
  place-items: center;
  box-shadow: 0 8px 18px rgba(16, 24, 40, 0.06);
}

.quick-item span {
  color: var(--muted);
  font-size: 13px;
}

.quick-item strong {
  color: var(--ink);
  font-size: 15px;
}

.section {
  margin-top: 16px;
}

.section-head {
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.section-head span,
.text-link {
  color: var(--muted);
  font-size: 13px;
}

.text-link {
  text-decoration: none;
}

.feature-card,
.coupon-card,
.wallet-card,
.route-card,
.form-card,
.empty-card,
.metric {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: 0 8px 18px rgba(16, 24, 40, 0.05);
}

.feature-card {
  min-height: 128px;
  padding: 16px;
  display: grid;
  gap: 14px;
  background:
    linear-gradient(130deg, rgba(255, 246, 242, 0.98), rgba(239, 247, 255, 0.98)),
    linear-gradient(90deg, #fff, #fff);
}

.feature-card h3 {
  margin-top: 6px;
  max-width: 260px;
}

.feature-card button {
  justify-self: start;
}

.coupon-list,
.route-list {
  display: grid;
  gap: 10px;
}

.coupon-card {
  display: grid;
  grid-template-columns: 102px 1fr;
  overflow: hidden;
}

.coupon-value {
  min-height: 126px;
  padding: 14px 10px;
  display: grid;
  place-items: center;
  text-align: center;
  background: #fff4f1;
  border-right: 1px dashed #ffc7ba;
}

.coupon-value strong {
  color: var(--primary);
  font-size: 30px;
  line-height: 1;
}

.coupon-value span,
.coupon-info p,
.wallet-card p,
.route-card p {
  color: var(--muted);
  font-size: 13px;
}

.coupon-info {
  min-width: 0;
  padding: 14px;
  display: grid;
  gap: 10px;
}

.coupon-title {
  justify-content: space-between;
  gap: 10px;
}

.coupon-title h3 {
  min-width: 0;
}

.pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  background: #eef6ff;
  color: var(--accent);
  font-size: 12px;
  white-space: nowrap;
}

.pill.used,
.pill.failed {
  background: #fff1f0;
  color: var(--fail);
}

.pill.locked {
  background: #fff7e8;
  color: var(--warn);
}

.wallet-card,
.route-card,
.form-card,
.empty-card {
  padding: 14px;
}

.wallet-card p {
  margin-top: 8px;
}

code {
  word-break: break-all;
}

.wallet-row {
  justify-content: space-between;
  gap: 12px;
  margin-top: 12px;
}

.wallet-row strong {
  color: var(--primary);
}

.muted-card {
  opacity: 0.72;
}

.route-card {
  display: grid;
  grid-template-columns: 40px 1fr;
  gap: 12px;
}

.route-index {
  width: 36px;
  height: 36px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: #fff4f1;
  color: var(--primary);
  font-weight: 800;
}

.route-card.done .route-index {
  background: #ecfdf3;
  color: var(--ok);
}

.route-card button {
  margin-top: 12px;
}

label {
  display: block;
  margin: 12px 0 6px;
  color: var(--muted);
  font-size: 13px;
}

input,
select {
  width: 100%;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  padding: 0 12px;
  color: var(--text);
}

.actions {
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 14px;
}

.result {
  min-height: 110px;
  margin: 14px 0 0;
  padding: 12px;
  border-radius: 12px;
  overflow: auto;
  white-space: pre-wrap;
  background: #111827;
  color: #d1fae5;
  font-size: 12px;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.metric {
  padding: 13px;
}

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

.metric strong {
  display: block;
  margin-top: 5px;
  font-size: 22px;
}

.table-wrap {
  overflow: auto;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: #fff;
}

table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
}

th,
td {
  padding: 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  font-size: 13px;
}

th {
  color: var(--muted);
  background: #f8fafc;
  font-weight: 700;
}

.bottom-nav {
  position: fixed;
  left: 50%;
  bottom: 0;
  width: min(100%, 430px);
  transform: translateX(-50%);
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0;
  padding: 8px 8px calc(8px + env(safe-area-inset-bottom));
  background: rgba(255, 255, 255, 0.96);
  border-top: 1px solid var(--line);
  backdrop-filter: blur(12px);
}

.bottom-nav button {
  min-height: 44px;
  border-radius: 12px;
  background: transparent;
  color: var(--muted);
  padding: 0;
  font-size: 13px;
}

.bottom-nav button.active {
  background: #fff4f1;
  color: var(--primary);
  font-weight: 800;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 86px;
  transform: translateX(-50%);
  max-width: min(360px, calc(100% - 40px));
  padding: 10px 14px;
  border-radius: 999px;
  background: rgba(16, 24, 40, 0.92);
  color: #fff;
  font-size: 14px;
  z-index: 20;
}

@media (min-width: 800px) {
  body {
    padding: 24px 0;
  }

  .app-shell {
    min-height: calc(100vh - 48px);
    border-radius: 28px;
    overflow: hidden;
  }

  .bottom-nav {
    border-bottom-left-radius: 28px;
    border-bottom-right-radius: 28px;
  }
}
