:root {
  --primary: #1663d8;
  --primary-dark: #0e4eb2;
  --bg: #eef3fa;
  --card: #ffffff;
  --text: #1c2733;
  --muted: #6b7a8c;
  --line: #dde6f1;
  --ok: #15803d;
  --warn: #b45309;
  --err: #b91c1c;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  padding-bottom: 64px;
  -webkit-tap-highlight-color: transparent;
}

.app-header {
  position: sticky; top: 0; z-index: 10;
  background: linear-gradient(135deg, #1663d8, #1e88f0);
  color: #fff;
  padding: 14px 16px;
  box-shadow: 0 2px 8px rgba(15, 60, 140, .25);
}
.brand { display: flex; align-items: center; gap: 12px; max-width: 720px; margin: 0 auto; }
.logo {
  width: 42px; height: 42px; border-radius: 10px;
  background: rgba(255,255,255,.18);
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; font-weight: 700;
  border: 1px solid rgba(255,255,255,.35);
}
.brand h1 { font-size: 18px; line-height: 1.25; }
.env-badge { font-size: 12px; opacity: .9; margin-top: 2px; }

main { max-width: 720px; margin: 0 auto; padding: 14px 12px 132px; }
.view { animation: fade .18s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; } }

.card {
  background: var(--card);
  border-radius: 14px;
  padding: 18px 16px;
  margin-bottom: 14px;
  box-shadow: 0 1px 4px rgba(20, 50, 90, .08);
  border: 1px solid var(--line);
}
.card h2 { font-size: 19px; margin-bottom: 6px; }
.card h3 { font-size: 15px; margin: 14px 0 6px; }
.muted { color: var(--muted); font-size: 13px; line-height: 1.55; margin-bottom: 10px; }
.card p, .card li { font-size: 13.5px; line-height: 1.65; color: #33404f; }
.card ul { padding-left: 18px; margin: 8px 0; }
.card li { margin-bottom: 4px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  border: none; border-radius: 10px;
  font-size: 15px; font-weight: 600;
  padding: 12px 18px; cursor: pointer;
  transition: transform .06s ease, opacity .15s ease;
  touch-action: manipulation;
}
.btn:active { transform: scale(.97); }
.btn-lg { width: 100%; padding: 15px; font-size: 16px; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-ghost { background: #eef2f8; color: var(--text); }
.btn + .btn { margin-top: 8px; }
.card form .btn { margin-bottom: 8px; }
button[type="submit"] { scroll-margin-bottom: 96px; }

.status-box {
  margin-top: 14px; padding: 12px 14px;
  border-radius: 10px; font-size: 14px; line-height: 1.55;
}
.status-box.info { background: #eaf3ff; color: #0e4eb2; }
.status-box.ok { background: #e8f7ee; color: var(--ok); }
.status-box.warn { background: #fdf3e3; color: var(--warn); }
.status-box.err { background: #fdeaea; color: var(--err); }

.nfc-result { margin-top: 12px; }
.kv { display: flex; justify-content: space-between; gap: 10px; padding: 7px 0; border-bottom: 1px dashed var(--line); font-size: 14px; }
.kv:last-child { border-bottom: none; }
.kv .k { color: var(--muted); flex-shrink: 0; }
.kv .v { text-align: right; word-break: break-all; font-weight: 500; }

.warn { border-left: 4px solid var(--warn); }
.field { margin-bottom: 12px; }
.field-row { display: flex; gap: 10px; }
.field-row .field { flex: 1; }
label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 5px; font-weight: 500; }
.req { color: var(--err); }
input, textarea {
  width: 100%; padding: 11px 12px;
  border: 1px solid var(--line); border-radius: 10px;
  font-size: 15px; background: #fbfdff; color: var(--text);
  outline: none;
}
input:focus, textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(22,99,216,.12); }
input[readonly] { background: #f1f5fa; color: #4a5868; }
textarea { resize: vertical; font-family: inherit; }
.hint { font-size: 12px; margin-top: 4px; min-height: 16px; }
.hint.ok { color: var(--ok); }
.hint.err { color: var(--err); }
.checkbox { display: flex; align-items: center; gap: 6px; color: var(--text); font-weight: 400; }
.checkbox input { width: auto; }

.photo-preview { width: 96px; height: 120px; object-fit: cover; border-radius: 8px; margin-top: 8px; border: 1px solid var(--line); }

.result-meta { font-size: 13px; color: var(--muted); margin-bottom: 10px; }
.result-body { margin-top: 8px; }
.result-photo {
  width: 108px; height: 136px; object-fit: cover;
  border-radius: 10px; border: 1px solid var(--line);
  margin-bottom: 12px; background: #f1f5fa;
}
.result-actions { margin-top: 16px; display: flex; gap: 10px; flex-wrap: wrap; }
.result-actions .btn { margin-top: 0; }

.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0;
  background: #fff; border-top: 1px solid var(--line);
  display: flex; justify-content: space-around;
  padding: 6px 0 calc(6px + env(safe-area-inset-bottom));
  z-index: 20;
}
.tab {
  flex: 1; text-align: center; text-decoration: none;
  color: var(--muted); font-size: 13px; font-weight: 600;
  padding: 8px 0; border-radius: 8px;
}
.tab.active { color: var(--primary); background: #eaf3ff; }

@media print {
  .app-header, .tabbar, .result-actions, .card.warn { display: none !important; }
  body { background: #fff; padding: 0; }
  .card { box-shadow: none; border: none; padding: 0; }
}
