:root {
  color-scheme: light;
  --bg: #f4f5f7;
  --card: #ffffff;
  --ink: #14171c;
  --muted: #6b7280;
  --faint: #9aa1ab;
  --line: #eceef2;
  --brand: #0d9488;
  --brand-dark: #164e63;
  --brand-soft: #ccfbf1;
  --excellent: #16a34a;
  --good: #8cc63f;
  --fair: #f59e0b;
  --poor: #ef5a4c;
  --blocked: #dc2626;
  --unscored: #a3a9b3;
  --radius: 20px;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.06), 0 1px 3px rgba(16, 24, 40, 0.08);
  --shadow-lg: 0 -8px 40px rgba(16, 24, 40, 0.18);
  --tabbar: 72px;
  font-family: "Inter", system-ui, -apple-system, "Segoe UI Variable Text", "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html, body, #app { height: 100%; }

html { font-size: 93.75%; }

/* iOS zooms into any focused field under 16px */
@supports (-webkit-touch-callout: none) {
  input, select, textarea { font-size: 16px !important; }
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  -webkit-tap-highlight-color: transparent;
}

button, input, select, textarea { font: inherit; color: inherit; }

h1, h2, h3, h4, b, strong, th { font-weight: 550; }

button { cursor: pointer; border: 0; background: none; padding: 0; }

a { color: var(--brand-dark); }

svg { display: block; }

/* ---------- Scan screen ---------- */

.scan {
  position: fixed;
  inset: 0;
  background: #0b0d10;
  color: #fff;
  overflow: hidden;
}

.scan video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.scan::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.55) 0%, transparent 22%, transparent 62%, rgba(0, 0, 0, 0.7) 100%);
}

.top {
  position: absolute;
  z-index: 2;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: max(16px, env(safe-area-inset-top)) 18px 0;
}

.mark {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  font-weight: 550;
  font-size: 1.05rem;
  letter-spacing: -0.01em;
  white-space: nowrap;
}

.mark .logo {
  width: 28px;
  height: 28px;
  border-radius: 9px;
  background: var(--brand);
  display: grid;
  place-items: center;
}

.glass {
  background: rgba(255, 255, 255, 0.16);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  color: #fff;
  border-radius: 999px;
  padding: 10px 16px;
  font-weight: 500;
  font-size: 0.9rem;
  white-space: nowrap;
}

.avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--brand);
  color: #fff;
  font-weight: 550;
}

.frame {
  position: absolute;
  z-index: 1;
  left: 50%;
  top: 40%;
  width: min(78vw, 340px);
  aspect-ratio: 1.6;
  transform: translate(-50%, -50%);
  border-radius: 24px;
  box-shadow: 0 0 0 100vmax rgba(0, 0, 0, 0.35);
}

.frame .corner {
  position: absolute;
  width: 34px;
  height: 34px;
  border: 4px solid #fff;
}

.frame .tl { left: -2px; top: -2px; border-right: 0; border-bottom: 0; border-top-left-radius: 24px; }
.frame .tr { right: -2px; top: -2px; border-left: 0; border-bottom: 0; border-top-right-radius: 24px; }
.frame .bl { left: -2px; bottom: -2px; border-right: 0; border-top: 0; border-bottom-left-radius: 24px; }
.frame .br { right: -2px; bottom: -2px; border-left: 0; border-top: 0; border-bottom-right-radius: 24px; }

.frame .laser {
  position: absolute;
  left: 10%;
  right: 10%;
  height: 2px;
  top: 50%;
  border-radius: 2px;
  background: var(--brand);
  box-shadow: 0 0 12px 2px rgba(13, 148, 136, 0.8);
  animation: sweep 2.2s ease-in-out infinite;
}

.frame .corner { transition: border-color 0.15s; }
.frame.locked .corner { border-color: var(--brand); }
.frame.locked .laser { animation: none; top: 50%; opacity: 0.4; }
.frame.locked { box-shadow: 0 0 0 100vmax rgba(0, 0, 0, 0.5); }

.spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  margin-right: 8px;
  vertical-align: -2px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
  animation: spin 0.7s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.top-actions { display: flex; align-items: center; gap: 10px; }

.icon-glass { width: 40px; height: 40px; padding: 0; display: grid; place-items: center; }
.icon-glass.on { background: #fff; color: var(--ink); }

@keyframes sweep {
  0%, 100% { top: 18%; }
  50% { top: 82%; }
}

.finder-copy {
  position: absolute;
  z-index: 2;
  left: 24px;
  right: 24px;
  bottom: calc(var(--tabbar) + 90px + env(safe-area-inset-bottom));
  text-align: center;
}

.finder-copy h1 {
  margin: 0 0 6px;
  font-size: 1.5rem;
  font-weight: 550;
  letter-spacing: -0.02em;
}

.finder-copy p { margin: 0; color: rgba(255, 255, 255, 0.78); font-size: 0.95rem; }

.finder-copy .pill-note {
  display: inline-block;
  margin-top: 12px;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(13, 148, 136, 0.22);
  color: #99f6e4;
  font-size: 0.78rem;
  font-weight: 500;
  white-space: nowrap;
}

.dock {
  position: absolute;
  z-index: 2;
  left: 0;
  right: 0;
  bottom: calc(var(--tabbar) + 28px + env(safe-area-inset-bottom));
  display: flex;
  justify-content: center;
  gap: 8px;
  padding: 0 12px;
}

.dock .glass { padding: 10px 14px; font-size: 0.85rem; }

.dock .glass { display: flex; align-items: center; gap: 8px; }

/* ---------- Tab bar ---------- */

.tabbar {
  position: fixed;
  z-index: 5;
  left: 0;
  right: 0;
  bottom: 0;
  height: calc(var(--tabbar) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid var(--line);
}

.tabbar button {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  color: var(--faint);
  font-size: 0.72rem;
  font-weight: 500;
}

.tabbar button.on { color: var(--brand); }

.tabbar .scan-tab span.bubble {
  width: 52px;
  height: 52px;
  margin-top: -26px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--brand);
  color: #fff;
  box-shadow: 0 6px 18px rgba(13, 148, 136, 0.45);
  border: 4px solid #fff;
}

/* ---------- Pages ---------- */

.page {
  min-height: 100%;
  padding: max(18px, env(safe-area-inset-top)) 18px calc(var(--tabbar) + 32px);
}

.page-inner { width: min(520px, 100%); margin: 0 auto; }

.back {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--ink);
  font-weight: 500;
  margin-bottom: 18px;
  padding: 8px 12px 8px 8px;
  border-radius: 999px;
  background: var(--card);
  box-shadow: var(--shadow-sm);
}

h1.display {
  margin: 0 0 6px;
  font-size: 1.9rem;
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1.1;
}

h2.display {
  margin: 4px 0 6px;
  font-size: 1.35rem;
  font-weight: 575;
  letter-spacing: -0.02em;
}

.hint, .meta { color: var(--muted); font-size: 0.92rem; line-height: 1.45; }

.meta { font-size: 0.8rem; }

.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 16px;
  margin-top: 14px;
}

.card-title {
  margin: 0 0 10px;
  font-size: 0.78rem;
  font-weight: 550;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

label {
  display: block;
  margin-top: 14px;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--ink);
}

input, select, textarea {
  width: 100%;
  margin-top: 6px;
  padding: 14px 16px;
  border-radius: 14px;
  border: 1.5px solid var(--line);
  background: #ffffff;
  color: var(--ink);
  font-weight: 450;
  outline: none;
  transition: border-color 0.15s, background 0.15s;
}

