:root {
  --accent: #2a7a64;
  --accent-2: #2c5f86;
  --ink: #f3f4f6;
  --muted: #9aa3b2;
  --card: rgba(15, 20, 28, 0.86);
  --line: rgba(255, 255, 255, 0.12);
  --good: #3dce8a;
  --warn: #f5b942;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.45);
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  min-height: 100%;
  font-family: "Segoe UI", system-ui, sans-serif;
  color: var(--ink);
  background: #0c1016;
  -webkit-font-smoothing: antialiased;
}
.bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(900px 500px at 10% -10%, rgba(42, 122, 100, 0.22), transparent 55%),
    radial-gradient(800px 480px at 110% 0%, rgba(44, 95, 134, 0.28), transparent 50%),
    linear-gradient(180deg, #141a22 0%, #0c1016 55%, #090c10 100%);
}
.top, main { width: min(720px, calc(100% - 32px)); margin: 0 auto; }
.top { padding: 28px 0 4px; }
.eyebrow {
  margin: 0;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-size: 11px;
  color: var(--accent);
  font-weight: 700;
}
h1 { margin: 2px 0 0; font-size: 26px; letter-spacing: -0.03em; }
.lede { color: var(--muted); font-size: 16px; line-height: 1.5; margin: 16px 0 0; }

.steps {
  margin: 20px 0 0;
  padding: 16px 16px 16px 36px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  color: var(--ink);
  font-size: 15px;
  line-height: 1.45;
}
.steps li { margin: 8px 0; }
.steps li::marker { font-weight: 800; color: var(--accent); }

.label-hint { margin: 22px 0 8px; }
.fake-label {
  position: relative;
  background: #fff;
  color: #111;
  border-radius: 12px;
  padding: 14px 16px 28px;
  max-width: 360px;
  box-shadow: var(--shadow);
}
.fake-sku {
  margin: 0 0 8px;
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-weight: 700;
  color: #666;
}
.fake-bars {
  height: 56px;
  border-radius: 4px;
  background: repeating-linear-gradient(
    90deg,
    #111 0 3px,
    #111 3px 5px,
    transparent 5px 8px,
    #111 8px 10px,
    transparent 10px 12px,
    #111 12px 13px,
    transparent 13px 16px
  );
}
.fake-uid {
  margin: 10px 0 0;
  font-weight: 800;
  letter-spacing: 0.08em;
  font-size: 16px;
  text-align: center;
}
.fake-uid span { color: #2a7a64; }
.fake-arrow {
  position: absolute;
  right: 12px;
  bottom: 8px;
  font-size: 11px;
  font-weight: 700;
  color: var(--accent);
}

.search { margin: 18px 0 16px; }
.search label {
  display: block;
  font-size: 14px;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 8px;
}
.search-row { display: flex; gap: 8px; }
.search-field {
  flex: 1;
  position: relative;
  display: flex;
  align-items: center;
}
#q {
  width: 100%;
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.06);
  color: white;
  border-radius: 14px;
  padding: 16px;
  font: inherit;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0.08em;
  outline: none;
}
#q:focus { border-color: var(--accent); box-shadow: 0 0 0 4px rgba(42, 122, 100, 0.22); }
.scan-phone {
  width: 100%;
  margin-top: 10px;
  min-height: 52px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(42, 122, 100, 0.16);
  color: white;
  font: inherit;
  font-size: 16px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  cursor: pointer;
}
.scan-phone:hover, .scan-phone:focus { background: rgba(42, 122, 100, 0.28); }
#go {
  border: 0;
  border-radius: 14px;
  padding: 0 20px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: white;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  min-width: 132px;
}
#go:disabled { opacity: 0.55; cursor: wait; }
.search-tools {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 10px;
  flex-wrap: wrap;
}
.count { margin: 10px 0 0; color: var(--muted); font-size: 13px; font-weight: 600; }
.count.ready { color: var(--good); }

.facilities {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 16px;
}
.fac-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 18px;
  box-shadow: var(--shadow);
}
.fac-card p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.5; }
.fac-card .kind {
  margin: 0 0 8px;
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 700;
}
.fac-card b { color: white; font-weight: 700; display: block; margin-bottom: 6px; }
.producer {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}
.producer b { color: white; display: block; margin-bottom: 4px; }

