/* ==========================================================================
   LOUPE — design tokens
   Dark charcoal base, tuned warm-green accent used sparingly (typography
   and the terpene fingerprint carry the identity, not the color alone).
   ========================================================================== */
:root {
  /* Surfaces — near-black warm graphite, rising by small steps */
  --bg: #0d0f0e;
  --bg-raised: #151816;
  --bg-card: #1c201d;
  --bg-interactive: #242925;
  --line: #2c322d;
  --line-soft: #21251f;

  /* Text — warm off-white, not sterile */
  --text: #f2efe9;
  --text-dim: #9ca39c;
  --text-faint: #656d64;

  /* Accent — tuned warmer/more citrus than a stock acid-green, used narrowly */
  --accent: #c3e552;
  --accent-soft: rgba(195, 229, 82, 0.14);
  --accent-dim: #8fa83f;
  --accent-ink: #10140a; /* text-on-accent */

  /* Status */
  --danger: #e37559;
  --danger-soft: rgba(227, 117, 89, 0.14);
  --warn: #e0b355;
  --warn-soft: rgba(224, 179, 85, 0.14);

  /* Secondary terpene-family hues (used only in small contextual accents —
     product aura glow, fingerprint bars — never as UI chrome) */
  --hue-citrus: #e8b23f;
  --hue-berry: #b07de0;
  --hue-pine: #4f9e6e;
  --hue-floral: #c893c9;
  --hue-gas: #e0714f;
  --hue-mint: #5bc7bd;

  /* Radius */
  --r-sm: 8px;
  --r-md: 14px;
  --r-lg: 20px;
  --r-xl: 28px;
  --r-pill: 999px;

  /* Space */
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 24px;
  --sp-6: 32px;

  /* Motion */
  --dur-fast: 140ms;
  --dur-normal: 260ms;
  --dur-slow: 420ms;
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);

  /* Type */
  --font-display: "Manrope", "Segoe UI", system-ui, sans-serif;
  --font-body: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

@media (prefers-reduced-motion: reduce) {
  :root {
    --dur-fast: 0ms;
    --dur-normal: 0ms;
    --dur-slow: 0ms;
  }
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  -webkit-tap-highlight-color: transparent;
}

body {
  min-height: 100vh;
  padding-bottom: 96px;
  position: relative;
  overflow-x: hidden;
}

/* Faint drifting molecular-constellation motif, used only on quiet screens */
.constellation-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.5;
}

@media (prefers-reduced-motion: reduce) {
  .constellation-bg .drift { animation: none !important; }
}

@keyframes drift {
  0%, 100% { transform: translate(0, 0); }
  50% { transform: translate(6px, -8px); }
}

h1, h2, h3 { font-family: var(--font-display); margin: 0; }

button, input, textarea, select {
  font-family: inherit;
}

/* ---- Topbar ---- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--sp-4) var(--sp-4) var(--sp-3);
  background: linear-gradient(180deg, var(--bg) 75%, transparent);
}

.brand-mark {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.1rem;
  letter-spacing: -0.01em;
}

.brand-mark svg { flex-shrink: 0; }

.points-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  padding: 6px 12px 6px 8px;
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--accent);
}

main {
  max-width: 560px;
  margin: 0 auto;
  padding: 0 var(--sp-4);
  position: relative;
  z-index: 1;
}

.screen { display: none; }
.screen.active { display: block; }

/* ---- Login / signup ---- */
.login-wrap {
  min-height: 88vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: var(--sp-5);
  text-align: center;
  position: relative;
}

.login-wordmark {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.05rem;
  letter-spacing: 0.02em;
  color: var(--text-dim);
  text-transform: uppercase;
  margin-bottom: var(--sp-2);
}

.login-headline {
  font-family: var(--font-display);
  font-size: 2.1rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin: 0 0 var(--sp-5);
  line-height: 1.15;
}

.field { width: 100%; max-width: 340px; margin-bottom: var(--sp-3); text-align: left; }

.field label {
  display: block;
  font-size: 0.78rem;
  color: var(--text-dim);
  margin-bottom: 6px;
  font-weight: 600;
}

input[type="text"], input[type="email"], input[type="password"], input[type="number"], input[type="file"], textarea, select {
  width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  color: var(--text);
  padding: 14px 16px;
  font-size: 1rem;
  transition: border-color var(--dur-fast) var(--ease);
}

