:root {
  --bg: #f1f5f9;
  --card: #ffffff;
  --ink: #0f172a;
  --muted: #64748b;
  --line: #e2e8f0;
  --brand: #2563eb;
  --brand-dark: #1d4ed8;
  --ok: #15803d;
  --err: #b91c1c;
  --radius: 16px;
}

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

html, body { margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.5 -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
        "Microsoft YaHei", system-ui, sans-serif;
  padding-bottom: calc(24px + env(safe-area-inset-bottom));
}

.top {
  background: linear-gradient(135deg, #0f172a, #1e3a8a);
  color: #fff;
  padding: calc(20px + env(safe-area-inset-top)) 20px 22px;
}

.top h1 { margin: 0; font-size: 20px; font-weight: 600; letter-spacing: .5px; }
.top .sub { margin: 6px 0 0; font-size: 13px; color: #cbd5e1; }

main { padding: 16px; display: grid; gap: 14px; }

.card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 18px 16px;
  box-shadow: 0 1px 2px rgb(15 23 42 / 6%), 0 8px 24px rgb(15 23 42 / 5%);
}

.card h2 { margin: 0 0 10px; font-size: 15px; font-weight: 600; color: var(--muted); }

.field { display: block; margin-bottom: 16px; position: relative; }
.label { display: block; font-size: 13px; font-weight: 600; color: var(--muted); margin-bottom: 8px; }

select, input[type="text"] {
  width: 100%;
  height: 52px;
  padding: 0 44px 0 14px;
  font-size: 16px;                 /* 16px 才不会触发 iOS 自动放大 */
  color: var(--ink);
  background: #f8fafc;
  border: 1.5px solid var(--line);
  border-radius: 12px;
  appearance: none;
  outline: none;
}

select:focus, input[type="text"]:focus {
  border-color: var(--brand);
  background: #fff;
  box-shadow: 0 0 0 3px rgb(37 99 235 / 12%);
}

.field--select::after {
  content: "▾";
  position: absolute;
  right: 16px;
  bottom: 16px;
  color: var(--muted);
  pointer-events: none;
  font-size: 14px;
}

.combo { position: relative; }

.clear {
  position: absolute;
  top: 10px; right: 8px;
  width: 32px; height: 32px;
  border: 0; border-radius: 50%;
  background: #e2e8f0;
  color: #475569;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}

.list {
  position: absolute;
  left: 0; right: 0; top: 58px;
  margin: 0; padding: 4px;
  list-style: none;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 12px 28px rgb(15 23 42 / 14%);
  max-height: 46vh;
  overflow-y: auto;
  z-index: 20;
}

.list li {
  padding: 12px 12px;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: baseline;
}

.list li[aria-selected="true"], .list li:hover { background: #eff6ff; }
.list .code { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.list .empty { color: var(--muted); font-size: 14px; cursor: default; }

.hint { margin: 8px 0 0; font-size: 12px; color: var(--muted); }
.hint.selected { color: var(--ok); font-weight: 600; }

.submit {
  width: 100%;
  height: 56px;
  margin-top: 4px;
  border: 0;
  border-radius: 14px;
  background: var(--brand);
  color: #fff;
  font-size: 17px;
  font-weight: 600;
  letter-spacing: 1px;
  cursor: pointer;
  transition: background .15s, transform .05s;
}

.submit:active:not(:disabled) { transform: scale(.99); background: var(--brand-dark); }
.submit:disabled { background: #cbd5e1; color: #f8fafc; cursor: not-allowed; }

.result { min-height: 22px; margin: 12px 2px 0; font-size: 14px; line-height: 1.45; }
.result.ok { color: var(--ok); }
.result.err { color: var(--err); }

.recent { margin: 0; padding: 0; list-style: none; display: grid; gap: 2px; }

.recent li {
  display: flex;
  gap: 10px;
  align-items: baseline;
  padding: 9px 2px;
  border-bottom: 1px solid #f1f5f9;
  font-size: 14px;
}

.recent li:last-child { border-bottom: 0; }
.recent time { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.recent .wh { color: var(--brand); font-size: 12px; white-space: nowrap; }
.recent .muted { color: var(--muted); justify-content: center; }
