/* A two-step food scanner, scoped to Nutrition in the web and native shells. */
#section-nutrition .nbs-launch {
  min-height: 44px; display: inline-flex; align-items: center; justify-content: center;
  gap: 8px; border-radius: 12px; padding-inline: 15px;
}
.nbs-launch svg, .nbs-dialog button svg {
  width: 19px; height: 19px; flex: none; fill: none; stroke: currentColor;
  stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round;
}
.nbs-dialog {
  --nbs-bg: #fff; --nbs-surface: #f2f7f5; --nbs-ink: #182c32;
  --nbs-muted: #4e6264; --nbs-border: #cbdcd7; --nbs-accent: #17684e;
  --nbs-button: #18654d; --nbs-button-ink: #fff; --nbs-notice: #154a39;
  --nbs-notice-bg: #eaf4ef; --nbs-visual: #e2f2eb; --nbs-scan-line: #127857;
  color-scheme: light; color: var(--nbs-ink); background: var(--nbs-bg);
  box-sizing: border-box; padding: 0; margin: auto; width: min(530px, calc(100% - 32px));
  max-width: none; max-height: calc(100vh - 36px); max-height: calc(100dvh - 36px); border: 1px solid var(--nbs-border);
  border-radius: 24px; overflow: hidden; box-shadow: 0 22px 80px #071b2548;
}
html[data-theme="dark"] .nbs-dialog {
  --nbs-bg: #172923; --nbs-surface: #203731; --nbs-ink: #eff9f5;
  --nbs-muted: #bbd2c9; --nbs-border: #46645b; --nbs-accent: #b8f0db;
  --nbs-button: #a5e7cc; --nbs-button-ink: #14352a; --nbs-notice: #e1f8ec;
  --nbs-notice-bg: #27463b; --nbs-visual: #1f4135; --nbs-scan-line: #b2f5d7;
  color-scheme: dark;
}
.nbs-dialog.nbs-inline {
  display: block; position: relative; inset: auto; width: 100%; max-height: none;
  margin: 0 0 16px; border-radius: 16px; box-shadow: none;
}
.nbs-dialog.nbs-inline .nbs-body { overflow: visible; }
.nbs-dialog::backdrop { background: #061b26a6; }
.nbs-dialog [hidden], .nbs-dialog[hidden] { display: none !important; }
.nbs-shell { display: flex; flex-direction: column; max-height: inherit; }
.nbs-header {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  flex: none; border-bottom: 1px solid var(--nbs-border); padding: 16px 20px 14px;
}
.nbs-dialog :is(h3,h4,p,dl,dd) { margin: 0; }
.nbs-header h3 { color: var(--nbs-ink); font-size: clamp(22px, 5vw, 27px); line-height: 1.15; letter-spacing: -.025em; }
.nbs-header h3:focus { outline: none; } /* Programmatic focus; not an interactive control. */
.nbs-eyebrow { color: var(--nbs-accent); font-weight: 750; font-size:16px; letter-spacing: .045em; margin-bottom: 5px !important; }
.nbs-dialog button { box-sizing: border-box; margin: 0; font: inherit; font-weight: 700; min-height: 44px; text-transform: none; }
.nbs-dialog .nbs-icon-button {
  display: grid; place-items: center; padding: 0; width: 44px; border-radius: 50%;
  background: var(--nbs-surface); color: var(--nbs-ink); border: 1px solid var(--nbs-border);
}
.nbs-body { min-height: 0; overflow: auto; overscroll-behavior: contain; padding: 18px 20px 0; }
.nbs-scan, .nbs-review { display: grid; gap: 13px; margin: 0; }
.nbs-scan { padding-bottom: 18px; }
.nbs-visual {
  display: grid; place-items: center; min-height: 104px; border-radius: 16px; color: var(--nbs-accent);
  background: radial-gradient(ellipse at 50% 25%, var(--nbs-bg) 0%, var(--nbs-visual) 76%);
  border: 1px solid var(--nbs-border);
}
.nbs-barcode { width: 103px; height: 77px; stroke-width: 2.5; stroke: currentColor; stroke-linecap: round; fill: none; }
.nbs-barcode .nbs-line { stroke: var(--nbs-scan-line); stroke-width: 1.7; }
.nbs-intro { text-align: center; }
.nbs-intro h4 { font-size: 17px; margin-bottom: 3px; }
.nbs-intro p, .nbs-product p, .nbs-privacy, .nbs-total-message { color: var(--nbs-muted); font-size:16px; line-height: 1.45; }
.nbs-dialog .nbs-primary {
  display: flex; align-items: center; justify-content: center; gap: 9px;
  width: 100%; min-height: 49px; background: var(--nbs-button); color: var(--nbs-button-ink);
  border: 1px solid var(--nbs-button); border-radius: 12px; padding: 9px 12px;
}
.nbs-dialog button:disabled { opacity: .55; cursor: not-allowed; }
.nbs-dialog .nbs-link { justify-self: center; color: var(--nbs-accent); background: transparent; padding: 6px 10px; border: 0; }
.nbs-dialog .nbs-secondary {
  background: var(--nbs-surface); color: var(--nbs-accent); border: 1px solid var(--nbs-border);
  border-radius: 10px; padding: 7px 12px;
}
.nbs-scan > .nbs-privacy, .nbs-footer > .nbs-privacy { text-align: center; }
.nbs-options { border: 1px solid var(--nbs-border); border-radius: 12px; }
.nbs-options > summary { min-height: 44px; box-sizing: border-box; padding: 12px; color: var(--nbs-accent); font-size:16px; font-weight: 700; cursor: pointer; }
.nbs-options > :not(summary) { margin: 0 12px 12px; }
.nbs-code-form { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: 8px; }
.nbs-dialog label { display: grid; gap: 5px; min-width: 0; color: var(--nbs-ink); font-size:16px; font-weight: 675; }
.nbs-dialog :is(input:not([type="file"]),select) {
  width: 100%; box-sizing: border-box; min-height: 44px; min-width: 0; margin: 0; padding: 7px 10px;
  color: var(--nbs-ink); background: var(--nbs-bg); border: 1px solid var(--nbs-border);
  border-radius: 10px; font: inherit; font-size: 16px;
}
.nbs-dialog :is(button,input,select,summary,a):focus-visible { outline: 2px solid var(--nbs-accent); outline-offset: 2px; }
.nbs-dialog .nbs-status { border-radius: 9px; padding: 8px 10px; color: var(--nbs-notice); background: var(--nbs-notice-bg); font-size:16px; }
.nbs-dialog :is(.nbs-status,.nbs-total-message):empty { display: none; }
.nbs-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 9px; }
.nbs-product { display: grid; gap: 5px; }
.nbs-product input { font-weight: 750 !important; }
.nbs-totals { background: var(--nbs-surface); border: 1px solid var(--nbs-border); border-radius: 14px; padding: 12px; }
.nbs-totals h4 { font-size:16px; margin-bottom: 6px; }
.nbs-total-message { margin-bottom: 7px !important; }
.nbs-macros { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 5px; }
.nbs-macros dt { color: var(--nbs-muted); font-size:16px; }
.nbs-macros dd { color: var(--nbs-ink); font-size:16px; font-weight: 750; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.nbs-dialog a { color: var(--nbs-accent); text-decoration: underline; }
.nbs-footer {
  display: grid; gap: 6px; position: sticky; bottom: 0; z-index: 1; margin-inline: -20px;
  padding: 10px 20px max(12px, env(safe-area-inset-bottom, 0px)); background: var(--nbs-bg);
  border-top: 1px solid var(--nbs-border);
}
@media (max-width: 550px) {
  .nbs-dialog {
    width: 100%; margin: auto 0 0; border-radius: 23px 23px 0 0;
    max-height: calc(100vh - 15px);
    max-height: calc(100dvh - max(15px, env(safe-area-inset-top, 0px)));
  }
  .nbs-body { padding-top: 14px; }
  .nbs-scan { padding-bottom: max(14px,env(safe-area-inset-bottom,0px)); }
  #section-nutrition .nbs-launch { order: -1; }
}
@media (max-width: 340px) {
  .nbs-code-form { grid-template-columns: 1fr; }
  .nbs-macros { grid-template-columns: repeat(2,minmax(0,1fr)); }
}


/* Guide and video share a coordinate space; the decoder only reads inside the guide. */
.nbs-live { position: relative; overflow: hidden; isolation: isolate; background: #071812; border-radius: 16px; height: clamp(160px, 28vh, 265px); height: clamp(160px, 28dvh, 265px); }
.nbs-live video { display: block; width: 100%; height: 100%; object-fit: cover; object-position: center; }
.nbs-guide { position: absolute; inset: 25% 8%; pointer-events: none; box-shadow: 0 0 0 500px #05191388; border-radius: 9px; }
.nbs-guide i { position: absolute; width: 23px; height: 21px; border: 3px solid #d1ffee; }
.nbs-guide i:nth-child(1) { top: 0; left: 0; border-right: 0; border-bottom: 0; border-top-left-radius: 9px; }
.nbs-guide i:nth-child(2) { top: 0; right: 0; border-left: 0; border-bottom: 0; border-top-right-radius: 9px; }
.nbs-guide i:nth-child(3) { bottom: 0; left: 0; border-right: 0; border-top: 0; border-bottom-left-radius: 9px; }
.nbs-guide i:nth-child(4) { bottom: 0; right: 0; border-left: 0; border-top: 0; border-bottom-right-radius: 9px; }
.nbs-guide span { position: absolute; top: 50%; left: 7%; right: 7%; height: 2px; background: #9fffe0c9; box-shadow: 0 0 4px #104b43; }