input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--accent);
}
input:focus-visible, textarea:focus-visible, select:focus-visible, button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.btn-primary {
  width: 100%;
  max-width: 340px;
  background: var(--accent);
  color: var(--accent-ink);
  border: none;
  border-radius: var(--r-md);
  padding: 15px;
  font-size: 1rem;
  font-weight: 800;
  letter-spacing: -0.01em;
  cursor: pointer;
  transition: transform var(--dur-fast) var(--ease), opacity var(--dur-fast) var(--ease);
}
.btn-primary:active { transform: scale(0.97); }
.btn-primary:disabled { opacity: 0.5; }

.btn-primary.danger {
  background: var(--danger);
  color: #1a0d09;
}

.btn-secondary {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--text-dim);
  border-radius: var(--r-md);
  padding: 11px 18px;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
}
.btn-secondary:active { transform: scale(0.97); }
.btn-secondary:disabled { opacity: 0.4; cursor: default; }
.btn-secondary:disabled:active { transform: none; }

.btn-ghost {
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 0.82rem;
  text-decoration: underline;
  cursor: pointer;
  padding: 0;
}

.hint { margin-top: var(--sp-4); font-size: 0.74rem; color: var(--text-faint); }
.error-msg { color: var(--danger); font-size: 0.85rem; margin-top: var(--sp-2); min-height: 1em; }

/* ---- Bottom navigation, elevated Scan control ---- */
.tabbar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 20;
  display: flex;
  align-items: flex-end;
  background: var(--bg-raised);
  border-top: 1px solid var(--line);
  padding: 8px 6px calc(8px + env(safe-area-inset-bottom));
}

.tab-btn {
  flex: 1;
  background: none;
  border: none;
  color: var(--text-faint);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 6px 2px 2px;
  font-size: 0.65rem;
  font-weight: 600;
}

.tab-btn.active { color: var(--accent); }
.tab-btn svg { width: 22px; height: 22px; }

.tab-scan {
  flex: 0 0 64px;
  margin: 0 4px;
  transform: translateY(-14px);
}

.tab-scan-btn {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--accent);
  border: 4px solid var(--bg-raised);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 6px 18px rgba(195, 229, 82, 0.28);
  cursor: pointer;
  transition: transform var(--dur-fast) var(--ease);
}
.tab-scan-btn:active { transform: scale(0.93); }
.tab-scan-btn svg { width: 26px; height: 26px; color: var(--accent-ink); }

/* ---- Home screen ---- */
.home-greeting { color: var(--text-dim); font-size: 0.85rem; margin: var(--sp-4) 0 2px; }
.home-name { font-family: var(--font-display); font-size: 1.9rem; font-weight: 800; letter-spacing: -0.02em; margin-bottom: var(--sp-4); }

.scan-hero {
  background: linear-gradient(160deg, var(--bg-card) 0%, var(--bg-interactive) 100%);
  border: 1px solid var(--line);
  border-radius: var(--r-xl);
  padding: var(--sp-6) var(--sp-5);
  text-align: center;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  margin-bottom: var(--sp-5);
}

.scan-hero::before {
  content: "";
  position: absolute;
  inset: -40%;
  background: radial-gradient(circle at 50% 30%, var(--accent-soft), transparent 60%);
  pointer-events: none;
}

.scan-hero-icon {
  width: 56px;
  height: 56px;
  margin: 0 auto var(--sp-3);
  border-radius: var(--r-lg);
  background: var(--accent-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}
.scan-hero-icon svg { width: 28px; height: 28px; color: var(--accent); }

.scan-hero h2 {
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -0.01em;
  margin-bottom: 4px;
  position: relative;
}
.scan-hero p { color: var(--text-dim); font-size: 0.88rem; margin: 0; position: relative; }

.stats-strip {
  display: flex;
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: var(--sp-4);
  margin-bottom: var(--sp-5);
}
.stats-strip .stat { flex: 1; text-align: center; }
.stats-strip .stat-num { font-family: var(--font-display); font-size: 1.5rem; font-weight: 800; letter-spacing: -0.02em; }
.stats-strip .stat-label { font-size: 0.68rem; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.04em; margin-top: 2px; }
.stats-strip .divider { width: 1px; background: var(--line); margin: 2px 0; }

.section-label {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin: var(--sp-5) 0 var(--sp-3);
}

.recent-strip {
  display: flex;
  gap: var(--sp-3);
  overflow-x: auto;
  padding-bottom: var(--sp-2);
  margin-bottom: var(--sp-2);
  scrollbar-width: none;
}
.recent-strip::-webkit-scrollbar { display: none; }

/* ---- Rounds (blind-review assignments) ---- */
.round-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  background: var(--bg-card);
  border: 1px solid var(--accent);
  border-radius: var(--r-lg);
  padding: var(--sp-4);
  margin-bottom: var(--sp-3);
}
.round-card .info .label { font-size: 0.68rem; color: var(--accent); text-transform: uppercase; letter-spacing: 0.05em; font-weight: 700; }
.round-card .info .name { font-weight: 700; font-size: 0.92rem; margin-top: 2px; }
.round-card .info .brand { font-size: 0.76rem; color: var(--text-dim); }
.round-card button { flex-shrink: 0; width: auto; padding: 9px 16px; font-size: 0.82rem; }

