/* Nutrition diary + product editor + barcode overlay */

/* Page title is redundant with the left nav; reclaim vertical space. */
st0rm-page#nutrition > st0rm-headline {
  display: none;
}

.nutrition-root {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  padding: 0.35rem 0.75rem 5rem;
  max-width: 720px;
  margin: 0 auto;
  width: 100%;
  box-sizing: border-box;
}

.nutrition-toolbar {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 0.3rem;
  padding: 0.1rem 0 0.15rem;
}

.nutrition-toolbar .nut-toolbar-extra {
  flex: 0 0 auto;
  padding: 0.35rem 0.55rem;
  font-size: 0.9rem;
}

.nutrition-toolbar .nut-date-btn {
  min-width: 0;
  padding: 0.35rem 0.5rem;
}

.nut-icon-btn,
.nut-date-btn,
.nut-btn,
.nut-btn-ghost,
.nut-btn-primary,
.nut-btn-danger,
.nut-fab-sm {
  font: inherit;
  border-radius: 10px;
  border: 1px solid color-mix(in srgb, var(--st0rm-accent, #ffa23a) 45%, transparent);
  background: var(--st0rm-bg, var(--textfield-background, #fff));
  color: var(--textfield-textcolor, var(--st0rm-fg, #eee));
  padding: 0.4rem 0.65rem;
  min-height: 40px;
  cursor: pointer;
  box-sizing: border-box;
}

html.agentic .nut-icon-btn,
html.agentic .nut-date-btn,
html.agentic .nut-btn,
html.agentic .nut-btn-ghost,
html.agentic .nut-btn-primary,
html.agentic .nut-btn-danger,
html.agentic .nut-fab-sm {
  border-color: color-mix(in srgb, var(--st0rm-fg, #eee) 18%, transparent);
  background: color-mix(in srgb, var(--st0rm-bg, #1a1a1a) 80%, #333);
  color: var(--st0rm-fg, #eee);
}

.nut-icon-btn {
  width: 40px;
  min-width: 40px;
  font-size: 1.25rem;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.3rem;
}

.nut-date-btn {
  font-weight: 600;
  flex: 1 1 auto;
  min-width: 7rem;
}

.nut-btn-primary {
  background: var(--st0rm-accent, #ffa23a);
  color: var(--on-accent, #1a1420);
  border-color: transparent;
  font-weight: 600;
}

html.agentic .nut-btn-primary {
  background: var(--st0rm-accent, #ffa23a);
  color: #1a1a1a;
  border-color: transparent;
}

.nut-btn-danger {
  background: color-mix(in srgb, #e44 35%, transparent);
  border-color: #e44;
}
#nut-editor-delete {
  margin-right: auto;
}

.nut-btn-ghost {
  background: transparent;
}

.nut-fab-sm {
  width: 2rem;
  height: 2rem;
  border-radius: 999px;
  font-size: 1.2rem;
  line-height: 1;
  padding: 0;
  background: var(--st0rm-accent, #ffa23a);
  color: #1a1a1a;
  border: none;
}

.nut-status {
  min-height: 0;
  font-size: 0.9rem;
  opacity: 0.85;
}
.nut-status:empty {
  display: none;
}
.nut-err {
  color: #ff6b6b !important;
}
.nut-catalog-hint.nut-catalog-exists {
  color: color-mix(in srgb, #6dcea8 70%, var(--aia-text, #e8eef8));
}
.nut-catalog-hint.nut-catalog-new {
  color: color-mix(in srgb, var(--aia-accent, #ffa23a) 65%, var(--aia-text, #e8eef8));
}

.nut-muted {
  color: var(--text-dim, color-mix(in srgb, var(--st0rm-fg, #eee) 78%, transparent));
  font-size: 0.85rem;
}
.nut-attr {
  font-size: 0.8rem;
  color: var(--text-dim, color-mix(in srgb, var(--st0rm-fg, #eee) 78%, transparent));
}

html.agentic .nut-muted {
  color: inherit;
  opacity: 0.65;
}
html.agentic .nut-attr {
  color: inherit;
  opacity: 0.7;
}

#nutrition_masterbox,
.nutrition-page,
st0rm-page#nutrition {
  position: relative;
}

.nut-summary {
  --nut-status: var(--st0rm-accent, #ffa23a);
  display: flex;
  gap: 1rem;
  align-items: center;
  padding: 0.75rem;
  border-radius: 16px;
  width: 100%;
  box-sizing: border-box;
  border: none;
  margin: 0;
  text-align: left;
  font: inherit;
  color: inherit;
  cursor: pointer;
  background: color-mix(in srgb, var(--st0rm-fg, #fff) 6%, transparent);
}
.nut-summary[data-status='ok'] { --nut-status: #4ade80; }
.nut-summary[data-status='warn'] { --nut-status: #fbbf24; }
.nut-summary[data-status='over'] { --nut-status: #f87171; }

.nut-ring {
  --pct: 0;
  width: 96px;
  height: 96px;
  border-radius: 50%;
  background: conic-gradient(
    var(--nut-status, var(--st0rm-accent, #ffa23a)) calc(var(--pct) * 1%),
    color-mix(in srgb, var(--st0rm-fg, #fff) 12%, transparent) 0
  );
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.nut-ring-inner {
  width: 74px;
  height: 74px;
  border-radius: 50%;
  background: var(--st0rm-bg, #1a1a1a);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  line-height: 1.15;
}
.nut-ring-inner strong {
  font-size: 1.15rem;
}

.nut-summary-side {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.nut-macros {
  display: grid;
  gap: 0.45rem;
}
button.nut-macro {
  --nut-status: var(--st0rm-accent, #ffa23a);
  display: block;
  width: 100%;
  margin: 0;
  padding: 0;
  border: none;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}
button.nut-macro[data-status='ok'] { --nut-status: #4ade80; }
button.nut-macro[data-status='warn'] { --nut-status: #fbbf24; }
button.nut-macro[data-status='over'] { --nut-status: #f87171; }

.nut-macro-head {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  margin-bottom: 0.15rem;
}
.nut-macro-val.is-over {
  color: #f87171;
  font-weight: 600;
}
.nut-bar {
  position: relative;
  display: flex;
  height: 8px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--st0rm-fg, #fff) 12%, transparent);
  overflow: hidden;
}
.nut-bar-fill {
  height: 100%;
  flex: 0 0 auto;
  background: var(--nut-status, var(--st0rm-accent, #ffa23a));
  border-radius: inherit;
  min-width: 0;
}
.nut-bar-over {
  height: 100%;
  flex: 0 0 auto;
  min-width: 0;
  border-radius: 0;
}
.nut-bar-over.is-cap-over {
  background: #f87171;
}
.nut-bar-over.is-min-over {
  background: #4ade80;
}
.nut-bar-mark {
  position: absolute;
  top: -1px;
  bottom: -1px;
  left: 66.666%;
  width: 2px;
  margin-left: -1px;
  background: color-mix(in srgb, var(--st0rm-fg, #fff) 85%, transparent);
  border-radius: 1px;
  pointer-events: none;
  z-index: 1;
}
.nut-bar.is-capped::after {
  content: '';
  position: absolute;
  right: 2px;
  top: 50%;
  width: 0;
  height: 0;
  border-top: 3px solid transparent;
  border-bottom: 3px solid transparent;
  border-left: 4px solid color-mix(in srgb, var(--st0rm-fg, #fff) 90%, transparent);
  transform: translateY(-50%);
  z-index: 2;
}

.nut-info-pop {
  position: absolute;
  z-index: 40;
  max-width: min(280px, calc(100% - 16px));
  padding: 0;
  border-radius: 12px;
  background: var(--st0rm-bg, #1a1a1a);
  border: 1px solid color-mix(in srgb, var(--st0rm-fg, #fff) 18%, transparent);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
}
.nut-info-pop[hidden] {
  display: none !important;
}
.nut-info-pop-inner {
  padding: 0.75rem 0.85rem;
  font-size: 0.88rem;
  line-height: 1.4;
}
.nut-info-pop-inner strong {
  display: block;
  margin-bottom: 0.25rem;
}
.nut-info-pop-inner p {
  margin: 0.25rem 0;
}
.nut-info-kind {
  font-weight: 600;
  font-size: 0.82rem;
}
.nut-info-pop-inner .nut-btn-ghost {
  margin-top: 0.45rem;
}

.nut-meal {
  margin-top: 0.85rem;
  padding: 0.65rem;
  border-radius: 14px;
  background: color-mix(in srgb, var(--st0rm-fg, #fff) 5%, transparent);
}
.nut-meal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}
.nut-meal-head h3 {
  margin: 0;
  font-size: 1rem;
  display: flex;
  gap: 0.5rem;
  align-items: baseline;
  flex-wrap: wrap;
}
.nut-entry {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  text-align: left;
  margin-top: 0.4rem;
  padding: 0.55rem 0.6rem;
  border-radius: 10px;
  border: 1px solid color-mix(in srgb, var(--st0rm-fg, #fff) 10%, transparent);
  background: transparent;
  color: inherit;
  font: inherit;
  cursor: pointer;
}
.nut-entry-main {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 0;
  overflow-wrap: anywhere;
}
.nut-entry-kcal {
  flex-shrink: 0;
  white-space: nowrap;
  font-weight: 600;
  opacity: 0.85;
}
.nut-empty {
  opacity: 0.55;
  font-size: 0.9rem;
  margin: 0.4rem 0;
}
.nut-meal-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.75rem;
  margin-top: 0.35rem;
}
.nut-copy-meal,
.nut-save-recipe {
  margin-top: 0;
  font-size: 0.8rem;
  min-height: 44px;
}
.nut-recipe-pick-list {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-top: 0.65rem;
}
.nut-recipe-pick {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  min-height: 44px;
  padding: 0.45rem 0.5rem;
  border-radius: 10px;
  border: 1px solid color-mix(in srgb, var(--st0rm-fg, #fff) 12%, transparent);
  cursor: pointer;
}
.nut-recipe-pick.is-disabled {
  opacity: 0.55;
  cursor: not-allowed;
}
.nut-recipe-pick input {
  width: 1.15rem;
  height: 1.15rem;
  margin-top: 0.15rem;
  flex-shrink: 0;
}
.nut-recipe-pick-body {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  min-width: 0;
  flex: 1;
}
.nut-recipe-pick-body strong {
  font-size: 0.95rem;
  line-height: 1.3;
  overflow-wrap: anywhere;
}
.nut-recipe-pick-product {
  font-size: 0.85rem;
  line-height: 1.3;
  overflow-wrap: anywhere;
}
.nut-recipe-hint {
  margin: 0 0 0.5rem;
  font-size: 0.85rem;
  opacity: 0.8;
}
.nut-search-section {
  margin: 0.65rem 0 0.25rem;
  font-size: 0.8rem;
  font-weight: 600;
  opacity: 0.7;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.nut-chips,
.nut-quick-row,
.nut-quick-amts {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin: 0.5rem 0;
}
.nut-chip {
  border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--st0rm-fg, #fff) 18%, transparent);
  background: transparent;
  color: inherit;
  font: inherit;
  font-size: 0.85rem;
  padding: 0.35rem 0.7rem;
  cursor: pointer;
}

/* Sheets */
.nut-sheet-backdrop,
.barcode-scan-overlay {
  position: fixed;
  inset: 0;
  top: var(--app-vtop, 0px);
  bottom: auto;
  height: var(--app-vh, 100dvh);
  z-index: 12000;
  background: rgba(0, 0, 0, 0.55);
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.barcode-scan-overlay {
  align-items: center;
}
.nut-sheet,
.barcode-scan-card {
  width: min(100%, 560px);
  min-width: 0;
  box-sizing: border-box;
  max-height: 92vh;
  max-height: min(92dvh, calc(var(--app-vh, 100dvh) - 12px));
  overflow: auto;
  background: var(--st0rm-bg, #1e2430);
  color: var(--st0rm-fg, #eee);
  border-radius: 18px 18px 0 0;
  padding: 0.5rem 0.9rem 1rem;
  box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.35);
}
.nut-sheet-tall {
  max-height: 94vh;
  max-height: min(94dvh, calc(var(--app-vh, 100dvh) - 12px));
}
.kb-open .nut-sheet,
.kb-open .nut-sheet-tall {
  max-height: var(--app-vh, 100dvh);
  border-radius: 0;
}
.kb-open .nut-sheet-handle {
  display: none;
}
.kb-open .nut-sheet-header h2 {
  font-size: 0.95rem;
}
.barcode-field {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  width: 100%;
  min-width: 0;
}
.barcode-field-input {
  flex: 1 1 auto;
  min-width: 0;
  box-sizing: border-box;
  border-radius: 10px;
  border: 1px solid color-mix(in srgb, var(--st0rm-fg, #fff) 18%, transparent);
  background: color-mix(in srgb, var(--st0rm-fg, #fff) 6%, transparent);
  color: inherit;
  font: inherit;
  padding: 0.55rem 0.65rem;
  height: 44px;
}
.barcode-field-btn {
  flex: 0 0 44px;
  width: 44px;
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  border: 1px solid color-mix(in srgb, var(--st0rm-fg, #fff) 18%, transparent);
  background: color-mix(in srgb, var(--st0rm-fg, #fff) 8%, transparent);
  color: inherit;
  cursor: pointer;
  padding: 0;
}
.barcode-field-btn:hover,
.barcode-field-btn:focus-visible {
  border-color: var(--st0rm-accent, #ffa23a);
  outline: none;
}
.barcode-field-submit {
  background: color-mix(in srgb, var(--st0rm-accent, #ffa23a) 35%, transparent);
}
.barcode-scan-card {
  border-radius: 16px;
  padding: 0.75rem;
}
.barcode-scan-video-wrap {
  position: relative;
  width: 100%;
}
.barcode-scan-video {
  width: 100%;
  max-height: 60vh;
  border-radius: 12px;
  background: #000;
  display: block;
  object-fit: cover;
}
.barcode-scan-frame {
  pointer-events: none;
  position: absolute;
  left: 15%;
  right: 15%;
  top: 28%;
  bottom: 28%;
  border: 2px solid color-mix(in srgb, var(--st0rm-accent, #ffa23a) 85%, #fff);
  border-radius: 10px;
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.35);
}
.barcode-scan-controls-host:empty {
  display: none;
}
.barcode-scan-controls {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  margin: 0.45rem 0 0.15rem;
  flex-wrap: wrap;
}
.barcode-scan-torch {
  flex: 0 0 44px;
  width: 44px;
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  border: 1px solid color-mix(in srgb, var(--st0rm-fg, #fff) 18%, transparent);
  background: color-mix(in srgb, var(--st0rm-fg, #fff) 8%, transparent);
  color: inherit;
  cursor: pointer;
  padding: 0;
}
.barcode-scan-torch.is-on,
.barcode-scan-torch[aria-pressed='true'] {
  border-color: var(--st0rm-accent, #ffa23a);
  background: color-mix(in srgb, var(--st0rm-accent, #ffa23a) 28%, transparent);
}
.barcode-scan-zoom {
  flex: 1 1 140px;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.85rem;
  opacity: 0.9;
}
.barcode-scan-zoom span {
  flex: 0 0 auto;
}
.barcode-scan-zoom input[type='range'] {
  flex: 1 1 auto;
  min-width: 0;
  height: 44px;
  margin: 0;
  cursor: pointer;
}
.barcode-scan-hint {
  margin: 0.5rem 0;
  text-align: center;
}
.barcode-scan-confirm {
  margin: 0.35rem 0 0.6rem;
  text-align: center;
}
.barcode-scan-code {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  margin: 0 0 0.55rem;
  font-variant-numeric: tabular-nums;
}
.barcode-scan-actions {
  display: flex;
  gap: 0.5rem;
}
.barcode-scan-again,
.barcode-scan-accept,
.barcode-scan-cancel {
  flex: 1;
  padding: 0.7rem;
  border-radius: 10px;
  border: none;
  font-weight: 600;
  cursor: pointer;
  font: inherit;
}
.barcode-scan-cancel,
.barcode-scan-accept {
  background: var(--st0rm-accent, #ffa23a);
  color: #111;
}
.barcode-scan-again {
  background: color-mix(in srgb, var(--st0rm-fg, #fff) 14%, transparent);
  color: inherit;
  border: 1px solid color-mix(in srgb, var(--st0rm-fg, #fff) 22%, transparent);
}
.nut-attribution {
  font-size: 0.78rem;
  opacity: 0.75;
  margin: 0.25rem 0 0;
}
.nut-sheet-handle {
  width: 42px;
  height: 4px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--st0rm-fg, #fff) 25%, transparent);
  margin: 0.25rem auto 0.5rem;
}
.nut-sheet-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--st0rm-bg, #1e2430);
  padding-bottom: 0.35rem;
}
.nut-sheet-header h2 {
  margin: 0;
  font-size: 1.1rem;
  flex: 1;
  min-width: 0;
}
.nut-sheet-header-tools {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-shrink: 0;
}
.nut-icon-btn[hidden] {
  display: none;
}
.nut-sheet-body {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  padding: 0.35rem 0 1rem;
}
.cie-match {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.4rem;
}
.cie-match .nut-btn {
  text-align: left;
}

.nut-sheet-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.5rem;
  position: sticky;
  bottom: 0;
  padding-top: 0.5rem;
  padding-bottom: env(safe-area-inset-bottom, 0px);
  background: linear-gradient(transparent, var(--st0rm-bg, #1e2430) 30%);
}

.nut-where {
  margin: 0.15rem 0 0;
  font-size: 0.78rem;
  color: color-mix(in srgb, var(--st0rm-fg, #eee) 62%, transparent);
}

.nut-acc {
  border-top: 1px solid color-mix(in srgb, var(--st0rm-fg, #eee) 12%, transparent);
}

.nut-acc-head {
  width: 100%;
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.55rem 0.1rem;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  font-weight: 650;
  text-align: left;
  cursor: pointer;
}

.nut-acc.is-open .nut-acc-head span {
  transform: rotate(180deg);
}

.nut-acc-body {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  padding: 0.15rem 0 0.9rem;
}

.nut-save-status {
  flex: 1 1 100%;
  margin: 0;
  min-height: 1.2em;
  font-size: 0.85rem;
}

.nut-busy-line,
.nut-choice-q,
.nut-choice-done {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin: 0;
}

.nut-spin {
  display: inline-block;
  width: 0.95rem;
  height: 0.95rem;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: nut-spin 0.7s linear infinite;
  flex: 0 0 auto;
}

@keyframes nut-spin {
  to { transform: rotate(360deg); }
}

.nut-choice-banner {
  position: fixed;
  z-index: 13000;
  left: 12px;
  right: 12px;
  top: calc(var(--app-vtop, 0px) + 12px);
  max-width: 520px;
  margin: 0 auto;
  padding: 0.75rem;
  border-radius: 14px;
  background: var(--st0rm-bg, #1e2430);
  color: var(--st0rm-fg, #eee);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.35);
  border: 1px solid color-mix(in srgb, var(--st0rm-fg, #eee) 16%, transparent);
}

.nut-choice-actions {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  margin-top: 0.55rem;
}

.nut-choice-actions .nut-btn {
  min-height: 44px;
  width: 100%;
}
.nut-sheet-add > .nut-sheet-footer {
  flex: 0 0 auto;
  flex-wrap: nowrap;
  justify-content: stretch;
  margin: 0 -0.9rem;
  padding: 0.55rem 0.9rem max(0.75rem, env(safe-area-inset-bottom, 0px));
  background: var(--st0rm-bg, #1e2430);
  border-top: 1px solid color-mix(in srgb, var(--st0rm-fg, #fff) 12%, transparent);
  box-shadow: 0 -6px 16px rgba(0, 0, 0, 0.18);
}

.nut-input,
.nut-field input,
.nut-field select {
  width: 100%;
  box-sizing: border-box;
  border-radius: 10px;
  border: 1px solid color-mix(in srgb, var(--st0rm-fg, #fff) 18%, transparent);
  background: color-mix(in srgb, var(--st0rm-fg, #fff) 6%, transparent);
  color: inherit;
  font: inherit;
  padding: 0.55rem 0.65rem;
}
.nut-field {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-size: 0.85rem;
  flex: 1;
}
.nut-field-req span::after {
  content: ' *';
  opacity: 0.6;
}
.nut-row {
  display: flex;
  gap: 0.5rem;
  align-items: flex-end;
  flex-wrap: wrap;
}
.nut-facts-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.45rem;
}
.nut-section-title {
  margin: 0.6rem 0 0.2rem;
  font-size: 0.95rem;
}
.nut-details {
  margin-top: 0.35rem;
}
.nut-portion-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 0.35rem;
  margin-bottom: 0.35rem;
  align-items: center;
}
.nut-portion-amount {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}
.nut-portion-amount .nut-input {
  width: 5.5rem;
}
.nut-portion-unit {
  min-width: 1.6rem;
  font-weight: 600;
}
.nut-hits {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  margin-top: 0.25rem;
}
.nut-hit {
  text-align: left;
  border: 1px solid color-mix(in srgb, var(--st0rm-fg, #fff) 12%, transparent);
  background: transparent;
  color: inherit;
  font: inherit;
  border-radius: 10px;
  padding: 0.55rem 0.65rem;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}
.nut-result {
  text-align: left;
  border: 1px solid color-mix(in srgb, var(--st0rm-fg, #fff) 12%, transparent);
  background: transparent;
  color: inherit;
  font: inherit;
  border-radius: 10px;
  padding: 0.45rem 0.65rem;
  cursor: pointer;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  box-sizing: border-box;
  min-width: 0;
}
.nut-result.is-collapsed {
  display: none;
}
.nut-result-main {
  flex: 1 1 auto;
  min-width: 0;
  line-height: 1.35;
}
.nut-result-name {
  font-weight: 600;
  font-size: 0.92rem;
  overflow-wrap: anywhere;
}
.nut-result-badge {
  display: inline-block;
  vertical-align: middle;
  font-size: 0.68rem;
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  opacity: 0.65;
  border: 1px solid color-mix(in srgb, var(--st0rm-fg, #fff) 18%, transparent);
  border-radius: 999px;
  padding: 0.1rem 0.4rem;
  white-space: nowrap;
}
.nut-result-meta {
  flex: 0 0 auto;
  font-size: 0.82rem;
  white-space: nowrap;
  opacity: 0.8;
  text-align: right;
}
.nut-result-meta.is-muted {
  opacity: 0.45;
  font-size: 0.78rem;
}
.nut-search-results {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.nut-search-results.is-stale {
  opacity: 0.5;
  pointer-events: none;
}
.nut-search-group {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}
.nut-search-group-items {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}
.nut-search-more {
  align-self: flex-start;
  border: none;
  background: transparent;
  color: inherit;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  opacity: 0.75;
  padding: 0.2rem 0.1rem;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.nut-search-more:hover,
.nut-search-more:focus-visible {
  opacity: 1;
  outline: none;
}

.nut-sheet-add {
  display: flex;
  flex-direction: column;
  padding-bottom: 0;
  overflow: hidden;
}
.nut-sheet-add-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  padding-bottom: 0.35rem;
  -webkit-overflow-scrolling: touch;
}
.nut-sheet-add-dock {
  flex: 0 0 auto;
  margin: 0 -0.9rem;
  padding: 0.55rem 0.9rem;
  background: var(--st0rm-bg, #1e2430);
  border-top: 1px solid color-mix(in srgb, var(--st0rm-fg, #fff) 12%, transparent);
  box-shadow: 0 -6px 16px rgba(0, 0, 0, 0.18);
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}
.kb-open .nut-sheet-add > .nut-sheet-footer {
  display: none;
}
.kb-open .nut-sheet-add-dock {
  padding-bottom: 0.45rem;
}
.kb-open .nut-sheet-add .nut-plist-row-main {
  min-height: 44px;
  padding-top: 0.35rem;
  padding-bottom: 0.35rem;
}
.kb-open .nut-sheet-add .nut-plist-thumb,
.kb-open .nut-sheet-add .nut-plist-badge {
  display: none;
}
.kb-open .nut-sheet-add .nut-myfoods-box {
  max-height: 140px;
}
.nut-search-status {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  min-height: 1.1rem;
  font-size: 0.82rem;
  opacity: 0.85;
}
.nut-search-status[hidden] {
  display: none;
}
.nut-search-spinner {
  flex: 0 0 auto;
  width: 14px;
  height: 14px;
  border: 2px solid color-mix(in srgb, var(--st0rm-fg, #fff) 18%, transparent);
  border-top-color: var(--st0rm-accent, #ffa23a);
  border-radius: 50%;
  animation: nut-spin 0.8s linear infinite;
}
@keyframes nut-spin {
  to {
    transform: rotate(360deg);
  }
}
.nut-search-with-scan {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  width: 100%;
  min-width: 0;
}
.nut-search-with-scan .nut-input {
  flex: 1 1 auto;
  min-width: 0;
}
.nut-search-scan-btn {
  flex: 0 0 44px;
  width: 44px;
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  border: 1px solid color-mix(in srgb, var(--st0rm-fg, #fff) 18%, transparent);
  background: color-mix(in srgb, var(--st0rm-fg, #fff) 8%, transparent);
  color: inherit;
  cursor: pointer;
  padding: 0;
}
.nut-search-scan-btn:hover,
.nut-search-scan-btn:focus-visible {
  border-color: var(--st0rm-accent, #ffa23a);
  outline: none;
}
.nut-myfoods-wrap {
  position: relative;
  margin-bottom: 0.35rem;
}
.nut-myfoods-wrap.has-more:not(.is-empty)::after {
  content: '';
  pointer-events: none;
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 28px;
  border-radius: 0 0 12px 12px;
  background: linear-gradient(
    to bottom,
    transparent,
    color-mix(in srgb, var(--st0rm-bg, #1e2430) 92%, transparent)
  );
}
.nut-myfoods-box {
  max-height: 256px;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  border-radius: 12px;
  padding-right: 0.1rem;
}
.nut-myfoods-box.is-empty,
.nut-myfoods-wrap.is-empty .nut-myfoods-box {
  max-height: none;
}
.nut-myfoods-empty {
  margin: 0.35rem 0.15rem;
  font-size: 0.88rem;
}
.nut-plist-row-add {
  padding: 0;
  gap: 0;
  overflow: hidden;
}
.nut-plist-row-main {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  flex: 1 1 auto;
  min-width: 0;
  min-height: 56px;
  text-align: left;
  padding: 0.55rem 0.35rem 0.55rem 0.65rem;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  cursor: pointer;
}
.nut-plist-row-add .nut-plist-action-icon {
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  padding: 0;
  margin-right: 0.2rem;
}
.nut-plist-badge-fav {
  background: color-mix(in srgb, #f5c542 35%, transparent);
}
.nut-preview {
  position: relative;
  padding: 0.55rem;
  border-radius: 12px;
  background: color-mix(in srgb, var(--st0rm-fg, #fff) 6%, transparent);
}
.nut-preview.has-coverage {
  padding-right: 1.6rem;
}
.nut-preview-info {
  position: absolute;
  top: 0.4rem;
  right: 0.35rem;
  width: 1rem;
  height: 1rem;
  padding: 0;
  border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--st0rm-fg, #fff) 35%, transparent);
  background: color-mix(in srgb, var(--st0rm-bg, #1a1a1a) 88%, transparent);
  color: inherit;
  font: inherit;
  font-size: 0.68rem;
  font-style: italic;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  z-index: 2;
}
.nut-preview-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  column-gap: 0.35rem;
  row-gap: 0.7rem;
  text-align: center;
}
.nut-preview-cell {
  min-width: 0;
}
.nut-preview-cell[data-status='ok'] { --nut-status: #4ade80; }
.nut-preview-cell[data-status='warn'] { --nut-status: #fbbf24; }
.nut-preview-cell[data-status='over'] { --nut-status: #f87171; }
.nut-preview-cell[data-status='neutral'] { --nut-status: var(--text-faint, #727c87); }
.nut-preview .nut-bar {
  height: 4px;
  margin-top: 2px;
  width: 100%;
}
.nut-preview > .nut-info-pop {
  top: auto;
  bottom: calc(100% + 0.35rem);
  left: 0;
  right: 0;
  max-width: none;
  z-index: 6;
}
.nut-preview-grid span {
  display: block;
  font-size: 0.75rem;
  line-height: 1.2;
  opacity: 0.65;
  overflow-wrap: break-word;
}
.nut-check {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.9rem;
}
.nut-cook-group {
  margin: 0.65rem 0 0.2rem;
  font-size: 0.85rem;
  font-weight: 600;
  opacity: 0.8;
}
.nut-cook-row {
  padding: 0.55rem 0;
  border-bottom: 1px solid color-mix(in srgb, var(--st0rm-fg, #fff) 10%, transparent);
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.nut-cook-name {
  font-weight: 600;
}
.nut-week-list {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}
.nut-week-day {
  display: flex;
  justify-content: space-between;
  padding: 0.7rem 0.8rem;
  border-radius: 12px;
  border: 1px solid color-mix(in srgb, var(--st0rm-fg, #fff) 12%, transparent);
  background: transparent;
  color: inherit;
  font: inherit;
  cursor: pointer;
}

.nut-plist {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-bottom: 0.75rem;
}
.nut-plist-row {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  min-height: 56px;
  text-align: left;
  padding: 0.55rem 0.65rem;
  border-radius: 12px;
  border: 1px solid color-mix(in srgb, var(--st0rm-fg, #fff) 14%, transparent);
  background: color-mix(in srgb, var(--st0rm-fg, #fff) 5%, transparent);
  color: inherit;
  font: inherit;
  cursor: pointer;
}
.nut-plist-row:hover {
  border-color: var(--st0rm-accent, #ffa23a);
}
.nut-plist-thumb {
  width: 48px;
  height: 48px;
  border-radius: 8px;
  object-fit: contain;
  background: color-mix(in srgb, var(--st0rm-fg, #fff) 8%, transparent);
  flex-shrink: 0;
}
.nut-plist-thumb-empty {
  display: inline-block;
}
.nut-plist-meta {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 0;
  flex: 1 1 auto;
}
.nut-plist-meta strong {
  font-size: 0.95rem;
  line-height: 1.3;
  overflow-wrap: anywhere;
}
.nut-plist-meta span {
  font-size: 0.8rem;
  opacity: 0.7;
  min-width: 0;
  max-width: 100%;
  overflow-wrap: anywhere;
}
.nut-plist-badge {
  display: inline-block;
  margin-top: 0.1rem;
  padding: 0.05rem 0.4rem;
  border-radius: 999px;
  font-size: 0.68rem;
  line-height: 1.3;
  background: color-mix(in srgb, var(--st0rm-accent, #ffa23a) 28%, transparent);
  width: fit-content;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.nut-plist-action-icon {
  flex: 0 0 44px;
  width: 44px;
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  opacity: 0.85;
}
.nut-plist-actions {
  margin-top: 0.35rem;
}
.nut-readonly-banner {
  margin: 0;
  padding: 0.55rem 0.7rem;
  border-radius: 10px;
  background: color-mix(in srgb, var(--st0rm-accent, #ffa23a) 18%, transparent);
  font-size: 0.85rem;
}
.nut-tip-row {
  display: flex;
  align-items: flex-start;
  gap: 0.4rem;
  margin: 0 0 0.45rem;
  padding: 0.45rem 0.55rem;
  border-radius: 10px;
  background: color-mix(in srgb, var(--st0rm-fg, #fff) 7%, transparent);
  font-size: 0.82rem;
  line-height: 1.35;
}
.nut-tip-row span {
  flex: 1 1 auto;
  min-width: 0;
}
.nut-tip-row button {
  flex: 0 0 44px;
  width: 44px;
  height: 44px;
  border: 0;
  background: transparent;
  color: inherit;
  font-size: 1.1rem;
  cursor: pointer;
  opacity: 0.7;
}
.nut-product-image {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  margin-bottom: 0.65rem;
}
.nut-product-image img {
  width: 96px;
  height: 96px;
  object-fit: contain;
  border-radius: 10px;
  background: color-mix(in srgb, var(--st0rm-fg, #fff) 8%, transparent);
}

.nut-choice-btn {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  width: 100%;
  text-align: left;
  padding: 0.75rem 0.85rem;
  margin: 0.25rem 0;
  border-radius: 12px;
  border: 1px solid color-mix(in srgb, var(--st0rm-fg, #fff) 14%, transparent);
  background: color-mix(in srgb, var(--st0rm-fg, #fff) 5%, transparent);
  color: inherit;
  font: inherit;
  cursor: pointer;
}
.nut-choice-btn strong {
  font-size: 0.98rem;
}
.nut-choice-btn span {
  font-size: 0.82rem;
  opacity: 0.7;
}
.nut-choice-btn:hover {
  border-color: var(--st0rm-accent, #ffa23a);
}

.nut-photo-slots {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.55rem;
}
.nut-photo-slot {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  padding: 0.65rem;
  border-radius: 12px;
  border: 1px dashed color-mix(in srgb, var(--st0rm-fg, #fff) 28%, transparent);
  font-size: 0.85rem;
}
.nut-photo-slot-title {
  font-weight: 600;
}
.nut-photo-slot-actions {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.nut-photo-action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  width: 100%;
  text-align: center;
  font-size: 0.82rem;
  padding: 0.4rem 0.5rem;
}
.nut-photo-slot input[type='file'][hidden] {
  display: none;
}
.nut-photo-slot img {
  width: 100%;
  max-height: 140px;
  object-fit: cover;
  border-radius: 8px;
}

@media (min-width: 700px) {
  .nut-sheet-backdrop {
    align-items: center;
  }
  .nut-sheet {
    border-radius: 16px;
    max-height: 85vh;
  }
}
