@font-face { font-family: Inter; src: url(/fonts/Inter-Regular.ttf); font-weight: 400; }
@font-face { font-family: Inter; src: url(/fonts/Inter-Medium.ttf); font-weight: 500; }
@font-face { font-family: Inter; src: url(/fonts/Inter-SemiBold.ttf); font-weight: 600; }

:root {
  --paper: #EEEBE3;
  --card: #FFFFFF;
  --ink: #00198B;
  --ink-soft: rgba(0, 25, 139, 0.78);
  --ink-mute: rgba(0, 25, 139, 0.58);
  --ink-faint: rgba(0, 25, 139, 0.18);
  --sky: #4FA8FF;
  --radius: 18px;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--paper); color: var(--ink); }
body { font: 400 17px/1.45 Inter, -apple-system, system-ui, sans-serif; -webkit-font-smoothing: antialiased; }
main { max-width: 640px; margin: 0 auto; padding: 24px 16px 64px; }
main.wide { max-width: 1180px; }
h1 { font-weight: 600; font-size: 32px; line-height: 1.12; letter-spacing: -0.02em; margin: 6px 0 14px; }
h2 { font-weight: 600; font-size: 17px; margin: 28px 0 10px; }
p { margin: 0 0 12px; }
.eyebrow { font-weight: 500; font-size: 15px; color: var(--ink-mute); margin: 0; }
.lede { color: var(--ink-soft); font-size: 18px; }
.fine { font-size: 13px; color: var(--ink-mute); }
.card { background: var(--card); border-radius: var(--radius); padding: 20px; box-shadow: 0 1px 2px rgba(0,25,139,.06), 0 8px 24px rgba(0,25,139,.06); margin-bottom: 16px; }
.rule { border: 0; border-top: 1px solid var(--ink-faint); margin: 16px 0; }