.round-banner {
  background: var(--accent-soft);
  border: 1px solid var(--accent);
  border-radius: var(--r-md);
  padding: 10px 14px;
  font-size: 0.78rem;
  color: var(--accent);
  font-weight: 700;
  margin-bottom: var(--sp-3);
}

.locked-reviews-msg {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-dim);
  font-size: 0.82rem;
  padding: var(--sp-3) 0;
}
.locked-reviews-msg svg { width: 16px; height: 16px; flex-shrink: 0; }

.batch-review-row {
  padding: 10px 0;
  border-bottom: 1px solid var(--line-soft);
}
.batch-review-row:last-child { border-bottom: none; }
.batch-review-row .top { display: flex; justify-content: space-between; font-size: 0.82rem; margin-bottom: 4px; }
.batch-review-row .who { font-weight: 700; }
.batch-review-row .stars { color: var(--accent); }
.batch-review-row .notes { font-size: 0.8rem; color: var(--text-dim); }

.recent-card {
  flex: 0 0 128px;
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  overflow: hidden;
  cursor: pointer;
}
.recent-card .thumb {
  width: 100%;
  height: 96px;
  background: var(--bg-interactive);
  object-fit: cover;
  display: block;
}
.recent-card .info { padding: 8px 10px 10px; }
.recent-card .name { font-size: 0.78rem; font-weight: 700; line-height: 1.2; margin-bottom: 2px; }
.recent-card .brand { font-size: 0.68rem; color: var(--text-dim); }
.recent-card .stars { color: var(--accent); font-size: 0.72rem; margin-top: 4px; }

.empty-state {
  text-align: center;
  padding: var(--sp-6) var(--sp-4);
  color: var(--text-dim);
}
.empty-state h3 { font-size: 1.05rem; color: var(--text); margin-bottom: 6px; }
.empty-state p { font-size: 0.85rem; margin: 0 0 var(--sp-4); }

/* ---- Cards / generic ---- */
.card {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: var(--sp-4);
  margin-bottom: var(--sp-3);
}

/* ---- Scanner overlay ---- */
.scanner-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: #000;
  display: none;
  flex-direction: column;
}
.scanner-overlay.active { display: flex; }

.scanner-camera-wrap { flex: 1; position: relative; overflow: hidden; }
#qr-reader { width: 100%; height: 100%; }
#qr-reader video { object-fit: cover; width: 100% !important; height: 100% !important; }

.scan-frame {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 240px;
  height: 240px;
  pointer-events: none;
}
.scan-frame .corner {
  position: absolute;
  width: 34px;
  height: 34px;
  border: 3px solid var(--accent);
  transition: all var(--dur-normal) var(--ease);
}
.scan-frame .corner.tl { top: 0; left: 0; border-right: none; border-bottom: none; border-radius: 8px 0 0 0; }
.scan-frame .corner.tr { top: 0; right: 0; border-left: none; border-bottom: none; border-radius: 0 8px 0 0; }
.scan-frame .corner.bl { bottom: 0; left: 0; border-right: none; border-top: none; border-radius: 0 0 0 8px; }
.scan-frame .corner.br { bottom: 0; right: 0; border-left: none; border-top: none; border-radius: 0 0 8px 0; }
.scan-frame.detecting .corner { width: 44px; height: 44px; }

