:root {
  --bg: #f4f5f7;
  --card: #ffffff;
  --text: #1a1d23;
  --muted: #6b7280;
  --accent: #2454a0;
  --accent-hover: #1c3f7d;
  --accent-soft: #eaf1fb;
  --border: #e2e5ea;
  --ok: #1f8a4c;
  --ok-soft: #e7f6ec;
  --warn: #b6790a;
  --warn-soft: #fdf1de;
  --bad: #c0362c;
  --bad-soft: #fbe9e7;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.04), 0 2px 6px rgba(16, 24, 40, 0.06);
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  padding: 16px;
  padding-bottom: 60px;
  max-width: 480px;
  margin: 0 auto;
}
h1 { font-size: 1.3rem; margin: 0 0 4px; letter-spacing: -0.01em; font-weight: 700; }
h2 { font-size: 1.05rem; margin: 4px 0 12px; color: var(--accent); font-weight: 600; }
p.sub { color: var(--muted); font-size: 0.9rem; margin-top: 0; }
label { display: block; font-size: 0.85rem; color: var(--muted); margin: 12px 0 4px; font-weight: 500; }
input, select, textarea {
  width: 100%;
  background: #fff;
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 1rem;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
textarea { min-height: 80px; resize: vertical; }
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}
button, .btn {
  display: block;
  width: 100%;
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  border: none;
  border-radius: 10px;
  padding: 14px 18px;
  font-size: 1rem;
  text-align: center;
  cursor: pointer;
  margin-top: 10px;
  text-decoration: none;
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.08);
  transition: background 0.15s ease;
}
button:hover, .btn:hover { background: var(--accent-hover); }
button.secondary, .btn.secondary {
  background: #fff;
  border: 1px solid var(--border);
  color: var(--text);
  box-shadow: none;
}
button.secondary:hover, .btn.secondary:hover { background: var(--bg); }
button:disabled { opacity: 0.5; cursor: not-allowed; }
.topbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; gap: 8px; }
.topbar a {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--text);
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: none;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 9px 16px;
  box-shadow: var(--shadow);
}
.topbar a:active { background: var(--bg); }
.topbar span { min-width: 1px; }
.intakeRow {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 0; border-bottom: 1px solid var(--border); cursor: pointer;
}
.intakeRow:last-child { border-bottom: none; }
.intakeRow .meta { font-size: 0.8rem; color: var(--muted); }
.badge {
  font-size: 0.7rem; padding: 3px 8px; border-radius: 999px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.03em;
}
.badge.sampling { background: #eef0f3; color: #374151; }
.badge.awaiting_lab, .badge.awaiting_visual, .badge.awaiting_signoff { background: var(--warn-soft); color: var(--warn); }
.badge.signed_off { background: var(--ok-soft); color: var(--ok); }
video, canvas.scanFeed { width: 100%; border-radius: 10px; border: 1px solid var(--border); }
.photoThumbs { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.photoThumbs img { width: 70px; height: 70px; object-fit: cover; border-radius: 6px; border: 1px solid var(--border); }
.status-ok { color: var(--ok); }
.status-warn { color: var(--warn); }
.status-bad { color: var(--bad); }
.hint { font-size: 0.85rem; color: var(--muted); }
.stepPill { display: inline-block; font-size: 0.7rem; color: var(--muted); background: #fff; border: 1px solid var(--border); border-radius: 999px; padding: 3px 10px; margin-bottom: 8px; }
.reportSection { margin-bottom: 18px; }
.reportSection h3 { color: var(--accent); font-size: 0.95rem; margin: 0 0 6px; }
.kv { display: grid; grid-template-columns: 110px 1fr; gap: 4px 8px; font-size: 0.9rem; }
.kv div:nth-child(odd) { color: var(--muted); }
#toast {
  position: fixed; bottom: 16px; left: 16px; right: 16px; max-width: 448px; margin: 0 auto;
  background: var(--bad); color: #fff; padding: 12px 14px; border-radius: 10px; font-size: 0.9rem;
  box-shadow: var(--shadow);
  display: none; z-index: 999;
}
