:root {
  color-scheme: light;
  --brand: #18a86b;
  --brand-dark: #12885a;
  --text: #1c2126;
  --muted: #6a727b;
  --line: #e3e6e9;
  --bg: #f5f6f7;
  --card: #ffffff;
  --danger: #d64545;
  --bar-height: 76px;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.55 -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
  overflow-x: hidden;
}

.view {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  min-height: 100dvh;
  padding: calc(12px + env(safe-area-inset-top)) 16px calc(var(--bar-height) + 24px + env(safe-area-inset-bottom));
}

h1 { margin: 16px 0 4px; font-size: 26px; line-height: 1.25; }
h2 { margin: 0 0 8px; font-size: 16px; }
p { margin: 0 0 8px; }

.lead { color: var(--text); margin-bottom: 16px; }
.muted { color: var(--muted); font-size: 14px; }
.error { color: var(--danger); font-size: 14px; margin: 4px 0 0; }
.error.banner { background: #fdecec; border-radius: 8px; padding: 10px 12px; margin: 12px 0; font-size: 15px; }

.tabs { display: flex; gap: 8px; margin: 4px 0 8px; }
.tab { flex: 1; text-align: center; padding: 10px 0; border-radius: 8px; color: var(--muted); text-decoration: none; background: transparent; min-height: 44px; }
.tab.active { background: var(--card); color: var(--text); font-weight: 600; }

.back { display: inline-block; padding: 10px 0; min-height: 44px; color: var(--muted); text-decoration: none; }

.card { background: var(--card); border-radius: 12px; padding: 14px 14px 6px; margin: 12px 0; }
.card.summary { padding-bottom: 10px; }

.field { margin: 0 0 12px; }
.field label { display: block; margin-bottom: 4px; font-size: 14px; color: var(--muted); }
.field.has-error input, .field.has-error textarea, .field.has-error .address-button { border-color: var(--danger); }

input, select, textarea, .address-button {
  width: 100%;
  min-height: 48px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  font: inherit;
  font-size: 16px; /* 16px stops iOS from zooming into the field */
  -webkit-appearance: none;
  appearance: none;
}

textarea { resize: none; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--brand); outline-offset: 0; }

.address-button { text-align: left; display: flex; flex-direction: column; gap: 2px; cursor: pointer; color: var(--muted); }
.address-button.filled { color: var(--text); }
.address-main { font-weight: 600; word-break: break-all; }
.address-sub { color: var(--muted); font-size: 14px; word-break: break-all; }

button { font: inherit; font-size: 16px; }
button.primary, .link-button.primary {
  display: block;
  width: 100%;
  min-height: 48px;
  border: 0;
  border-radius: 10px;
  background: var(--brand);
  color: #fff;
  font-weight: 600;
  text-align: center;
  text-decoration: none;
  line-height: 48px;
  padding: 0 16px;
}
button.primary:active { background: var(--brand-dark); }
button.secondary { min-height: 48px; width: 100%; margin: 10px 0; border: 1px solid var(--line); border-radius: 10px; background: #fff; color: var(--text); }
button.danger { display: block; width: 100%; min-height: 48px; border: 1px solid var(--danger); border-radius: 10px; background: #fff; color: var(--danger); font-weight: 600; }
button[disabled] { opacity: 0.55; }

.action-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 10;
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  background: rgba(255, 255, 255, 0.96);
  border-top: 1px solid var(--line);
}
.action-bar > * { max-width: 448px; margin: 0 auto; }

.row { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: 6px 0; }
.row .label { color: var(--muted); flex: none; }
.row .value { text-align: right; word-break: break-all; }
.value.fee { font-size: 20px; font-weight: 700; color: var(--text); }

.results, .orders { list-style: none; margin: 8px 0 0; padding: 0; }
.result { display: flex; flex-direction: column; gap: 2px; width: 100%; padding: 12px; margin: 0 0 8px; text-align: left; border: 1px solid var(--line); border-radius: 10px; background: #fff; min-height: 56px; }

.order-card { display: block; padding: 12px 14px; margin: 0 0 10px; border-radius: 12px; background: var(--card); color: inherit; text-decoration: none; }
.order-card .label { font-size: 14px; color: var(--muted); word-break: break-all; }
.badge { flex: none; padding: 2px 10px; border-radius: 999px; background: #e8f6ef; color: var(--brand-dark); font-size: 13px; }
.address-line { margin: 2px 0; font-size: 15px; word-break: break-all; }

.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-top: 1px solid var(--line); }
.timeline li:first-child { border-top: 0; }

.empty { text-align: center; padding: 48px 0; color: var(--muted); }
.empty .link-button { max-width: 200px; margin: 12px auto 0; }
.noscript { padding: 24px; text-align: center; }