.scan-frame.locked .corner {
  width: 44px;
  height: 44px;
  animation: scan-glow 1.1s ease-in-out infinite;
}
@keyframes scan-glow {
  0%, 100% { box-shadow: 0 0 0 rgba(195, 229, 82, 0); }
  50% { box-shadow: 0 0 14px 3px rgba(195, 229, 82, 0.65); }
}
@media (prefers-reduced-motion: reduce) {
  .scan-frame.locked .corner { animation: none; box-shadow: 0 0 10px 2px rgba(195, 229, 82, 0.6); }
}

.scanner-copy {
  position: absolute;
  top: 20%;
  left: 0;
  right: 0;
  text-align: center;
  color: #fff;
  padding: 0 var(--sp-5);
}
.scanner-copy h2 { font-size: 1.2rem; font-weight: 800; margin-bottom: 4px; }
.scanner-copy p { font-size: 0.82rem; color: rgba(255,255,255,0.7); margin: 0; }

.scanner-footer {
  padding: var(--sp-4) var(--sp-4) calc(var(--sp-5) + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--sp-3);
  background: linear-gradient(0deg, rgba(0,0,0,0.9), transparent);
  position: absolute;
  bottom: 0; left: 0; right: 0;
}
.scanner-close {
  position: absolute;
  top: calc(var(--sp-4) + env(safe-area-inset-top));
  right: var(--sp-4);
  width: 36px; height: 36px;
  border-radius: 50%;
  background: rgba(0,0,0,0.5);
  border: none;
  color: #fff;
  font-size: 1.3rem;
  display: flex; align-items: center; justify-content: center;
  z-index: 2;
}

/* ---- Product reveal ---- */
.product-reveal { animation: rise var(--dur-slow) var(--ease); }
@keyframes rise { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: translateY(0); } }

.product-hero {
  position: relative;
  height: 46vh;
  min-height: 260px;
  margin: 0 calc(-1 * var(--sp-4)) var(--sp-4);
  overflow: hidden;
  background: var(--bg-card);
}
.product-hero-glow {
  position: absolute;
  inset: -20%;
  background: radial-gradient(ellipse at 50% 40%, var(--glow, var(--accent-soft)), transparent 65%);
  z-index: 0;
}
.product-hero img {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.product-hero-nav {
  position: absolute;
  top: calc(var(--sp-3) + env(safe-area-inset-top));
  left: var(--sp-4);
  z-index: 2;
  width: 38px; height: 38px;
  border-radius: 50%;
  background: rgba(13,15,14,0.6);
  border: none;
  color: var(--text);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.2rem;
}
.product-hero-dots {
  position: absolute;
  bottom: var(--sp-3);
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 5px;
  z-index: 2;
}
.product-hero-dots span { width: 5px; height: 5px; border-radius: 50%; background: rgba(255,255,255,0.35); }
.product-hero-dots span.on { background: var(--text); }

.product-brand { color: var(--text-dim); font-size: 0.78rem; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; }
.product-name { font-family: var(--font-display); font-size: 1.6rem; font-weight: 800; letter-spacing: -0.02em; margin: 2px 0 4px; }
.product-meta { color: var(--text-dim); font-size: 0.85rem; margin-bottom: var(--sp-4); }
.product-meta .medical-badge {
  display: inline-block;
  background: var(--warn-soft);
  color: var(--warn);
  font-size: 0.68rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: var(--r-pill);
  margin-left: 6px;
  vertical-align: middle;
}

.data-row {
  display: flex;
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: var(--sp-4) var(--sp-2);
  margin-bottom: var(--sp-4);
}
.data-row .datum { flex: 1; text-align: center; }
.data-row .datum-num { font-family: var(--font-display); font-size: 1.4rem; font-weight: 800; letter-spacing: -0.02em; }
.data-row .datum-label { font-size: 0.65rem; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.05em; margin-top: 2px; }
.data-row .div { width: 1px; background: var(--line); }

/* ---- Terpene fingerprint (signature element) ---- */
.fingerprint-title { font-size: 0.9rem; font-weight: 800; letter-spacing: -0.005em; margin-bottom: var(--sp-3); display: flex; align-items: center; gap: 6px; }
.fingerprint-title svg { width: 15px; height: 15px; color: var(--accent); }

.fp-row { margin-bottom: var(--sp-3); }
.fp-row-top { display: flex; justify-content: space-between; font-size: 0.8rem; margin-bottom: 5px; }
.fp-row-name { font-weight: 600; }
.fp-row-pct { color: var(--text-dim); font-variant-numeric: tabular-nums; }
.fp-track { height: 7px; background: var(--bg-interactive); border-radius: var(--r-pill); overflow: hidden; }
.fp-fill {
  height: 100%;
  border-radius: var(--r-pill);
  width: 0;
  transition: width var(--dur-slow) var(--ease);
  background: var(--fp-color, var(--accent));
}

.link-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--sp-3) 0;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text);
  cursor: pointer;
  border-top: 1px solid var(--line-soft);
}
.link-row .chev { color: var(--text-dim); }