label { display: block; font-weight: 500; font-size: 14px; margin: 14px 0 6px; color: var(--ink-soft); }
input[type=text], input[type=email], input[type=number], input[type=password], select {
  width: 100%; font: inherit; color: var(--ink); background: var(--paper); border: 1px solid transparent;
  border-radius: 12px; padding: 14px 14px; outline: none; -webkit-appearance: none;
}
input:focus, select:focus { border-color: var(--ink); background: #fff; }
.row { display: flex; gap: 10px; }
.row > * { flex: 1; min-width: 0; }
.check { display: flex; gap: 12px; align-items: flex-start; padding: 12px 0; border-top: 1px solid var(--ink-faint); font-size: 15px; color: var(--ink-soft); }
.check:first-of-type { border-top: 0; }
.check input { width: 24px; height: 24px; flex: none; accent-color: var(--ink); margin: 1px 0 0; }

.button, button {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font: 600 17px Inter, sans-serif;
  background: var(--ink); color: #fff; border: 0; border-radius: 999px; padding: 16px 22px;
  text-decoration: none; cursor: pointer; min-height: 52px; -webkit-tap-highlight-color: transparent;
}
.button.block, button.block { width: 100%; margin-top: 16px; }
.button.ghost, button.ghost { background: transparent; color: var(--ink); box-shadow: inset 0 0 0 1.5px var(--ink); }
button.small, .button.small { min-height: 36px; padding: 8px 14px; font-size: 14px; white-space: nowrap; }
.row > .small { flex: none; }
button:disabled { opacity: .4; cursor: default; }
button.danger { background: transparent; color: var(--ink); box-shadow: inset 0 0 0 1.5px var(--ink-mute); }

.seg { display: flex; background: var(--paper); border-radius: 999px; padding: 4px; gap: 4px; }
.seg button { flex: 1; background: transparent; color: var(--ink); min-height: 40px; padding: 8px 10px; font-size: 15px; font-weight: 500; }
.seg button.on { background: var(--ink); color: #fff; }

.error { color: var(--ink); font-weight: 500; font-size: 15px; margin-top: 12px; min-height: 1em; }
/* One blue, a sky dot for anything that needs a look (no red anywhere). */
.flag::before, .error:not(:empty)::before, .watch.stale .id::after { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--sky); margin-right: 7px; vertical-align: middle; }
.watch.stale .id::after { margin: 0 0 0 8px; }
.pill { display: inline-block; font: 500 13px Inter; padding: 4px 10px; border-radius: 999px; background: var(--paper); color: var(--ink); }
.pill.ready, .pill.printed { background: var(--ink); color: #fff; }
.pill.failed, .pill.needs_rerun { background: transparent; color: var(--ink); box-shadow: inset 0 0 0 1.5px var(--ink); }
.pill.analyzing, .pill.queued, .pill.uploading { background: #E3ECFF; }
.muted { color: var(--ink-mute); }

#sig { width: 100%; height: 150px; background: var(--paper); border-radius: 12px; touch-action: none; display: block; }

/* the report page behind the QR */
body.report main { padding-top: 40px; }
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 18px 0; }
.tile { background: var(--card); border-radius: 16px; padding: 14px; }
.tlabel { font-weight: 500; font-size: 14px; color: var(--ink-mute); }
.tval { font-weight: 600; font-size: 30px; letter-spacing: -0.02em; }
.tval span { font-weight: 500; font-size: 14px; margin-left: 4px; letter-spacing: 0; color: var(--ink-mute); }
.obs { padding-left: 18px; }
.obs li { margin-bottom: 10px; }
body.report .button { width: 100%; margin-top: 10px; }

/* capture */
.stage { position: relative; background: #000; border-radius: var(--radius); overflow: hidden; aspect-ratio: 16 / 9; }
.stage video { width: 100%; height: 100%; object-fit: cover; display: block; }
.stage .hud { position: absolute; left: 12px; top: 12px; right: 12px; display: flex; justify-content: space-between; color: #fff; font-weight: 600; font-size: 14px; text-shadow: 0 1px 3px rgba(0,0,0,.6); }
.stage .guide { position: absolute; inset: 0; pointer-events: none; }
.stage .guide::before { content: ""; position: absolute; left: 0; right: 0; bottom: 18%; border-top: 1px dashed rgba(255,255,255,.45); }
.rec-dot { display: inline-block; width: 10px; height: 10px; background: #ff3b30; border-radius: 50%; margin-right: 6px; animation: blink 1s infinite; }
@keyframes blink { 50% { opacity: .2; } }
.record { width: 88px; height: 88px; border-radius: 50%; background: #ff3b30; box-shadow: 0 0 0 6px #fff, 0 0 0 8px var(--ink-faint); min-height: 0; padding: 0; font-size: 13px; }
.record.stop { border-radius: 22px; }
.list { display: flex; flex-direction: column; }
.list .item { display: flex; align-items: center; gap: 12px; padding: 12px 4px; border-top: 1px solid var(--ink-faint); cursor: pointer; }
.list .item:first-child { border-top: 0; }
.list .item.on { background: #E3ECFF; border-radius: 12px; }
.code { font: 500 14px Inter, sans-serif; font-variant-numeric: tabular-nums; color: var(--ink-mute); }
#done-code { font: 600 64px/1.1 Inter, sans-serif; letter-spacing: 0.04em; color: var(--ink); margin-top: 6px; }
.grow { flex: 1; min-width: 0; }
.bar { height: 6px; background: var(--paper); border-radius: 3px; overflow: hidden; margin-top: 6px; }
.bar > div { height: 100%; background: var(--ink); transition: width .3s; }

table { width: 100%; border-collapse: collapse; font-size: 15px; }
th { text-align: left; font: 500 13px Inter; color: var(--ink-mute); padding: 8px 6px; }
td { padding: 10px 6px; border-top: 1px solid var(--ink-faint); vertical-align: middle; }
td .actions { display: flex; gap: 6px; flex-wrap: wrap; }
.watches { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.watch { background: var(--paper); border-radius: 14px; padding: 12px; }
.watch .id { font-weight: 600; font-size: 28px; }
.watch.stale { box-shadow: inset 0 0 0 1.5px var(--sky); }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 12px 18px; border-radius: 999px; font-weight: 500; font-size: 15px; z-index: 10; }
@media (max-width: 520px) { h1 { font-size: 28px; } .tval { font-size: 26px; } }

/* The hidden attribute must win over display rules (.row is a grid). */
[hidden] { display: none !important; }