input:focus { border-color: var(--brand); background: #fff; }

input[type="file"] { padding: 10px; font-size: 0.85rem; }

.primary {
  width: 100%;
  background: var(--brand);
  color: #fff;
  padding: 15px 20px;
  border-radius: 14px;
  font-weight: 550;
  font-size: 1rem;
  box-shadow: 0 4px 14px rgba(13, 148, 136, 0.3);
  transition: transform 0.1s, background 0.15s;
}

.primary:hover { background: var(--brand-dark); }
.primary:active { transform: scale(0.98); }
.primary:disabled { background: #c9ced6; box-shadow: none; cursor: default; transform: none; }

textarea { resize: vertical; line-height: 1.4; }

/* ---------- Product not found ---------- */

.missing-hero { text-align: center; padding: 6px 4px 4px; }
.missing-hero .display { margin: 14px 0 6px; }
.missing-hero .hint { margin: 0 auto; max-width: 36ch; }

.missing-art {
  display: grid;
  place-items: center;
  width: 76px;
  height: 76px;
  margin: 0 auto;
  border-radius: 50%;
  background: #fff1e6;
  color: #e8772e;
  box-shadow: 0 0 0 10px #fff8f2;
}

.missing-art.muted { background: #eef0f3; color: var(--muted); box-shadow: 0 0 0 10px #f6f7f9; }

.code-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 14px;
  padding: 6px 12px;
  border-radius: 999px;
  background: #eef0f3;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.04em;
}

.missing .section-head { margin-top: 24px; }

.photo-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 12px; }

.photo-tile {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  margin: 0;
  padding: 12px;
  border: 1.5px dashed #d5d9e0;
  border-radius: 18px;
  background: #f0fdfa;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.photo-tile:hover { border-color: var(--brand); background: var(--brand-soft); }
.photo-tile strong { font-size: 0.92rem; margin-top: 8px; }
.photo-tile small { color: var(--muted); font-size: 0.78rem; font-weight: 450; }

.tile-art {
  position: relative;
  display: grid;
  place-items: center;
  width: 100%;
  height: 92px;
  border-radius: 12px;
  background: #fff;
  color: var(--faint);
  overflow: hidden;
}

.tile-art img { width: 100%; height: 100%; object-fit: cover; }

.tile-check {
  position: absolute;
  top: 6px;
  right: 6px;
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--brand);
  color: #fff;
  box-shadow: 0 0 0 2px #fff;
}

.tile-badge {
  position: absolute;
  top: 17px;
  left: 17px;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(20, 23, 28, 0.06);
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 550;
}

.photo-tile.done { border-style: solid; border-color: var(--brand); background: var(--brand-soft); }
.photo-tile.done .tile-badge { display: none; }
.photo-tile.done small { color: var(--brand-dark); }
.photo-tile.warn { border-color: var(--fair); background: #fff7e8; }
.photo-tile.warn small { color: #8a5300; }
.photo-tile.busy { opacity: 0.6; pointer-events: none; }

details.extra { margin-top: 14px; border-radius: 16px; background: #ffffff; padding: 2px 14px 14px; }
details.extra summary { padding: 12px 0 0; font-size: 0.9rem; font-weight: 525; color: var(--brand-dark); cursor: pointer; }
details.extra:not([open]) { padding-bottom: 12px; }
details.extra input, details.extra textarea { background: #fff; }

.pair { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.ghost {
  width: 100%;
  padding: 14px 20px;
  border-radius: 14px;
  background: #eef0f3;
  color: var(--ink);
  font-weight: 525;
}

.text-btn {
  display: block;
  margin: 12px auto 0;
  padding: 8px 12px;
  color: var(--brand-dark);
  font-weight: 525;
}

.actions { display: flex; flex-direction: column; gap: 10px; margin-top: 22px; }

/* ---------- Account forms ---------- */

.text-btn.right { margin: 8px 0 0 auto; padding: 4px 0; font-size: 0.88rem; }

.inline-link { color: var(--brand-dark); font-weight: 525; text-decoration: underline; text-underline-offset: 2px; }

.switch { margin: 18px 0 0; text-align: center; color: var(--muted); font-size: 0.92rem; }

.pw-wrap { position: relative; }
.pw-wrap input { padding-right: 52px; }

.eye {
  position: absolute;
  right: 6px;
  top: calc(50% + 3px);
  transform: translateY(-50%);
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  color: var(--muted);
}

.eye:hover { color: var(--ink); background: #eef0f3; }
.eye[aria-pressed="true"] { color: var(--brand-dark); }

.pw-rules { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 4px; font-size: 0.82rem; color: var(--faint); }
.pw-rules li { display: flex; align-items: center; gap: 6px; }
.pw-rules li svg { opacity: 0.35; }
.pw-rules li.ok { color: var(--brand-dark); }
.pw-rules li.ok svg { opacity: 1; }

.terms-row {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  margin-top: 18px;
  padding: 14px;
  border-radius: 14px;
  border: 1.5px solid var(--line);
  background: #ffffff;
  font-weight: 450;
  font-size: 0.9rem;
  line-height: 1.45;
  cursor: pointer;
}

.terms-row input { width: 20px; height: 20px; margin: 1px 0 0; flex: none; accent-color: var(--brand); }
.terms-row.invalid { border-color: var(--poor); background: #fff4f3; }

.terms-title { margin: 22px 0 0; font-size: 1.35rem; font-weight: 600; letter-spacing: -0.02em; }
.sticky-actions { position: sticky; bottom: -40px; margin: 24px -20px -40px; padding: 14px 20px 24px; background: linear-gradient(transparent, #fff 30%); }

.toast {
  position: fixed;
  z-index: 40;
  left: 50%;
  top: 18px;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 18px;
  border-radius: 999px;
  background: var(--ink);
  color: #fff;
  font-weight: 500;
  font-size: 0.92rem;
  box-shadow: 0 8px 24px rgba(16, 24, 40, 0.25);
  animation: rise 0.25s ease-out;
}

.toast svg { color: #5eead4; }

.dialog-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(16, 24, 40, 0.45);
  animation: fade 0.15s;
}

.dialog {
  width: min(380px, 100%);
  padding: 24px 22px 20px;
  border-radius: 24px;
  background: #fff;
  text-align: center;
  box-shadow: 0 20px 50px rgba(16, 24, 40, 0.3);
  animation: rise 0.2s ease-out;
}

.dialog h2 { margin: 14px 0 6px; font-size: 1.25rem; font-weight: 600; letter-spacing: -0.02em; }
.dialog p { margin: 0; color: #4b5563; line-height: 1.45; }
.dialog .meta { margin-top: 8px; }

.dialog-icon {
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  margin: 0 auto;
  border-radius: 50%;
  background: #fdecea;
  color: var(--poor);
}

.dialog-actions { display: grid; gap: 10px; margin-top: 20px; }

.danger {
  width: 100%;
  padding: 14px 20px;
  border-radius: 14px;
  background: var(--poor);
  color: #fff;
  font-weight: 550;
}

.danger:hover { background: #d9463a; }

.account-card { padding: 0; overflow: hidden; }
.account-head { display: flex; gap: 14px; align-items: center; padding: 16px; }
.account-head .avatar { display: grid; place-items: center; width: 52px; height: 52px; flex: none; font-size: 1.3rem; }
.account-head strong { display: block; font-size: 1.05rem; }
.account-head small { display: block; color: var(--muted); font-size: 0.85rem; }
.options.flat { border-radius: 0; box-shadow: none; border-top: 1px solid var(--line); }
.opt-label { display: flex; align-items: center; gap: 12px; }
.option .chev { color: var(--faint); }

.error { color: var(--poor); font-size: 0.9rem; font-weight: 450; }
.error:empty { display: none; }

.segment {
  display: flex;
  padding: 4px;
  background: #eef0f3;
  border-radius: 14px;
  gap: 4px;
}

.segment button {
  flex: 1;
  min-width: 0;
  padding: 10px 6px;
  line-height: 1.25;
  border-radius: 11px;
  color: var(--muted);
  font-weight: 500;
  font-size: 0.88rem;
}

.segment button.on { background: #fff; color: var(--ink); box-shadow: var(--shadow-sm); }

.checks { display: flex; flex-wrap: wrap; gap: 8px; }

.checks button, .chip {
  padding: 9px 14px;
  border-radius: 999px;
  background: #f1f3f5;
  color: var(--ink);
  font-weight: 500;
  font-size: 0.88rem;
  border: 1.5px solid transparent;
  transition: background 0.15s, border-color 0.15s;
}

.checks button.on, .chip {
  background: var(--brand-soft);
  border-color: var(--brand);
  color: var(--brand-dark);
}

.inline-add { display: flex; gap: 8px; align-items: flex-end; }
.inline-add label { flex: 1; margin-top: 0; }
.inline-add .ghost { width: auto; padding: 14px 16px; }

.mail {
  white-space: pre-wrap;
  font-size: 0.88rem;
}

/* ---------- Sheet ---------- */

.scrim {
  position: fixed;
  inset: 0;
  z-index: 9;
  background: rgba(10, 12, 16, 0.45);
  animation: fade 0.2s ease-out;
}

.sheet {
  position: fixed;
  z-index: 10;
  left: 0;
  right: 0;
  bottom: 0;
  margin: 0 auto;
  width: min(560px, 100%);
  max-height: 90vh;
  overflow: auto;
  background: var(--bg);
  color: var(--ink);
  border-radius: 26px 26px 0 0;
  padding: 10px 16px calc(28px + env(safe-area-inset-bottom));
  box-shadow: var(--shadow-lg);
  animation: rise 0.28s cubic-bezier(0.2, 0.9, 0.3, 1);
}

@keyframes rise { from { transform: translateY(40px); opacity: 0; } }
@keyframes fade { from { opacity: 0; } }

.grab {
  width: 40px;
  height: 5px;
  border-radius: 99px;
  background: #d5d9df;
  margin: 0 auto 14px;
}

/* ---------- Product result ---------- */

.excellent { --tone: var(--excellent); }
.good { --tone: var(--good); }
.fair { --tone: var(--fair); }
.poor { --tone: var(--poor); }
.blocked { --tone: var(--blocked); }
.unscored { --tone: var(--unscored); }
.limited { --tone: #f4cf3a; }
.moderate { --tone: #ee7d2b; }

.sheet-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: -4px 0 10px;
}

.bar-btn {
  color: var(--brand-dark);
  font-weight: 525;
  font-size: 0.95rem;
  padding: 6px 4px;
}

.bar-btn.icon-only { color: var(--ink); }

.title-row { display: flex; justify-content: space-between; align-items: center; }

.product-head {
  position: relative;
  display: flex;
  gap: 16px;
  align-items: center;
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 14px;
}

.head-info { min-width: 0; flex: 1; }

.thumb {
  flex: none;
  width: 96px;
  height: 112px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  overflow: hidden;
  font-size: 1.8rem;
  font-weight: 600;
  color: #fff;
  letter-spacing: -0.03em;
  background: linear-gradient(140deg, var(--tone), color-mix(in srgb, var(--tone) 60%, #000));
}

.thumb.photo { background: #fff; border: 1px solid var(--line); }
.thumb img { width: 100%; height: 100%; object-fit: contain; padding: 4px; }

.product-head h2 {
  margin: 0;
  font-size: 1.2rem;
  font-weight: 575;
  letter-spacing: -0.02em;
  line-height: 1.22;
}

.product-head .brand {
  margin: 3px 0 12px;
  color: var(--muted);
  font-size: 0.9rem;
}

.score {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
}

.score .points { font-size: 1.05rem; color: var(--muted); font-weight: 500; }
.score .points b { font-size: 1.6rem; color: var(--ink); font-weight: 600; letter-spacing: -0.03em; }
.score .grade-word { font-size: 0.85rem; font-weight: 525; color: var(--tone); margin-top: -2px; }

.dot {
  flex: none;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--tone, var(--unscored));
}

.score .dot { width: 22px; height: 22px; box-shadow: 0 0 0 5px color-mix(in srgb, var(--tone) 18%, transparent); }

.score.small { gap: 8px; font-size: 0.85rem; color: var(--muted); }
.score.small b { color: var(--ink); font-weight: 575; }
.score.small .dot { width: 10px; height: 10px; box-shadow: none; }

.peek-more { display: none; color: var(--faint); }

.reason-card {
  margin-top: 12px;
  padding: 14px 16px;
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--tone) 12%, #fff);
  border-left: 4px solid var(--tone);
  line-height: 1.4;
}

.reason-card strong { display: block; font-size: 0.78rem; letter-spacing: 0.06em; text-transform: uppercase; color: color-mix(in srgb, var(--tone) 70%, #000); }
.reason-card p { margin: 4px 0 0; font-weight: 500; }

.alert {
  display: flex;
  gap: 12px;
  margin-top: 12px;
  padding: 14px 16px;
  border-radius: var(--radius);
  background: var(--blocked);
  color: #fff;
}

.alert strong { font-size: 1.05rem; }
.alert p { margin: 2px 0 0; opacity: 0.92; }

/* Peek: after a camera scan only the product card shows, like a toast you can pull up. */
.sheet.peek {
  max-height: none;
  padding-bottom: calc(var(--tabbar) + 16px + env(safe-area-inset-bottom));
  background: transparent;
  box-shadow: none;
  cursor: pointer;
  pointer-events: none;
}

.sheet.peek .product-head { pointer-events: auto; }

.sheet.peek > :not(.product-head) { display: none; }
.sheet.peek .product-head { box-shadow: 0 8px 28px rgba(16, 24, 40, 0.22); }
.sheet.peek .peek-more { display: block; }
.sheet.peek .thumb { width: 64px; height: 72px; }

.banner {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin-top: 10px;
  padding: 12px 14px;
  border-radius: 16px;
  background: #fff7e8;
  color: #8a5300;
  font-size: 0.9rem;
  font-weight: 475;
  line-height: 1.4;
}

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  margin: 24px 4px 8px;
}

.section-head h3 { margin: 0; font-size: 1.2rem; font-weight: 600; letter-spacing: -0.025em; }
.section-head span { color: var(--faint); font-size: 0.78rem; text-align: right; }

.rows {
  list-style: none;
  margin: 0;
  padding: 0;
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.rows li { border-top: 1px solid var(--line); }
.rows li:first-child { border-top: 0; }

.row-main {
  width: 100%;
  display: grid;
  grid-template-columns: 26px 1fr auto 12px 16px;
  align-items: center;
  gap: 12px;
  padding: 13px 14px;
  text-align: left;
}

.rows li.static .row-main { cursor: default; }
.rows li.static .chev { visibility: hidden; }

.rows .icon { color: #4b5563; display: grid; place-items: center; }
.rows .name { font-weight: 525; font-size: 0.95rem; }
.rows .sub { color: var(--muted); font-size: 0.8rem; margin-top: 1px; }
.rows .value { font-weight: 525; font-size: 0.9rem; text-align: right; white-space: nowrap; color: #374151; }
.rows .value small { display: block; color: var(--faint); font-weight: 450; font-size: 0.72rem; }
.rows .chev { color: var(--faint); transition: transform 0.2s; }
.rows li.open .chev { transform: rotate(90deg); }

.detail { display: none; padding: 2px 16px 16px 52px; }
.rows li.open .detail { display: block; animation: fade 0.2s; }
.detail p { margin: 10px 0 0; color: var(--muted); font-size: 0.82rem; line-height: 1.45; }

.scale { position: relative; padding: 6px 0; }
.bands { display: flex; gap: 3px; height: 8px; }
.band { border-radius: 99px; background: var(--tone); }
.band.unscored { background: #dfe3e8; }

.marker {
  position: absolute;
  top: 0;
  width: 4px;
  height: 20px;
  margin-left: -2px;
  border-radius: 4px;
  background: var(--ink);
  box-shadow: 0 0 0 2px #fff;
}

.ticks { position: relative; height: 14px; margin-top: 4px; font-size: 0.7rem; color: var(--faint); }
.ticks span { position: absolute; transform: translateX(-50%); }
.ticks span:first-child { transform: none; }
.ticks span.end { transform: translateX(-100%); }

.risk-chips { display: flex; flex-wrap: wrap; gap: 8px; }

.risk-chip { display: inline-flex; align-items: center; gap: 6px; font-size: 0.85rem; color: var(--muted); }

.risk-chip b {
  display: grid;
  place-items: center;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  border-radius: 99px;
  background: var(--tone);
  color: #fff;
  font-size: 0.75rem;
}

.link-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 12px;
  color: #0d9488;
  font-weight: 500;
  font-size: 0.92rem;
}

.reason-card .link-btn { margin-top: 8px; font-size: 0.85rem; }

/* ---------- Stacked panels (additives, scoring) ---------- */

.panel {
  position: fixed;
  z-index: 20;
  left: 0;
  right: 0;
  bottom: 0;
  top: 5vh;
  margin: 0 auto;
  width: min(560px, 100%);
  display: flex;
  flex-direction: column;
  background: #fff;
  border-radius: 28px 28px 0 0;
  box-shadow: var(--shadow-lg);
  animation: rise 0.25s ease-out;
}

.panel.grey { background: #f2f2f7; }

@keyframes rise { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }

.panel-bar {
  display: grid;
  grid-template-columns: 44px 1fr 44px;
  align-items: center;
  padding: 16px 16px 8px;
}

.panel-bar h2 { margin: 0; text-align: center; font-size: 1.05rem; font-weight: 550; }

.round-btn {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 4px rgba(16, 24, 40, 0.14);
}

.panel-body { flex: 1; overflow-y: auto; padding: 10px 20px 40px; line-height: 1.5; }
.panel-body h3 { margin: 26px 0 6px; font-size: 1.1rem; font-weight: 600; letter-spacing: -0.02em; }
.panel-body > p { margin: 8px 0; color: #374151; }
.panel-body .lead { font-size: 1.02rem; color: var(--ink); }
.panel-note { margin: 14px 4px 0; }

.rows.plain { box-shadow: none; }
.row-main.no-icon { grid-template-columns: 1fr auto 12px 16px; }
.rows .value.risk-word { color: var(--muted); font-weight: 450; font-size: 0.88rem; }

.additive-name { margin: 6px 0 4px !important; font-size: 1.4rem !important; }
.additive-risk { display: flex; align-items: center; gap: 8px; font-weight: 450; }
.additive-risk .code { margin-left: 6px; padding: 1px 8px; border-radius: 99px; background: #eef0f3; color: var(--muted); font-size: 0.78rem; font-weight: 500; }

.info-card {
  display: flex;
  gap: 14px;
  margin-top: 16px;
  padding: 16px;
  border-radius: 18px;
  background: #f2f2f7;
}

.info-card strong { font-weight: 500; }
.info-card p { margin: 3px 0 0; color: var(--muted); font-size: 0.9rem; }
.info-icon { flex: none; color: #0d9488; }
.info-icon.poor, .info-icon.moderate, .info-icon.limited { color: color-mix(in srgb, var(--tone) 80%, #000); }
.info-icon.excellent { color: var(--brand-dark); }

.band-list, .source-list { display: grid; gap: 8px; margin: 10px 0; }

.risk-row, .source-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 16px;
  border-radius: 16px;
  background: #f2f2f7;
}

.risk-row .dot { width: 14px; height: 14px; }
.risk-row strong, .source-card strong { display: block; font-weight: 500; }
.risk-row small, .source-card small { color: var(--muted); font-size: 0.85rem; }

.source-card { color: var(--ink); text-decoration: none; }
.source-card > div { flex: 1; }
.source-card > svg { color: #0d9488; }

.source-logo {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  flex: none;
  border-radius: 14px;
  color: #fff;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.options {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.option {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  padding: 15px 16px;
  border-top: 1px solid var(--line);
  font-weight: 450;
  text-align: left;
}

.option:first-child { border-top: 0; }
.opt-icon { color: var(--ink); }
.opt-icon.star.on svg { fill: currentColor; }

.allergens {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  background: var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.allergen {
  display: grid;
  grid-template-columns: 10px 1fr;
  column-gap: 10px;
  align-items: center;
  padding: 11px 14px;
  background: var(--card);
  font-size: 0.9rem;
  font-weight: 525;
}

.allergen small { grid-column: 2; color: var(--muted); font-size: 0.74rem; font-weight: 450; }
.allergen .dot { width: 10px; height: 10px; }
.allergen.on_the_label { --tone: var(--blocked); background: #fff3f3; color: var(--blocked); }
.allergen.precautionary { --tone: var(--fair); background: #fff7e8; color: #8a5300; }
.allergen.not_listed { --tone: var(--excellent); }
.allergen.unknown { --tone: var(--unscored); color: var(--muted); }
details.allergen-more { margin-top: 12px; }
details.allergen-more summary { cursor: pointer; font-weight: 525; }
details.allergen-more .checks { margin-top: 10px; }

.ingredients {
  margin: 0;
  padding: 14px 16px;
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  font-size: 0.9rem;
  line-height: 1.5;
  color: #374151;
}

.source .meta { margin: 0 0 6px; }

.source { margin: 20px 4px 0; }

.sample-list { display: grid; gap: 8px; }

.sample-list button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-radius: 16px;
  background: var(--card);
  box-shadow: var(--shadow-sm);
  font-weight: 525;
  text-align: left;
}

.sample-list button span { color: var(--faint); font-weight: 450; font-size: 0.8rem; }

/* ---------- History ---------- */

.group-title {
  margin: 22px 4px 8px;
  font-size: 0.78rem;
  font-weight: 550;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.history { display: grid; gap: 10px; }

.history button {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px;
  border-radius: var(--radius);
  background: var(--card);
  box-shadow: var(--shadow-sm);
  text-align: left;
}

.history .thumb { width: 60px; height: 68px; border-radius: 14px; font-size: 1.3rem; }
.history .info { flex: 1; min-width: 0; }
.history .title { font-weight: 550; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.history .brand { color: var(--muted); font-size: 0.85rem; margin: 1px 0 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.history .side { display: flex; flex-direction: column; align-items: flex-end; gap: 14px; color: var(--faint); align-self: stretch; justify-content: space-between; }
.history .when { font-size: 0.75rem; }

.empty {
  text-align: center;
  padding: 48px 20px;
  color: var(--muted);
}

.empty .art {
  width: 72px;
  height: 72px;
  margin: 0 auto 14px;
  border-radius: 22px;
  display: grid;
  place-items: center;
  background: var(--brand-soft);
  color: var(--brand);
}

.empty h2 { color: var(--ink); margin: 0 0 6px; font-size: 1.15rem; }

/* ---------- Welcome ---------- */

.welcome {
  position: fixed;
  inset: 0;
  overflow: hidden;
  color: #fff;
  transition: background 0.35s;
}

.welcome.on-green { background: #0d9488; }
.welcome.on-orange { background: #ef8a5c; }
.welcome.on-teal { background: #164e63; }
.welcome.on-light { background: #f4f5f7; }

.welcome-track {
  display: flex;
  height: 100%;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
}

.welcome-track::-webkit-scrollbar { display: none; }

.welcome-slide {
  flex: 0 0 100%;
  scroll-snap-align: start;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 28px 110px;
  text-align: center;
}

.welcome-slide.green { background: #0d9488; }
.welcome-slide.orange { background: #ef8a5c; }
.welcome-slide.teal { background: #164e63; }
.welcome-slide.light { background: #f4f5f7; color: var(--ink); }

.welcome-stage { position: relative; }

.welcome-circle {
  width: min(62vw, 240px);
  aspect-ratio: 1;
  border-radius: 50%;
  background: #fff;
  display: grid;
  place-items: center;
  box-shadow: 0 0 0 10px rgba(255, 255, 255, 0.18), 0 18px 40px rgba(0, 0, 0, 0.12);
}

.welcome-slide.light .welcome-circle { box-shadow: 0 0 0 10px rgba(13, 148, 136, 0.12), 0 18px 40px rgba(16, 24, 40, 0.1); }

.welcome-art { width: 74%; }
.welcome-art svg { width: 100%; height: auto; }

.welcome-slide:first-child .welcome-art,
.welcome-slide.light .welcome-art { animation: bob 3s ease-in-out infinite; }

@keyframes bob {
  0%, 100% { transform: translateY(0) rotate(-2deg); }
  50% { transform: translateY(-6px) rotate(2deg); }
}

.bubble-quote {
  position: absolute;
  z-index: 1;
  top: -18px;
  right: -36px;
  max-width: 130px;
  padding: 10px 12px;
  border-radius: 14px;
  background: #fff;
  border: 2px solid var(--ink);
  color: var(--ink);
  font-size: 0.78rem;
  font-weight: 550;
  line-height: 1.3;
  transform: rotate(4deg);
}

.bubble-quote::after {
  content: "";
  position: absolute;
  left: 18px;
  bottom: -9px;
  width: 14px;
  height: 14px;
  background: #fff;
  border-right: 2px solid var(--ink);
  border-bottom: 2px solid var(--ink);
  transform: rotate(45deg);
}

.welcome-slide h1 {
  margin: 34px 0 10px;
  font-family: "Pacifico", cursive;
  font-weight: 400;
  font-size: clamp(2rem, 8vw, 2.6rem);
  line-height: 1.2;
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.08);
}

.welcome-slide.light h1 { color: var(--brand-dark); text-shadow: none; }

.welcome-slide p {
  margin: 0;
  max-width: 320px;
  font-size: 0.98rem;
  line-height: 1.5;
  opacity: 0.95;
}

.welcome-slide.light p { color: var(--muted); }

.welcome-actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  width: min(320px, 100%);
  margin-top: 36px;
}

.welcome-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 15px 20px;
  border-radius: 14px;
  background: rgba(0, 0, 0, 0.2);
  color: #fff;
  font-weight: 550;
  font-size: 1rem;
  transition: transform 0.1s, background 0.15s;
}

.welcome-btn:hover { background: rgba(0, 0, 0, 0.28); }
.welcome-btn:active { transform: scale(0.98); }
.welcome-btn.solid { background: var(--brand); box-shadow: 0 6px 18px rgba(13, 148, 136, 0.35); }
.welcome-btn.solid:hover { background: var(--brand-dark); }

.welcome-hint {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 10px 14px;
  color: inherit;
  font-weight: 525;
  opacity: 0.9;
}

.welcome-hint svg { animation: nudge 1.4s ease-in-out infinite; }

@keyframes nudge {
  0%, 100% { transform: translateX(0); }
  50% { transform: translateX(5px); }
}

.welcome-link { color: var(--brand-dark); font-weight: 525; padding: 8px; }

.welcome-skip {
  position: absolute;
  z-index: 2;
  top: max(16px, env(safe-area-inset-top));
  right: 18px;
  padding: 8px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
  font-weight: 525;
  font-size: 0.88rem;
}

.welcome.on-light .welcome-skip { background: #e7e9ed; color: var(--ink); }

.welcome-dots {
  position: absolute;
  left: 0;
  right: 0;
  bottom: max(34px, env(safe-area-inset-bottom));
  display: flex;
  justify-content: center;
  gap: 10px;
}

.welcome-dots button {
  width: 9px;
  height: 9px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.45);
  transition: width 0.25s, background 0.25s;
}

.welcome-dots button.on { width: 26px; background: #fff; }
.welcome.on-light .welcome-dots button { background: #d5d9df; }
.welcome.on-light .welcome-dots button.on { background: var(--brand); }

@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto; transition: none !important; animation: none !important; }
}
/* =====================================================================
   Design layer: app shell, components, and motion
   ===================================================================== */

:root {
  --bg: #f0fdfa;
  --ink: #1f2937;
  --muted: #64748b;
  --faint: #94a3b8;
  --line: #e5e7eb;
  --radius: 22px;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.04), 0 2px 8px rgba(16, 24, 40, 0.05);
  --shadow-md: 0 4px 10px rgba(16, 24, 40, 0.05), 0 12px 32px rgba(16, 24, 40, 0.08);
  --shadow-lg: 0 -10px 40px rgba(16, 24, 40, 0.16);
  --focus: 0 0 0 3px rgba(13, 148, 136, 0.35);
  --ease: cubic-bezier(0.2, 0.9, 0.3, 1);
  --tabbar: 84px;
}

html, body { height: 100%; }
body { overflow: hidden; }

.shell {
  position: relative;
  width: 100%;
  max-width: 480px;
  height: 100dvh;
  margin: 0 auto;
  overflow: hidden;
  background: var(--bg);
  transform: translateZ(0);
}

#app { height: 100%; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: none; }
#app::-webkit-scrollbar { display: none; }

.desktop-intro { display: none; }

@media (min-width: 640px) {
  body {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 72px;
    background:
      radial-gradient(1200px 600px at 10% -10%, rgba(13, 148, 136, 0.18), transparent 60%),
      radial-gradient(900px 600px at 110% 110%, rgba(245, 165, 36, 0.14), transparent 60%),
      #eef1f5;
  }
  .shell {
    flex: none;
    width: 400px;
    height: min(860px, calc(100dvh - 48px));
    margin: 0;
    border-radius: 40px;
    box-shadow: 0 0 0 10px #101828, 0 0 0 11px #2b3341, 0 40px 80px rgba(16, 24, 40, 0.35);
  }
}

@media (min-width: 1000px) {
  .desktop-intro {
    display: block;
    max-width: 380px;
    color: var(--ink);
  }
  .intro-logo {
    display: grid;
    place-items: center;
    width: 56px;
    height: 56px;
    border-radius: 18px;
    background: linear-gradient(140deg, #14b8a6, var(--brand-dark));
    color: #fff;
    box-shadow: 0 12px 28px rgba(13, 148, 136, 0.35);
  }
  .desktop-intro h2 { margin: 22px 0 10px; font-size: 2.4rem; font-weight: 600; letter-spacing: -0.04em; line-height: 1.05; }
  .desktop-intro p { margin: 0; color: var(--muted); font-size: 1.08rem; line-height: 1.55; }
  .desktop-intro ul { list-style: none; margin: 28px 0; padding: 0; display: grid; gap: 14px; }
  .desktop-intro li { display: flex; gap: 12px; align-items: flex-start; font-weight: 475; line-height: 1.4; }
  .desktop-intro li::before {
    content: "";
    flex: none;
    width: 22px;
    height: 22px;
    margin-top: -1px;
    border-radius: 50%;
    background: var(--brand-soft) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23179447' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 12.5l4 4 8-9'/%3E%3C/svg%3E") center / 14px no-repeat;
  }
  .desktop-intro small { display: inline-block; padding: 10px 14px; border-radius: 14px; background: #fff; color: var(--muted); font-weight: 475; box-shadow: var(--shadow-sm); }
}

/* Everything fixed now lives inside the shell. */
.sheet { width: 100%; max-height: 92%; }
.panel { width: 100%; top: 4%; }
.scrim { background: rgba(16, 24, 40, 0.42); backdrop-filter: blur(2px); -webkit-backdrop-filter: blur(2px); }

/* ---------- Interaction ---------- */

button { transition: transform 0.12s ease, background-color 0.15s, color 0.15s, box-shadow 0.15s, border-color 0.15s; }
button:active:not(:disabled) { transform: scale(0.97); }
button:focus-visible, a:focus-visible { outline: none; box-shadow: var(--focus); }
input:focus, select:focus, textarea:focus { border-color: var(--brand); box-shadow: var(--focus); background: #fff; }

.page-inner { animation: page-in 0.32s var(--ease); }
@keyframes page-in { from { opacity: 0; transform: translateY(10px); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* ---------- Type & surfaces ---------- */

h1.display { font-size: 2rem; letter-spacing: -0.035em; }
.card { border: 1px solid rgba(16, 24, 40, 0.04); box-shadow: var(--shadow-sm); }

.primary {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: linear-gradient(180deg, #14b8a6, var(--brand));
  border-radius: 16px;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.25) inset, 0 8px 20px rgba(13, 148, 136, 0.32);
}
.primary:hover { background: linear-gradient(180deg, #0f766e, var(--brand-dark)); }
.ghost { border-radius: 16px; }

.page { padding: max(20px, env(safe-area-inset-top)) 18px calc(var(--tabbar) + 40px); }

.page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 6px; }
.page-head h1.display { margin-bottom: 4px; }
.page-head .hint { margin: 0; }
.danger-icon { color: var(--poor); flex: none; }
.danger-icon:hover { background: #fdecea; }

.group-title { display: flex; align-items: center; gap: 8px; margin: 26px 4px 10px; font-size: 0.74rem; color: var(--faint); }
.group-title span { padding: 1px 8px; border-radius: 999px; background: #e4e7ec; color: var(--muted); font-size: 0.7rem; letter-spacing: 0; }

/* ---------- Floating tab bar ---------- */

.tabbar {
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: calc(14px + env(safe-area-inset-bottom));
  height: 64px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.6);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  box-shadow: 0 10px 30px rgba(16, 24, 40, 0.14), 0 1px 2px rgba(16, 24, 40, 0.06);
}
.tabbar button { position: relative; gap: 3px; color: var(--faint); font-size: 0.7rem; }
.tabbar button:not(.scan-tab).on { color: var(--brand-dark); }
.tabbar button:not(.scan-tab).on::after {
  content: "";
  position: absolute;
  bottom: 7px;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--brand);
}
.tabbar .scan-tab { color: var(--ink); }
.tabbar .scan-tab span.bubble {
  width: 58px;
  height: 58px;
  margin-top: -30px;
  border: 0;
  border-radius: 20px;
  background: linear-gradient(150deg, #14b8a6, var(--brand-dark));
  box-shadow: 0 0 0 5px var(--bg), 0 10px 22px rgba(13, 148, 136, 0.45);
}
.scan + .tabbar { background: rgba(20, 24, 32, 0.55); border-color: rgba(255, 255, 255, 0.1); }
.scan + .tabbar button:not(.scan-tab) { color: rgba(255, 255, 255, 0.7); }
.scan + .tabbar .scan-tab { color: #fff; }
.scan + .tabbar .scan-tab span.bubble { box-shadow: 0 0 0 5px rgba(0, 0, 0, 0.35), 0 10px 22px rgba(13, 148, 136, 0.45); }

/* ---------- Scan screen ---------- */

.scan { position: absolute; }
.frame { width: min(78%, 320px); border-radius: 28px; }
.frame .corner { width: 40px; height: 40px; border-width: 5px; }
.frame .tl { border-top-left-radius: 28px; }
.frame .tr { border-top-right-radius: 28px; }
.frame .bl { border-bottom-left-radius: 28px; }
.frame .br { border-bottom-right-radius: 28px; }
.finder-copy { bottom: calc(var(--tabbar) + 104px + env(safe-area-inset-bottom)); }
.finder-copy h1 { font-size: 1.45rem; font-weight: 600; letter-spacing: -0.03em; }
.dock { bottom: calc(var(--tabbar) + 22px + env(safe-area-inset-bottom)); }
.dock-group {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  padding: 5px;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.14);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}
.dock-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  min-width: 92px;
  padding: 10px 8px 9px;
  border-radius: 17px;
  color: #fff;
  font-size: 0.75rem;
  font-weight: 500;
}
.dock-btn:hover { background: rgba(255, 255, 255, 0.14); }

/* ---------- Score ring ---------- */

.ring { position: relative; flex: none; display: grid; place-items: center; }
.ring svg { display: block; }
.ring circle { fill: none; stroke-linecap: round; }
.ring-track { stroke: color-mix(in srgb, var(--tone) 16%, #eef0f3); }
.ring-value { stroke: var(--tone); animation: ring-fill 0.9s var(--ease) both; }
@keyframes ring-fill { from { stroke-dashoffset: var(--len); } }
.ring-label { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; line-height: 1; }
.ring-label b { font-size: 1.05rem; font-weight: 600; letter-spacing: -0.03em; color: var(--ink); }
.ring-label small { margin-top: 2px; font-size: 0.62rem; font-weight: 500; color: var(--faint); }
.ring.big .ring-label b { font-size: 1.5rem; }

/* ---------- Product sheet ---------- */

.sheet { padding: 10px 16px calc(32px + env(safe-area-inset-bottom)); border-radius: 30px 30px 0 0; }
.sheet-bar { display: grid; grid-template-columns: 40px 1fr 40px; margin: 0 0 12px; }
.sheet-bar .round-btn, .round-spacer { width: 40px; height: 40px; }
.sheet-title { text-align: center; font-weight: 550; font-size: 0.98rem; }

.round-btn { color: var(--ink); background: #fff; box-shadow: 0 1px 2px rgba(16, 24, 40, 0.06), 0 2px 8px rgba(16, 24, 40, 0.08); }
.round-btn:hover { background: #f0fdfa; }

.product-head {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 14px;
  padding: 14px;
  border-radius: 24px;
  border: 1px solid color-mix(in srgb, var(--tone) 18%, transparent);
  background: linear-gradient(160deg, color-mix(in srgb, var(--tone) 10%, #fff) 0%, #fff 60%);
  box-shadow: var(--shadow-md);
}
.product-head .thumb { width: 84px; height: 96px; border-radius: 18px; box-shadow: 0 4px 12px rgba(16, 24, 40, 0.1); }
.product-head h2 { font-size: 1.12rem; line-height: 1.25; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.product-head .brand { margin: 3px 0 10px; font-size: 0.86rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.head-chips { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.grade-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 11px 5px 9px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--tone) 14%, #fff);
  color: color-mix(in srgb, var(--tone) 72%, #000);
  font-size: 0.8rem;
  font-weight: 550;
  white-space: nowrap;
}
.grade-pill .dot { width: 8px; height: 8px; }
.grade-pill.small { padding: 3px 9px 3px 7px; font-size: 0.72rem; }

.peek-hint { display: none; align-items: center; gap: 2px; color: var(--faint); font-size: 0.78rem; font-weight: 500; }
.sheet.peek .peek-hint { display: inline-flex; }
.sheet.peek .product-head { background: #fff; box-shadow: 0 14px 40px rgba(16, 24, 40, 0.28); animation: rise 0.35s var(--ease); }
.sheet.peek .thumb { width: 60px; height: 68px; }
.sheet.peek { padding-bottom: calc(var(--tabbar) + 22px + env(safe-area-inset-bottom)); }

.reason-card { border-left: 0; border-radius: 18px; padding: 14px 16px; background: color-mix(in srgb, var(--tone) 10%, #fff); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--tone) 22%, transparent); }

.section-head { margin: 28px 4px 10px; }
.section-head h3 { font-size: 1.15rem; }

.rows { border: 1px solid rgba(16, 24, 40, 0.04); }
.row-main { padding: 13px 14px; grid-template-columns: 34px 1fr auto 12px 16px; }
.row-main:hover { background: #f0fdfa; }
.rows .icon { width: 34px; height: 34px; border-radius: 11px; background: #f2f4f7; color: #475467; }
.rows .icon.excellent, .rows .icon.good, .rows .icon.fair, .rows .icon.poor, .rows .icon.limited, .rows .icon.moderate {
  background: color-mix(in srgb, var(--tone) 14%, #fff);
  color: color-mix(in srgb, var(--tone) 70%, #000);
}
.rows .icon svg { width: 19px; height: 19px; }

/* ---------- History ---------- */

.summary {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-top: 16px;
  padding: 16px 18px;
  border-radius: 24px;
  color: #fff;
  background: linear-gradient(135deg, #164e63, #0b3445);
  box-shadow: 0 12px 30px rgba(16, 24, 40, 0.22);
}
.summary .ring-track { stroke: rgba(255, 255, 255, 0.14); }
.summary .ring-label b { color: #fff; }
.summary .ring-label small { color: rgba(255, 255, 255, 0.55); }
.summary-text strong { display: block; font-size: 1.05rem; font-weight: 575; letter-spacing: -0.01em; }
.summary-text small { display: block; margin-top: 3px; color: rgba(255, 255, 255, 0.66); font-size: 0.84rem; line-height: 1.35; }

.search-field {
  position: relative;
  display: flex;
  align-items: center;
  margin-top: 16px;
  color: var(--faint);
}
.search-field svg { position: absolute; left: 14px; pointer-events: none; }
.search-field input { margin: 0; padding: 13px 14px 13px 42px; border-radius: 16px; background: #fff; border-color: transparent; box-shadow: var(--shadow-sm); }
.search-field input::-webkit-search-cancel-button { cursor: pointer; }

.filter-chips { display: flex; gap: 8px; margin: 12px -18px 0; padding: 2px 18px 4px; overflow-x: auto; scrollbar-width: none; }
.filter-chips::-webkit-scrollbar { display: none; }
.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex: none;
  padding: 8px 14px;
  border-radius: 999px;
  background: #fff;
  color: #475467;
  font-size: 0.84rem;
  font-weight: 525;
  box-shadow: inset 0 0 0 1px var(--line);
}
.filter-chip .dot { width: 8px; height: 8px; }
.filter-chip.on { background: var(--brand-dark); color: #fff; box-shadow: none; }

.history { gap: 10px; }
.history .history-item {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  padding: 12px 14px 12px 12px;
  border-radius: 22px;
  background: var(--card);
  border: 1px solid rgba(16, 24, 40, 0.04);
  box-shadow: var(--shadow-sm);
  text-align: left;
}
.history .history-item { min-width: 0; }
.history .history-item:hover { box-shadow: var(--shadow-md); }
.history .thumb { width: 56px; height: 64px; border-radius: 16px; font-size: 1.2rem; }
.history .title { font-size: 0.98rem; }
.history .brand { margin: 1px 0 7px; font-size: 0.82rem; }
.history .side { align-items: center; justify-content: center; gap: 4px; }
.history .when { font-size: 0.68rem; font-weight: 500; color: var(--faint); }

.empty { padding: 56px 24px; }
.empty .art { width: 84px; height: 84px; border-radius: 28px; background: linear-gradient(150deg, #f0fdfa, #ccfbf1); box-shadow: 0 0 0 10px rgba(13, 148, 136, 0.06); margin-bottom: 20px; }
.empty h2 { font-size: 1.25rem; font-weight: 600; letter-spacing: -0.02em; }
.empty p { max-width: 280px; margin: 0 auto; line-height: 1.45; }
.empty .actions { max-width: 260px; margin: 22px auto 0; }
.empty.compact { padding: 36px 20px; }
.empty.compact .art { width: 64px; height: 64px; border-radius: 22px; background: #eef0f3; color: var(--faint); box-shadow: none; }

/* ---------- My list ---------- */

.signin-banner {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 4px 14px;
  align-items: center;
  margin-top: 16px;
  padding: 18px;
  border-radius: 24px;
  color: #fff;
  background:
    radial-gradient(240px 140px at 100% 0%, rgba(255, 255, 255, 0.22), transparent 70%),
    linear-gradient(140deg, #14b8a6, #164e63);
  box-shadow: 0 14px 30px rgba(13, 148, 136, 0.32);
}
.banner-icon { display: grid; place-items: center; width: 46px; height: 46px; border-radius: 15px; background: rgba(255, 255, 255, 0.2); }
.signin-banner strong { display: block; font-size: 1.05rem; font-weight: 575; }
.signin-banner small { display: block; margin-top: 2px; color: rgba(255, 255, 255, 0.85); font-size: 0.84rem; line-height: 1.35; }
.banner-btn { grid-column: 1 / -1; margin-top: 12px; padding: 12px; border-radius: 14px; background: #fff; color: var(--brand-dark); font-weight: 575; }
.banner-btn:hover { background: #f0fdfa; }

.card.setting { margin-top: 10px; padding: 16px; }
.setting-head { display: flex; gap: 12px; align-items: center; margin-bottom: 14px; }
.setting-icon { display: grid; place-items: center; flex: none; width: 40px; height: 40px; border-radius: 13px; background: var(--brand-soft); color: var(--brand-dark); }
.setting-title { margin: 0; font-weight: 575; font-size: 1rem; letter-spacing: -0.01em; }
.setting-head small { display: block; margin-top: 1px; color: var(--muted); font-size: 0.82rem; line-height: 1.35; }

.segment { background: #f2f4f7; border-radius: 14px; }
.segment button { padding: 10px 6px; font-size: 0.86rem; }
.segment button.on { box-shadow: 0 1px 2px rgba(16, 24, 40, 0.08), 0 2px 6px rgba(16, 24, 40, 0.08); }

.checks button { display: inline-flex; align-items: center; gap: 6px; padding: 9px 14px; background: #f2f4f7; font-size: 0.86rem; }
.checks button svg { display: none; }
.checks button.on { background: var(--brand-soft); border-color: var(--brand); color: var(--brand-dark); }
.checks button.on svg { display: block; }

.save-bar {
  position: sticky;
  bottom: calc(var(--tabbar) + 30px + env(safe-area-inset-bottom));
  z-index: 3;
  margin: 18px -18px 0;
  padding: 18px 18px 6px;
  background: linear-gradient(transparent, var(--bg) 35%);
}
.ghost.signout { display: flex; align-items: center; justify-content: center; gap: 8px; color: var(--poor); }

.account-card { border: 0; box-shadow: var(--shadow-md); margin-top: 16px; }
.account-head .avatar { background: linear-gradient(140deg, #14b8a6, var(--brand-dark)); box-shadow: 0 6px 16px rgba(13, 148, 136, 0.3); }
.opt-icon { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 10px; background: #f2f4f7; color: #475467; }

/* ---------- Overlays ---------- */

.toast { position: absolute; border-radius: 16px; background: rgba(16, 24, 40, 0.92); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); }
.dialog-backdrop { position: absolute; backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); }
.dialog { border-radius: 28px; }
.danger { border-radius: 16px; box-shadow: 0 8px 20px rgba(239, 90, 76, 0.3); }
.welcome { position: absolute; }

.sheet, .panel-body { scrollbar-width: none; }
.sheet::-webkit-scrollbar, .panel-body::-webkit-scrollbar { display: none; }

/* ---------- Ingredient picker ---------- */

.avoid-picker .ing-search { margin-top: 0; }
.avoid-picker .ing-search input { background: #f2f4f7; box-shadow: none; }
.avoid-picker .ing-search input:focus { background: #fff; }
.ing-results { display: grid; gap: 2px; margin-top: 6px; }
.ing-results:empty { display: none; }
.ing-option {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  padding: 11px 12px;
  border-radius: 12px;
  text-align: left;
}
.ing-option:hover, .ing-option:focus-visible { background: var(--brand-soft); }
.ing-option .ing-name { font-weight: 525; text-transform: capitalize; }
.ing-option small { color: var(--faint); font-size: 0.76rem; font-weight: 475; white-space: nowrap; }
.ing-option.added { opacity: 0.55; }
.ing-dym { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 8px 12px; color: var(--muted); font-size: 0.88rem; }
.ing-dym button { padding: 5px 11px; border-radius: 999px; background: #fff7e8; color: #8a5300; font-weight: 550; box-shadow: inset 0 0 0 1px #f6d9a6; }
.ing-dym button:hover { background: #fdecc8; }
.ing-request {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  width: 100%;
  margin-top: 4px;
  padding: 12px;
  border-radius: 14px;
  border: 1.5px dashed #d0d5dd;
  text-align: left;
  color: var(--ink);
}
.ing-request:hover { border-color: var(--brand); background: var(--brand-soft); }
.ing-request svg { flex: none; margin-top: 2px; color: var(--brand-dark); }
.ing-request strong { display: block; font-size: 0.92rem; }
.ing-request small { display: block; color: var(--muted); font-size: 0.8rem; margin-top: 1px; }
.ing-request:disabled { opacity: 0.6; }
.ing-problem { margin: 4px 0 0; padding: 10px 12px; border-radius: 12px; background: #fff4f3; color: #b42318; font-size: 0.86rem; font-weight: 475; }
.ing-hint { margin: 4px 0 0; padding: 8px 12px; color: var(--muted); font-size: 0.86rem; }
.ing-hint .link-btn { display: inline; padding: 0; font-size: inherit; }
.avoid-chips { margin-top: 12px; }
.avoid-chips .chip { display: inline-flex; align-items: center; gap: 6px; text-transform: capitalize; }
.avoid-chips .chip .x { display: grid; place-items: center; width: 18px; height: 18px; margin-right: -4px; border-radius: 50%; background: rgba(22, 78, 99, 0.15); }
.avoid-chips .chip.pending { background: #fff7e8; border-color: #f5b546; color: #8a5300; border-style: dashed; }
.avoid-chips .chip.pending .x { background: rgba(138, 83, 0, 0.12); }
.ing-note { margin: 10px 2px 0; color: var(--muted); font-size: 0.8rem; line-height: 1.4; }
.ing-note:empty { display: none; }

/* ---------- Admin ---------- */

.admin-tabs { margin-top: 16px; }
.admin-tabs button { display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.admin-tabs .count { min-width: 22px; padding: 1px 7px; border-radius: 999px; background: #e4e7ec; color: var(--muted); font-size: 0.72rem; font-weight: 550; }
.admin-tabs .count.pending:not(:empty) { background: #fdecc8; color: #8a5300; }
.admin-tabs button.on .count.pending { background: var(--fair); color: #fff; }
.admin-list { display: grid; gap: 10px; margin-top: 16px; }
.admin-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-radius: 18px;
  background: var(--card);
  border: 1px solid rgba(16, 24, 40, 0.04);
  box-shadow: var(--shadow-sm);
}
.admin-item.pending { flex-direction: column; align-items: stretch; border-left: 4px solid var(--fair); }
.admin-main strong { display: block; font-size: 1rem; text-transform: capitalize; }
.admin-main small { display: block; margin-top: 2px; color: var(--muted); font-size: 0.8rem; }
.admin-similar { display: flex; gap: 6px; align-items: center; margin: 8px 0 0; padding: 6px 10px; border-radius: 10px; background: #fff7e8; color: #8a5300; font-size: 0.8rem; font-weight: 500; }
.admin-controls { display: flex; align-items: center; gap: 8px; }
.admin-item.pending .admin-controls select { flex: 1; min-width: 0; margin: 0; padding: 10px 12px; border-radius: 12px; font-size: 0.86rem; }
.admin-btn { display: inline-flex; align-items: center; gap: 6px; padding: 10px 14px; border-radius: 12px; font-weight: 550; font-size: 0.86rem; }
.admin-btn.approve { background: var(--brand); color: #fff; }
.admin-btn.approve:hover { background: var(--brand-dark); }
.admin-btn.reject { background: #fff4f3; color: #b42318; }
.admin-btn.reject:hover { background: #fde4e1; }
.admin-nav { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.admin-nav button { flex: none; padding: 8px 12px; border-radius: 999px; background: #fff; color: var(--muted); font-weight: 550; font-size: 0.82rem; border: 1px solid var(--line); }
.admin-nav button.on { background: var(--ink); color: #fff; border-color: var(--ink); }
.admin-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 16px; }
.admin-stat { text-align: left; padding: 14px 16px; border-radius: 18px; background: var(--card); border: 1px solid rgba(16, 24, 40, 0.04); box-shadow: var(--shadow-sm); }
.admin-stat strong { display: block; font-size: 1.45rem; letter-spacing: -0.03em; }
.admin-stat small { display: block; margin-top: 2px; color: var(--muted); font-size: 0.78rem; font-weight: 525; }
.admin-callout { display: flex; gap: 12px; align-items: flex-start; width: 100%; margin-top: 12px; padding: 14px 16px; border-radius: 18px; background: #fff7e8; color: #8a5300; text-align: left; }
.admin-callout strong, .admin-callout small { display: block; }
.admin-callout small { margin-top: 2px; font-weight: 475; }
.admin-link { width: 100%; text-align: left; }
.admin-link svg { flex: none; color: var(--faint); }
.admin-form .pair { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.admin-form .pair label { margin-top: 0; }
.admin-detected p { margin: 0; color: var(--muted); font-size: 0.88rem; }
.admin-person strong { display: block; font-size: 1.15rem; }
.admin-person small, .admin-person p { display: block; margin: 2px 0 0; color: var(--muted); }
.allergen-card { align-items: flex-start; }
.term-details { margin-top: 8px; }
.term-details summary { cursor: pointer; font-weight: 525; color: var(--ink); }
.term-cloud { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.term-cloud span { padding: 4px 8px; border-radius: 999px; background: #f2f4f7; font-size: 0.78rem; text-transform: none; }
.ghost.danger { color: #b42318; }
.round-btn.small { width: 36px; height: 36px; }
.panel-body textarea { width: 100%; margin-top: 6px; padding: 14px 16px; border-radius: 14px; border: 1.5px solid var(--line); background: #ffffff; font-weight: 450; resize: vertical; outline: none; }
.add-result p { margin: 10px 0 0; padding: 10px 12px; border-radius: 12px; font-size: 0.88rem; line-height: 1.4; }
.add-result .ok { background: var(--brand-soft); color: var(--brand-dark); }
.add-result .skip { background: #f2f4f7; color: var(--muted); }
.add-result .bad { background: #fff4f3; color: #b42318; }

.avoid-chips .chip svg { display: block; }
.ing-results .ing-hint { margin-top: 0; }
.ing-hint .link-btn { line-height: inherit; vertical-align: baseline; margin: 0; }

/* ---------- App bar & drawer menu ---------- */

.app-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 44px; margin-bottom: 14px; }
.app-bar .back { margin-bottom: 0; }
.avatar { display: grid; place-items: center; flex: none; font-size: 0.92rem; letter-spacing: 0.02em; background: linear-gradient(140deg, #14b8a6, var(--brand-dark)); box-shadow: 0 4px 12px rgba(13, 148, 136, 0.3); }
.avatar.big { width: 52px; height: 52px; font-size: 1.15rem; }
.avatar.xl { width: 88px; height: 88px; font-size: 1.9rem; box-shadow: 0 0 0 6px #fff, 0 14px 30px rgba(13, 148, 136, 0.35); }
.bar-signin { padding: 10px 16px; border-radius: 999px; background: var(--brand-dark); color: #fff; font-weight: 550; font-size: 0.88rem; }
.bar-signin:hover { background: #0b3445; }
.top-start { display: flex; align-items: center; gap: 10px; min-width: 0; }
.menu-btn.icon-glass { width: 40px; height: 40px; }

.drawer-scrim { z-index: 30; }
.drawer {
  position: absolute;
  z-index: 31;
  top: 0;
  bottom: 0;
  left: 0;
  width: min(86%, 340px);
  display: flex;
  flex-direction: column;
  background: #fff;
  border-radius: 0 28px 28px 0;
  box-shadow: 20px 0 50px rgba(16, 24, 40, 0.22);
  padding-top: env(safe-area-inset-top);
  animation: drawer-in 0.26s var(--ease);
}
.drawer.closing { animation: drawer-out 0.18s ease-in forwards; }
.drawer-scrim.closing { animation: fade-out 0.18s ease-in forwards; }
@keyframes drawer-in { from { transform: translateX(-100%); } }
@keyframes drawer-out { to { transform: translateX(-100%); } }
@keyframes fade-out { to { opacity: 0; } }

.drawer-bar { display: flex; align-items: center; justify-content: space-between; padding: 16px 16px 6px 20px; }
.mark.dark { color: var(--ink); font-size: 0.98rem; }
.mark.dark .logo { width: 26px; height: 26px; color: #fff; }

.drawer-profile {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 8px 12px 6px;
  padding: 14px;
  border-radius: 20px;
  background: linear-gradient(150deg, #f0fdfa, #ffffff);
  text-align: left;
}
.drawer-profile:hover { background: linear-gradient(150deg, #ccfbf1, #f2f4f7); }
.drawer-who { display: grid; min-width: 0; }
.drawer-who strong { font-size: 1.02rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.drawer-who small { color: var(--muted); font-size: 0.82rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.drawer-link { display: inline-flex; align-items: center; gap: 2px; margin-top: 6px; color: var(--brand-dark); font-size: 0.8rem; font-weight: 550; }

.drawer-guest { margin: 8px 12px 6px; padding: 18px 16px; border-radius: 20px; background: linear-gradient(150deg, #f0fdfa, #ffffff); }
.drawer-logo { display: grid; place-items: center; width: 44px; height: 44px; margin-bottom: 12px; border-radius: 14px; background: var(--brand); color: #fff; }
.drawer-guest strong { display: block; font-size: 1.05rem; }
.drawer-guest small { display: block; margin-top: 4px; color: var(--muted); font-size: 0.85rem; line-height: 1.4; }
.drawer-guest-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 14px; }
.drawer-guest-actions .primary, .drawer-guest-actions .ghost { padding: 11px 10px; font-size: 0.88rem; border-radius: 13px; }

.drawer-scroll { flex: 1; overflow-y: auto; padding: 4px 12px 12px; scrollbar-width: none; }
.drawer-section { padding: 6px 0; border-top: 1px solid var(--line); }
.drawer-section:first-child { border-top: 0; }
.drawer-title { margin: 10px 12px 4px; color: var(--faint); font-size: 0.7rem; font-weight: 550; letter-spacing: 0.07em; text-transform: uppercase; }
.drawer-item {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  padding: 11px 12px;
  border-radius: 14px;
  color: #344054;
  font-weight: 500;
  font-size: 0.95rem;
  text-align: left;
}
.drawer-item:hover { background: #f2f4f7; }
.drawer-item.on { background: var(--brand-soft); color: var(--brand-dark); }
.drawer-item:active:not(:disabled) { transform: none; background: #eaecf0; }
.drawer-icon { display: grid; place-items: center; color: #667085; }
.drawer-item.on .drawer-icon { color: var(--brand-dark); }
.drawer-label { flex: 1; }
.drawer-badge { min-width: 22px; padding: 2px 7px; border-radius: 999px; background: var(--fair); color: #fff; font-size: 0.72rem; font-weight: 600; text-align: center; }

.drawer-foot { padding: 12px 16px calc(18px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); }
.drawer-signout { display: flex; align-items: center; gap: 12px; width: 100%; padding: 12px; border-radius: 14px; color: #b42318; font-weight: 550; }
.drawer-signout:hover { background: #fff4f3; }
.drawer-foot small { display: block; margin: 8px 12px 0; color: var(--faint); font-size: 0.72rem; }

/* ---------- Profile ---------- */

.profile-hero { display: flex; flex-direction: column; align-items: center; text-align: center; padding: 8px 0 6px; }
.profile-hero .avatar { margin-bottom: 16px; }
.profile-hero h1.display { margin: 0; font-size: 1.6rem; }
.profile-hero > p { margin: 4px 0 0; color: var(--muted); }
.profile-tags { display: flex; gap: 8px; margin-top: 12px; }
.profile-tag { display: inline-flex; align-items: center; gap: 5px; padding: 5px 11px; border-radius: 999px; background: var(--brand-soft); color: var(--brand-dark); font-size: 0.76rem; font-weight: 550; }
.profile-tag.admin { background: #eef4ff; color: #3538cd; }

.profile-card { margin-top: 22px; }
.card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.chip-btn { display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px; border-radius: 999px; background: #f2f4f7; color: var(--ink); font-weight: 550; font-size: 0.82rem; }
.chip-btn:hover { background: #e4e7ec; }
.profile-fact { display: flex; align-items: center; gap: 12px; padding: 11px 0; border-top: 1px solid var(--line); }
.profile-fact:nth-child(2) { border-top: 0; }
.profile-fact small { display: block; color: var(--faint); font-size: 0.74rem; font-weight: 500; }
.profile-fact strong { display: block; font-size: 0.95rem; word-break: break-word; }
.opt-text { display: grid; text-align: left; }
.opt-text small { color: var(--muted); font-size: 0.78rem; font-weight: 450; margin-top: 1px; }
.actions.row { flex-direction: row; }
.actions.row > * { flex: 1; }
.ghost.signout { width: 100%; margin-top: 26px; }

.dialog.tone-neutral .dialog-icon { background: #f2f4f7; color: var(--ink); }
.dialog.tone-neutral .danger { background: var(--ink); box-shadow: 0 8px 20px rgba(16, 24, 40, 0.2); }
.dialog.tone-neutral .danger:hover { background: #164e63; }

/* ---------- Overview ---------- */

.tabbar.five { grid-template-columns: repeat(5, 1fr); }
.tabbar.five button { font-size: 0.66rem; }
.tabbar.five .scan-tab span.bubble { width: 54px; height: 54px; }

.overview-head h1.display { margin-bottom: 2px; }
.overview-range { margin: 0; color: var(--muted); font-size: 0.9rem; font-weight: 500; }
.overview-range:empty::before { content: "\00a0"; }
.overview-period { max-width: 300px; margin: 14px auto 0; }
.overview-body { transition: opacity 0.2s; }
.overview-body.loading { opacity: 0.55; }

.plate-wrap { display: flex; align-items: center; justify-content: center; gap: 18px; margin: 22px 0 6px; }
.plate { width: min(58%, 220px); height: auto; filter: drop-shadow(0 14px 22px rgba(16, 24, 40, 0.14)); animation: plate-in 0.5s var(--ease); }
.cutlery { width: 24px; height: auto; flex: none; }
.plate .slice { fill: none; transition: stroke-dasharray 0.6s var(--ease); }
.plate .slice.excellent { stroke: var(--excellent); }
.plate .slice.good { stroke: var(--good); }
.plate .slice.fair { stroke: var(--fair); }
.plate .slice.poor { stroke: var(--poor); }
.plate .slice.blocked { stroke: var(--blocked); }
.plate .slice.unscored { stroke: var(--unscored); }
@keyframes plate-in { from { transform: scale(0.85) rotate(-20deg); opacity: 0; } }

.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 18px; }
.stat { padding: 14px 10px; border-radius: 18px; background: var(--card); box-shadow: var(--shadow-sm); text-align: center; }
.stat strong { display: block; font-size: 1.35rem; font-weight: 600; letter-spacing: -0.03em; }
.stat small { display: block; margin-top: 2px; color: var(--muted); font-size: 0.74rem; font-weight: 500; }

.overview-empty { margin-top: 16px; text-align: center; }
.overview-empty strong { display: block; font-size: 1.05rem; }
.overview-empty p { margin: 4px 0 14px; color: var(--muted); font-size: 0.9rem; }
.overview-empty .primary { max-width: 240px; margin: 0 auto; }

.grade-list { list-style: none; margin: 0; padding: 0; border-radius: var(--radius); background: var(--card); box-shadow: var(--shadow-sm); overflow: hidden; }
.grade-list li + li { border-top: 1px solid var(--line); }
.grade-row { display: grid; grid-template-columns: 14px 1fr 64px 28px 16px; align-items: center; gap: 12px; width: 100%; padding: 15px 16px; text-align: left; }
.grade-row:hover:not(:disabled) { background: #f0fdfa; }
.grade-row:disabled { cursor: default; }
.grade-row:disabled .chev { visibility: hidden; }
.grade-row .dot { width: 14px; height: 14px; }
.grade-name { font-weight: 525; }
.grade-bar { height: 6px; border-radius: 99px; background: #f2f4f7; overflow: hidden; }
.grade-bar span { display: block; height: 100%; border-radius: 99px; background: var(--tone); transition: width 0.6s var(--ease); }
.grade-count { color: var(--muted); font-weight: 550; text-align: right; }
.overview-note { margin: 12px 4px 0; }

/* ---------- My list preview (signed out) ---------- */

.preview-demo { margin-top: 16px; padding: 16px; border-radius: 24px; background: linear-gradient(160deg, #164e63, #0b3445); color: #fff; box-shadow: 0 14px 30px rgba(16, 24, 40, 0.22); }
.preview-label { margin: 0 0 10px; color: rgba(255, 255, 255, 0.55); font-size: 0.7rem; font-weight: 550; letter-spacing: 0.08em; text-transform: uppercase; }
.preview-product { display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: 18px; background: #fff; color: var(--ink); }
.preview-product .thumb { width: 50px; height: 56px; border-radius: 14px; font-size: 1.05rem; }
.preview-info { flex: 1; min-width: 0; display: grid; gap: 3px; justify-items: start; }
.preview-info strong { font-size: 0.95rem; }
.preview-info small { color: var(--muted); font-size: 0.76rem; }
.preview-reason { display: flex; align-items: center; gap: 8px; margin: 12px 2px 0; color: #fecdca; font-size: 0.86rem; font-weight: 500; }

.preview-feature { margin-top: 10px; padding: 16px; border-radius: var(--radius); background: var(--card); border: 1px solid rgba(16, 24, 40, 0.04); box-shadow: var(--shadow-sm); }
.preview-feature .setting-head { margin-bottom: 12px; }
.preview-chips { pointer-events: none; }
.chip-sample { display: inline-flex; align-items: center; gap: 5px; padding: 7px 12px; border-radius: 999px; background: #f2f4f7; color: #667085; font-weight: 500; font-size: 0.8rem; border: 1.5px solid transparent; }
.chip-sample.on { background: var(--brand-soft); border-color: var(--brand); color: var(--brand-dark); }

.preview-cta { position: sticky; bottom: calc(var(--tabbar) + 30px + env(safe-area-inset-bottom)); z-index: 3; display: grid; gap: 8px; margin-top: 18px; padding: 18px; border-radius: 24px; background: rgba(255, 255, 255, 0.96); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); box-shadow: 0 12px 34px rgba(16, 24, 40, 0.16); text-align: center; }
.preview-cta strong { font-size: 1.02rem; }
.preview-cta small { margin-bottom: 6px; color: var(--muted); font-size: 0.84rem; }
.preview-cta { position: static; background: #fff; backdrop-filter: none; -webkit-backdrop-filter: none; box-shadow: var(--shadow-md); }

/* ---------- Glass switches and visible field borders ---------- */

input:not([type="checkbox"]):not([type="radio"]):not([type="range"]), select, textarea,
.search-field input, .avoid-picker .ing-search input, .panel-body textarea {
  border: 1.5px solid #cbd5e1;
  background: #fff;
}
input:not([type="checkbox"]):not([type="radio"]):hover, select:hover, textarea:hover { border-color: #94a3b8; }
input:focus, select:focus, textarea:focus,
.search-field input:focus, .avoid-picker .ing-search input:focus { border-color: var(--brand); box-shadow: 0 0 0 4px rgba(13, 148, 136, 0.16); background: #fff; }

.segment {
  position: relative;
  background: linear-gradient(180deg, rgba(13, 148, 136, 0.1), rgba(22, 78, 99, 0.08));
  border: 1px solid rgba(13, 148, 136, 0.16);
  box-shadow: inset 0 1px 2px rgba(22, 78, 99, 0.08);
  backdrop-filter: blur(10px) saturate(160%);
  -webkit-backdrop-filter: blur(10px) saturate(160%);
}
.segment button { transition: background 0.25s var(--ease), color 0.2s, box-shadow 0.25s var(--ease), transform 0.15s; }
.segment button:active { transform: scale(0.97); }
.segment button.on {
  color: var(--brand-dark);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.95), rgba(255, 255, 255, 0.6));
  border: 1px solid rgba(255, 255, 255, 0.9);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 1), 0 2px 6px rgba(22, 78, 99, 0.1), 0 6px 16px rgba(13, 148, 136, 0.14);
  backdrop-filter: blur(14px) saturate(180%);
  -webkit-backdrop-filter: blur(14px) saturate(180%);
}

.checks button, .filter-chip {
  transition: background 0.25s var(--ease), color 0.2s, border-color 0.2s, box-shadow 0.25s var(--ease), transform 0.15s;
}
.checks button { background: rgba(255, 255, 255, 0.7); border: 1.5px solid #e2e8f0; }
.checks button:active, .filter-chip:active { transform: scale(0.96); }
.checks button.on, .chip-sample.on {
  color: var(--brand-dark);
  background: linear-gradient(160deg, rgba(204, 251, 241, 0.95), rgba(13, 148, 136, 0.16));
  border-color: rgba(13, 148, 136, 0.55);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9), 0 4px 12px rgba(13, 148, 136, 0.18);
  backdrop-filter: blur(12px) saturate(170%);
  -webkit-backdrop-filter: blur(12px) saturate(170%);
}
.filter-chip.on {
  color: #fff;
  background: linear-gradient(160deg, rgba(13, 148, 136, 0.92), rgba(22, 78, 99, 0.92));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35), 0 6px 16px rgba(22, 78, 99, 0.25);
  backdrop-filter: blur(12px) saturate(170%);
  -webkit-backdrop-filter: blur(12px) saturate(170%);
}

/* ---------- Email verification ---------- */

.verify-pill { display: inline-flex; align-items: center; gap: 5px; padding: 5px 10px; border-radius: 999px; font-size: 0.78rem; font-weight: 550; white-space: nowrap; }
.verify-pill.small { padding: 3px 8px; font-size: 0.7rem; gap: 4px; }
.verify-pill.ok { background: #dcfce7; color: #15803d; }
.verify-pill.pending { background: #fef3c7; color: #b45309; }
.drawer-who .verify-pill { justify-self: start; margin-top: 4px; }
.profile-fact .verify-pill { margin-left: auto; align-self: center; }

.verify-banner { display: flex; align-items: center; gap: 12px; width: 100%; margin: 4px 0 14px; padding: 12px 14px; border-radius: 18px; text-align: left; background: linear-gradient(150deg, #fffbeb, #fef3c7); border: 1px solid #fde68a; box-shadow: 0 4px 14px rgba(245, 158, 11, 0.12); color: #92400e; }
.verify-banner:hover { border-color: #fbbf24; }
.verify-banner-icon { display: grid; place-items: center; flex: none; width: 36px; height: 36px; border-radius: 12px; background: #fff; color: #d97706; box-shadow: 0 1px 3px rgba(146, 64, 14, 0.12); }
.verify-banner-text { flex: 1; min-width: 0; display: grid; gap: 1px; }
.verify-banner-text strong { font-size: 0.9rem; }
.verify-banner-text small { color: #a16207; font-size: 0.78rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.verify-banner .chev { color: #d97706; }

.verify-inline { display: flex; align-items: center; gap: 10px; margin: -2px 0 8px 46px; padding: 10px 12px; border-radius: 14px; background: #fffbeb; border: 1px solid #fde68a; }
.verify-inline p { flex: 1; margin: 0; color: #92400e; font-size: 0.8rem; line-height: 1.35; }
.verify-inline .chip-btn { flex: none; }

.profile-tag.pending { background: #fef3c7; color: #b45309; cursor: pointer; }

.verify-card { display: grid; justify-items: center; gap: 10px; margin-top: 18px; padding: 30px 22px 22px; border-radius: 26px; background: #fff; box-shadow: var(--shadow-md); text-align: center; }
.verify-card .display { margin: 4px 0 0; font-size: 1.7rem; }
.verify-card .hint { margin: 0; max-width: 34ch; line-height: 1.5; }
.verify-card .hint strong { color: var(--ink); overflow-wrap: anywhere; white-space: nowrap; }
.verify-card .actions { width: 100%; margin-top: 10px; display: grid; gap: 8px; }
.verify-art { display: grid; place-items: center; width: 76px; height: 76px; margin-bottom: 4px; border-radius: 26px; color: var(--brand-dark); background: linear-gradient(150deg, #f0fdfa, #ccfbf1); box-shadow: 0 0 0 10px rgba(13, 148, 136, 0.06); }
.verify-art.ok { color: #fff; background: linear-gradient(150deg, #22c55e, #16a34a); box-shadow: 0 0 0 10px rgba(22, 163, 74, 0.1), 0 10px 24px rgba(22, 163, 74, 0.25); }
.verify-art.bad { color: #b91c1c; background: linear-gradient(150deg, #fef2f2, #fee2e2); box-shadow: 0 0 0 10px rgba(220, 38, 38, 0.06); }
.verify-tips { margin: 4px 0 0; padding: 12px 14px 12px 32px; width: 100%; border-radius: 16px; background: var(--bg); color: var(--muted); font-size: 0.84rem; text-align: left; line-height: 1.6; }
.verify-foot { display: flex; justify-content: space-between; width: 100%; margin-top: 6px; padding-top: 12px; border-top: 1px solid var(--line); }
.verify-foot .text-btn { font-size: 0.84rem; }

/* ---------- Ingredient suggestions ---------- */

.ing-suggest { display: flex; align-items: center; gap: 12px; margin: 4px 0 6px; padding: 12px 12px 12px 14px; border-radius: 16px; background: linear-gradient(150deg, #f0fdfa, #ffffff); border: 1.5px solid rgba(13, 148, 136, 0.35); box-shadow: 0 4px 14px rgba(13, 148, 136, 0.1); }
.ing-suggest-icon { display: grid; place-items: center; flex: none; width: 36px; height: 36px; border-radius: 12px; background: var(--brand-soft); color: var(--brand-dark); }
.ing-suggest-text { flex: 1; min-width: 0; display: grid; gap: 2px; }
.ing-suggest-text > span { color: var(--ink); font-size: 0.95rem; }
.ing-suggest-text strong { color: var(--brand-dark); }
.ing-suggest-text small { color: var(--muted); font-size: 0.78rem; }
.ing-suggest-text .link-btn { display: inline; padding: 0; margin: 0; font-size: inherit; line-height: inherit; vertical-align: baseline; }
.ing-suggest-add.ing-option { flex: none; display: inline-flex; align-items: center; gap: 4px; width: auto; padding: 9px 14px; border-radius: 999px; background: var(--brand); color: #fff; font-weight: 550; font-size: 0.86rem; box-shadow: 0 4px 12px rgba(13, 148, 136, 0.3); }
.ing-suggest-add.ing-option:hover, .ing-suggest-add.ing-option:focus-visible { background: var(--brand-dark); }
.ing-suggest-add.ing-option:disabled { background: #e2e8f0; color: var(--muted); box-shadow: none; }

.ing-dym { padding: 6px 4px; font-size: 0.82rem; }
.ing-dym button, .ing-popular-chips button { display: inline-flex; align-items: center; gap: 4px; padding: 6px 11px; border-radius: 999px; background: #fff; color: var(--brand-dark); font-weight: 525; font-size: 0.82rem; box-shadow: inset 0 0 0 1.5px #cbd5e1; transition: background 0.2s, box-shadow 0.2s; }
.ing-dym button:hover, .ing-popular-chips button:hover { background: var(--brand-soft); box-shadow: inset 0 0 0 1.5px var(--brand); }
.ing-dym button svg, .ing-popular-chips button svg { color: var(--brand); }

.ing-popular { margin-top: 12px; }
.ing-popular-title { margin: 0 2px 8px; color: var(--faint); font-size: 0.72rem; font-weight: 550; letter-spacing: 0.06em; text-transform: uppercase; }
.ing-popular-chips { display: flex; flex-wrap: wrap; gap: 6px; }

/* ---------- Connection status ---------- */

.net-bar { position: absolute; top: calc(12px + env(safe-area-inset-top)); left: 12px; right: 12px; z-index: 60; display: flex; align-items: center; gap: 10px; padding: 10px 10px 10px 12px; border-radius: 18px; background: rgba(31, 41, 55, 0.92); color: #fff; box-shadow: 0 12px 30px rgba(16, 24, 40, 0.28); backdrop-filter: blur(14px) saturate(160%); -webkit-backdrop-filter: blur(14px) saturate(160%); animation: net-in 0.3s var(--ease); }
.net-bar.ok { background: rgba(22, 163, 74, 0.94); }
.net-bar.leaving { opacity: 0; transform: translateY(-10px); transition: opacity 0.25s, transform 0.25s; }
.net-icon { display: grid; place-items: center; flex: none; width: 32px; height: 32px; border-radius: 11px; background: rgba(255, 255, 255, 0.14); }
.net-bar:not(.ok) .net-icon { color: #fcd34d; }
.net-text { flex: 1; min-width: 0; display: grid; gap: 1px; }
.net-text strong, .net-bar.ok strong { font-size: 0.88rem; }
.net-text small { color: rgba(255, 255, 255, 0.7); font-size: 0.76rem; }
.net-retry { flex: none; padding: 8px 14px; border-radius: 999px; background: #fff; color: var(--brand-dark); font-weight: 550; font-size: 0.82rem; }
.net-retry:disabled { opacity: 0.7; }
@keyframes net-in { from { opacity: 0; transform: translateY(-12px); } to { opacity: 1; transform: none; } }

.cant-connect .page-inner { min-height: 100%; display: grid; align-content: center; }
.cant-connect .verify-art { color: #b45309; background: linear-gradient(150deg, #fffbeb, #fef3c7); box-shadow: 0 0 0 10px rgba(245, 158, 11, 0.08); }
.cant-connect .meta { margin: 4px 0 0; }
.cant-connect .page-inner { padding-top: 96px; align-content: start; }

/* Allergens: only the shopper's own list up front, the full label on request */
.allergen-clear {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 10px 4px 0;
  color: var(--excellent);
  font-size: 0.86rem;
  font-weight: 500;
}
.allergen-empty {
  display: grid;
  gap: 12px;
  padding: 16px;
  border-radius: 18px;
  background: #fff;
  border: 1px dashed #cbd5e1;
}
.allergen-empty p { margin: 0; color: var(--muted); font-size: 0.9rem; }
.allergen-empty .ghost { width: auto; justify-self: start; padding: 10px 16px; background: var(--brand-soft); color: var(--brand-dark); }
details.allergen-all {
  margin-top: 14px;
  border-radius: 18px;
  background: #fff;
  border: 1px solid var(--line);
  overflow: hidden;
}
details.allergen-all summary {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px 16px;
  cursor: pointer;
  list-style: none;
  font-weight: 525;
  color: var(--ink);
}
details.allergen-all summary::-webkit-details-marker { display: none; }
details.allergen-all summary span { flex: 1; }
details.allergen-all summary small { color: var(--faint); font-size: 0.78rem; font-weight: 450; }
details.allergen-all summary svg { transform: rotate(-90deg); transition: transform 0.2s; color: var(--muted); }
details.allergen-all[open] summary svg { transform: rotate(90deg); }
details.allergen-all > :not(summary) { margin-left: 12px; margin-right: 12px; }
details.allergen-all > :last-child { margin-bottom: 14px; }
.allergen-group { margin: 4px 4px 8px; font-size: 0.8rem; font-weight: 500; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
.allergen-group:not(:first-of-type) { margin-top: 14px; }


.desktop-intro .intro-logo { overflow: hidden; background: none; }
.desktop-intro .intro-logo img { display: block; width: 100%; height: 100%; }

/* Installed to the home screen: no rubber-band page bounce or long-press callouts on controls */
@media (display-mode: standalone) {
  html, body { overscroll-behavior: none; }
  button, .tabbar, .chip, .filter-chip { -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; }
}

/* My list preview for signed-out visitors: make it obvious the settings need an account */
.signin-note { display: flex; align-items: center; gap: 12px; margin-top: 16px; padding: 12px 12px 12px 14px; border-radius: 18px; background: #fffbeb; border: 1px solid #fde68a; }
.signin-note > div { flex: 1; min-width: 0; display: grid; gap: 2px; }
.signin-note strong { font-size: 0.92rem; font-weight: 550; color: #78350f; }
.signin-note small { color: #92400e; font-size: 0.8rem; line-height: 1.35; }
.signin-note-icon { display: grid; place-items: center; flex: none; width: 36px; height: 36px; border-radius: 12px; background: #fff; color: #b45309; }
.signin-note .chip-btn { flex: none; background: #fff; color: #78350f; }
button.preview-feature { display: block; width: 100%; text-align: left; font: inherit; color: inherit; cursor: pointer; transition: transform 0.15s, box-shadow 0.15s; }
button.preview-feature:hover { box-shadow: var(--shadow-md); }
button.preview-feature:active { transform: scale(0.985); }
.preview-feature .setting-head { align-items: flex-start; }
.preview-feature .setting-head > div { flex: 1; min-width: 0; }
.lock-pill { display: inline-flex; align-items: center; gap: 4px; flex: none; padding: 4px 9px; border-radius: 999px; background: #f1f5f9; color: var(--muted); font-size: 0.72rem; font-weight: 500; }
.preview-feature.locked .preview-chips { opacity: 0.75; }
.locked-art { display: grid; place-items: center; width: 56px; height: 56px; margin: 6px 0 12px; border-radius: 18px; background: var(--brand-soft); color: var(--brand-dark); }