/* ---- Bottom sheet ---- */
.sheet-overlay {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: rgba(6,7,6,0.7);
  display: none;
  align-items: flex-end;
  justify-content: center;
}
.sheet-overlay.active { display: flex; }
.sheet {
  background: var(--bg-raised);
  border-radius: var(--r-xl) var(--r-xl) 0 0;
  width: 100%;
  max-width: 560px;
  max-height: 82vh;
  overflow-y: auto;
  padding: var(--sp-5) var(--sp-4) calc(var(--sp-5) + env(safe-area-inset-bottom));
  animation: sheet-up var(--dur-normal) var(--ease);
}
@keyframes sheet-up { from { transform: translateY(100%); } to { transform: translateY(0); } }
.sheet-handle { width: 36px; height: 4px; background: var(--line); border-radius: var(--r-pill); margin: 0 auto var(--sp-4); }
.sheet-title { font-family: var(--font-display); font-size: 1.2rem; font-weight: 800; margin-bottom: var(--sp-4); }
.sheet-section-title { font-size: 0.72rem; font-weight: 700; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.05em; margin: var(--sp-4) 0 var(--sp-2); }
.sheet-data-row { display: flex; justify-content: space-between; padding: 8px 0; font-size: 0.88rem; border-bottom: 1px solid var(--line-soft); }
.sheet-data-row .v { font-weight: 700; font-variant-numeric: tabular-nums; }

/* ---- Review flow ---- */
.review-product-strip {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  margin: var(--sp-3) 0 var(--sp-5);
}
.review-product-strip img { width: 44px; height: 44px; border-radius: var(--r-sm); object-fit: cover; background: var(--bg-card); }
.review-product-strip .name { font-weight: 700; font-size: 0.92rem; }
.review-product-strip .brand { font-size: 0.76rem; color: var(--text-dim); }

.review-headline { font-family: var(--font-display); font-size: 1.4rem; font-weight: 800; letter-spacing: -0.01em; margin-bottom: var(--sp-4); }

.rate-block { margin-bottom: var(--sp-5); }
.rate-block-top { display: flex; align-items: center; gap: 8px; margin-bottom: var(--sp-2); }
.rate-block-top svg { width: 17px; height: 17px; color: var(--text-dim); }
.rate-block-label { font-weight: 700; font-size: 0.95rem; }
.rate-block-micro { font-size: 0.78rem; color: var(--accent); margin-left: auto; font-weight: 700; min-height: 1.1em; }

.rate-pills { display: flex; gap: 6px; }
.rate-pill {
  flex: 1;
  height: 40px;
  border-radius: var(--r-sm);
  border: 1px solid var(--line);
  background: var(--bg-card);
  cursor: pointer;
  transition: all var(--dur-fast) var(--ease);
}
.rate-pill.filled { background: var(--accent); border-color: var(--accent); transform: scaleY(1.08); }