.status, .card, .help, .fine, .hint {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 22px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}
.status { font-size: 15px; line-height: 1.5; }
.status.warn { border-color: rgba(245, 185, 66, 0.35); }
.status.err { border-color: rgba(196, 74, 74, 0.5); }
.status .help-actions { margin-top: 14px; }

.hint { font-size: 14px; color: var(--muted); line-height: 1.5; }
.hint summary, .fine summary {
  cursor: pointer;
  font-weight: 700;
  color: white;
  font-size: 14px;
}
.hint ul { padding-left: 18px; margin: 12px 0 0; }

.card-kicker {
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 700;
  margin: 0 0 6px;
}
.card h2 { margin: 0 0 4px; font-size: 22px; line-height: 1.2; }
.strain { color: var(--muted); margin: 0 0 16px; font-size: 14px; }
.pills { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 18px; }
.pill {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 600;
}
.pill.ok { border-color: rgba(61, 206, 138, 0.45); color: var(--good); }

.metrics { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 18px; }
@media (min-width: 520px) {
  .metrics { grid-template-columns: repeat(4, 1fr); }
}
.terps { margin: -6px 0 18px; }
.terps-label {
  margin: 0 0 8px;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 700;
}
.terps ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 6px;
}
.terps li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  background: rgba(255,255,255,0.04);
  border-radius: 10px;
  padding: 8px 12px;
  font-size: 14px;
}
.terps li span { color: var(--ink); }
.terps li b { font-weight: 700; }
.metric {
  background: rgba(255,255,255,0.04);
  border-radius: 14px;
  padding: 12px 10px;
  text-align: center;
}
.metric b { display: block; font-size: 22px; letter-spacing: -0.03em; }
.metric span { color: var(--muted); font-size: 11px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; }

.coa {
  display: block;
  text-align: center;
  text-decoration: none;
  color: white;
  font-weight: 800;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border-radius: 16px;
  padding: 16px;
  font-size: 17px;
}
.coa small { display: block; font-weight: 600; font-size: 12px; opacity: 0.85; margin-top: 4px; }
.meta { color: var(--muted); font-size: 13px; margin: 14px 0 0; line-height: 1.5; }
.again {
  display: inline-block;
  margin-top: 12px;
  color: white;
  font-size: 13px;
  font-weight: 700;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
  text-decoration: underline;
}

.help-kicker {
  margin: 12px 0 2px;
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 700;
}
.help-kicker:first-child { margin-top: 0; }
.help-line {
  display: block;
  color: white;
  font-weight: 700;
  font-size: 16px;
  text-decoration: none;
  word-break: break-word;
}
.help-actions {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}

.fine { font-size: 12px; color: var(--muted); line-height: 1.5; }
.fine ul { padding-left: 18px; margin: 10px 0; }
.lic { margin-top: 14px; font-size: 13px; color: var(--muted); line-height: 1.55; }
.lic b { color: white; font-weight: 600; }
.age { color: var(--accent); font-weight: 700; }

.scanner {
  position: fixed;
  inset: 0;
  background: rgba(7, 5, 11, 0.92);
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.scanner[hidden] { display: none; }
.scanner-frame {
  width: min(420px, 100%);
  text-align: center;
}
#reader {
  width: 100%;
  min-height: 240px;
  border-radius: 16px;
  overflow: hidden;
  background: #000;
}
#reader video { width: 100% !important; border-radius: 16px; }
.scanner p { color: var(--muted); font-weight: 600; }
.scanner button {
  border: 0;
  border-radius: 999px;
  padding: 12px 22px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

@media (max-width: 560px) {
  .search-row { flex-direction: column; }
  #go { min-height: 54px; font-size: 16px; }
  .metrics { grid-template-columns: 1fr 1fr; }
  h1 { font-size: 24px; }
  .facilities { grid-template-columns: 1fr; }
  .help-actions { grid-template-columns: 1fr; }
}