.rec-toggle { display: flex; gap: var(--sp-3); margin-bottom: var(--sp-5); }
.rec-btn {
  flex: 1;
  padding: 14px;
  border-radius: var(--r-md);
  border: 1px solid var(--line);
  background: var(--bg-card);
  color: var(--text-dim);
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
}
.rec-btn.selected.yes { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.rec-btn.selected.no { background: var(--danger-soft); border-color: var(--danger); color: var(--danger); }

.notes-area { width: 100%; min-height: 96px; resize: vertical; }

.submit-review-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.submit-review-btn .pts-badge {
  background: rgba(16,20,10,0.25);
  padding: 2px 8px;
  border-radius: var(--r-pill);
  font-size: 0.78rem;
}

/* ---- Points fly animation + toast ---- */
.pts-fly {
  position: fixed;
  z-index: 60;
  font-family: var(--font-display);
  font-weight: 800;
  color: var(--accent);
  pointer-events: none;
  transition: all 700ms var(--ease);
}

.moment-toast {
  position: fixed;
  bottom: 100px;
  left: 50%;
  transform: translateX(-50%) translateY(12px);
  background: var(--bg-card);
  border: 1px solid var(--accent);
  color: var(--text);
  padding: 12px 20px;
  border-radius: var(--r-lg);
  font-weight: 700;
  font-size: 0.88rem;
  opacity: 0;
  transition: all var(--dur-normal) var(--ease);
  z-index: 55;
  max-width: min(340px, calc(100vw - 48px));
  text-align: center;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
}
.moment-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---- Rewards ---- */
.rewards-progress {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: var(--sp-4);
  margin-bottom: var(--sp-4);
}
.rewards-progress p { font-size: 0.85rem; margin: 0 0 var(--sp-2); }
.rewards-progress p strong { color: var(--accent); }
.progress-track { height: 8px; background: var(--bg-interactive); border-radius: var(--r-pill); overflow: hidden; }
.progress-fill { height: 100%; background: var(--accent); border-radius: var(--r-pill); transition: width var(--dur-slow) var(--ease); }

.reward-card { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); }
.reward-card .cost { color: var(--accent); font-weight: 800; font-size: 0.9rem; white-space: nowrap; }
.reward-card.locked .cost { color: var(--text-faint); }

/* ---- Leaderboard ---- */
.leader-row { display: flex; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line-soft); }
.leader-row:last-child { border-bottom: none; }
.leader-rank { width: 26px; font-weight: 800; color: var(--text-dim); font-family: var(--font-display); }
.leader-row.top1 .leader-rank, .leader-row.top1 .leader-name { color: var(--accent); }
.leader-name { flex: 1; margin-left: 6px; font-weight: 600; }
.leader-points { font-weight: 800; font-variant-numeric: tabular-nums; }
.leader-row.you { background: var(--accent-soft); margin: 0 calc(-1 * var(--sp-3)); padding: 10px var(--sp-3); border-radius: var(--r-md); border-bottom: none; }

/* ---- Profile ---- */
.profile-header { text-align: center; padding: var(--sp-4) 0 var(--sp-5); }
.profile-name { font-family: var(--font-display); font-size: 1.6rem; font-weight: 800; }
.profile-role { color: var(--text-dim); font-size: 0.82rem; text-transform: uppercase; letter-spacing: 0.05em; margin-top: 2px; }

.profile-stats { display: flex; margin-bottom: var(--sp-5); }
.profile-stats .stat { flex: 1; text-align: center; }
.profile-stats .stat-num { font-family: var(--font-display); font-size: 1.5rem; font-weight: 800; }
.profile-stats .stat-label { font-size: 0.65rem; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.04em; }

.settings-list .link-row svg.icon { width: 17px; height: 17px; color: var(--text-dim); margin-right: 8px; }

/* ---- Category filter chips ---- */
.cat-chip {
  flex-shrink: 0;
  padding: 7px 14px;
  border-radius: var(--r-pill);
  border: 1px solid var(--line);
  background: var(--bg-card);
  color: var(--text-dim);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}
.cat-chip.active { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }

/* ---- Review history rows (swipe-to-delete) ---- */
.history-row-wrap {
  position: relative;
  overflow: hidden;
  border-bottom: 1px solid var(--line-soft);
}
.history-row-delete-bg {
  position: absolute;
  inset: 0;
  background: var(--danger);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding-right: var(--sp-4);
  color: #1a0d09;
}
.history-row-delete-bg svg { width: 20px; height: 20px; }

.history-row {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-3) 0;
  cursor: pointer;
  background: var(--bg);
  position: relative;
  touch-action: pan-y;
  transition: transform var(--dur-normal) var(--ease);
}
.history-row img { width: 44px; height: 44px; border-radius: var(--r-sm); object-fit: cover; background: var(--bg-card); }
.history-row .name { font-weight: 700; font-size: 0.88rem; }
.history-row .brand { font-size: 0.74rem; color: var(--text-dim); }
.history-row .stars { color: var(--accent); font-size: 0.78rem; margin-top: 2px; }
.history-row .date { margin-left: auto; font-size: 0.72rem; color: var(--text-faint); }

/* ---- Strain / grower rating rows on product reveal ---- */
.rating-summary-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--sp-3) 0;
  border-bottom: 1px solid var(--line-soft);
}
.rating-summary-row .label { font-size: 0.82rem; color: var(--text-dim); }
.rating-summary-row .value { display: flex; align-items: center; gap: 6px; font-weight: 700; font-size: 0.88rem; }
.rating-summary-row .value .stars { color: var(--accent); }
.rating-summary-row .value .count { color: var(--text-dim); font-weight: 400; font-size: 0.78rem; }

/* ---- Skeleton loading ---- */
.skel { background: linear-gradient(90deg, var(--bg-card) 25%, var(--bg-interactive) 50%, var(--bg-card) 75%); background-size: 200% 100%; animation: shimmer 1.4s infinite; border-radius: var(--r-sm); }
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) { .skel { animation: none; background: var(--bg-card); } }

/* ---- Utility ---- */
.mt-0 { margin-top: 0; }
.hidden { display: none !important; }

/* ==========================================================================
   Desktop (>=900px) — placed at the end of the file on purpose so these
   rules win the cascade over the base mobile styles defined earlier. The
   mobile-first layout was deliberately narrow and centered, correct on a
   phone but leaving a huge, unintentional-looking empty gutter on a real
   monitor. Above this breakpoint the bottom tab bar becomes a persistent
   left sidebar (same pattern as the manager dashboard, for visual
   consistency), the content column gets real room, and sheets present as
   centered modals instead of a mobile slide-up-from-the-edge gesture.
   ========================================================================== */
@media (min-width: 900px) {
  body { padding-bottom: 0; padding-left: 240px; position: relative; }

  /* A soft glow anchored to the right, roughly balancing the sidebar's
     visual weight on the left so the empty space reads as a considered
     choice rather than leftover dead space. */
  body::after {
    content: "";
    position: fixed;
    top: -10%;
    right: -15%;
    width: 640px;
    height: 640px;
    background: radial-gradient(circle, rgba(195, 229, 82, 0.10), transparent 70%);
    pointer-events: none;
    z-index: 0;
  }

  .topbar .brand-mark { display: none; } /* lives in the sidebar header now, avoid duplicating it */

  main { max-width: 760px; padding: 0 var(--sp-6); }

  .tabbar {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    right: auto;
    width: 240px;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    gap: 4px;
    padding: var(--sp-5) var(--sp-3);
    border-top: none;
    border-right: 1px solid var(--line);
    z-index: 21;
  }
  .tabbar::before {
    content: "LOUPE";
    font-family: var(--font-display);
    font-weight: 800;
    font-size: 1.05rem;
    letter-spacing: 0.02em;
    color: var(--text);
    padding: 0 var(--sp-2) var(--sp-5);
  }

  .tab-btn {
    flex: 0 0 auto;
    flex-direction: row;
    justify-content: flex-start;
    gap: 12px;
    padding: 11px var(--sp-3);
    border-radius: var(--r-md);
    font-size: 0.88rem;
  }
  .tab-btn.active { background: var(--bg-card); }
  .tab-btn svg { width: 19px; height: 19px; flex-shrink: 0; }

  .tab-scan {
    order: -1; /* scan stays the first, most prominent action in the sidebar */
    flex: 0 0 auto;
    width: 100%;
    margin: 0 0 var(--sp-4);
    transform: none;
  }
  .tab-scan-btn {
    width: 100%;
    height: 46px;
    border-radius: var(--r-md);
    border: none;
    flex-direction: row;
    gap: 8px;
  }
  .tab-scan-btn::after {
    content: "Scan a sample";
    color: var(--accent-ink);
    font-weight: 800;
    font-size: 0.85rem;
  }
  .tab-scan-btn svg { width: 20px; height: 20px; }

  /* Sheets present as centered modals, not mobile bottom-slides */
  .sheet-overlay { align-items: center; padding: var(--sp-5); }
  .sheet {
    border-radius: var(--r-xl);
    max-width: 460px;
    max-height: 85vh;
    animation: sheet-pop 260ms var(--ease);
  }
  .sheet-handle { display: none; } /* a drag handle implies a mobile gesture that doesn't exist here */

  /* The hero image at its full mobile height (46vh) was designed for an
     immersive full-screen reveal; inside a compact modal it pushed the
     primary "Review sample" button below the fold, needing a scroll with
     no visual cue that one was needed. A fixed, more modest height here
     keeps the whole card — including the CTA — comfortably in view. */
  .product-hero { height: 220px; min-height: 0; }
}

@keyframes sheet-pop {
  from { opacity: 0; transform: scale(0.96); }
  to { opacity: 1; transform: scale(1); }
}
