/* Nutrition Calculator — V4.3.1 redesign
   Scoped to .site-main--nutrition-calculator / .ncalc-*
   Uses theme design tokens from menuusa.css
*/

.site-main--nutrition-calculator {
  background: var(--menuusa-bg, #fffdf8);
}

.ncalc-shell {
  width: 100%;
  max-width: min(1180px, 100%);
  margin: 0 auto;
  padding: 0.75rem var(--menuusa-gutter, 1.25rem) 2.5rem;
  box-sizing: border-box;
}

.nutrition-calculator-page {
  margin: 0;
}

/* —— Intro (compact) —— */
.ncalc-intro {
  margin: 0 0 1.1rem;
  max-width: 42rem;
}

.ncalc-intro__title {
  margin: 0 0 0.4rem;
  font-size: clamp(1.45rem, 2.4vw, 1.85rem);
  line-height: 1.2;
  letter-spacing: -0.01em;
  color: var(--menuusa-text, #2b2b2b);
}

.ncalc-intro__desc {
  margin: 0 0 0.35rem;
  font-size: 0.98rem;
  line-height: 1.5;
  color: var(--menuusa-text, #2b2b2b);
}

.ncalc-intro__hint {
  margin: 0 0 0.45rem;
  font-size: 0.9rem;
  color: var(--menuusa-text-muted, #6e655a);
}

.ncalc-intro__note {
  margin: 0;
  font-size: 0.8rem;
  line-height: 1.45;
  color: var(--menuusa-text-muted, #6e655a);
  padding: 0.45rem 0.65rem;
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid var(--menuusa-border, #ede3d3);
  border-radius: var(--menuusa-radius-sm, 8px);
}

/* —— App chrome —— */
.ncalc-app {
  background: var(--menuusa-surface, #fff);
  border: 1px solid var(--menuusa-border, #ede3d3);
  border-radius: var(--menuusa-radius, 12px);
  box-shadow: var(--menuusa-shadow);
  padding: 1rem 1.1rem 1.25rem;
  margin-bottom: 1.75rem;
  max-width: 100%;
  overflow-x: clip;
}

.ncalc-h2 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--menuusa-text, #2b2b2b);
}

.ncalc-h3 {
  margin: 0 0 0.55rem;
  font-size: 0.88rem;
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--menuusa-text-muted, #6e655a);
}

.ncalc-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem 1rem;
  align-items: center;
  margin-bottom: 0.75rem;
}

.ncalc-search {
  position: relative;
  flex: 1 1 260px;
  min-width: 0;
}

.ncalc-search__icon {
  position: absolute;
  left: 0.7rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--menuusa-text-muted, #6e655a);
  display: flex;
  pointer-events: none;
}

.ncalc-search__input {
  width: 100%;
  box-sizing: border-box;
  min-height: 42px;
  padding: 0.5rem 2.2rem 0.5rem 2.35rem;
  border: 1px solid var(--menuusa-border-strong, #dac9ac);
  border-radius: var(--menuusa-radius-sm, 8px);
  background: #fff;
  font: inherit;
  font-size: 0.95rem;
  color: var(--menuusa-text, #2b2b2b);
}

.ncalc-search__input:focus {
  outline: 2px solid var(--menuusa-accent, #c0392b);
  outline-offset: 1px;
  border-color: var(--menuusa-accent, #c0392b);
}

.ncalc-search__clear {
  position: absolute;
  right: 0.35rem;
  top: 50%;
  transform: translateY(-50%);
  width: 1.75rem;
  height: 1.75rem;
  border: 0;
  background: transparent;
  border-radius: 50%;
  font-size: 1.2rem;
  line-height: 1;
  cursor: pointer;
  color: #666;
}

.ncalc-search__clear[hidden] {
  display: none !important;
}

.ncalc-controls__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
}

.ncalc-check {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.86rem;
  color: var(--menuusa-text, #2b2b2b);
  cursor: pointer;
}

.ncalc-link-btn {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--menuusa-accent, #c0392b);
  font: inherit;
  font-size: 0.86rem;
  font-weight: 600;
  cursor: pointer;
  padding: 0.2rem 0;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.ncalc-cats-wrap {
  margin: 0 0 1rem;
  overflow: hidden;
}

.ncalc-categories {
  display: flex;
  flex-wrap: nowrap;
  gap: 0.4rem;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 0.35rem;
  scrollbar-width: thin;
}

@media (min-width: 900px) {
  .ncalc-categories {
    flex-wrap: wrap;
    overflow: visible;
    padding-bottom: 0;
  }
}

.ncalc-cat {
  appearance: none;
  flex: 0 0 auto;
  border: 1px solid var(--menuusa-border, #ede3d3);
  background: #faf8f4;
  border-radius: 999px;
  padding: 0.38rem 0.75rem;
  font: inherit;
  font-size: 0.82rem;
  cursor: pointer;
  color: var(--menuusa-text, #2b2b2b);
  white-space: nowrap;
  transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}

.ncalc-cat:hover,
.ncalc-cat.is-active {
  border-color: var(--menuusa-accent, #c0392b);
  color: var(--menuusa-accent, #c0392b);
  background: #fff;
}

.ncalc-cat.is-active {
  font-weight: 650;
  box-shadow: inset 0 0 0 1px var(--menuusa-accent, #c0392b);
}

.ncalc-cat__count {
  opacity: 0.55;
  font-size: 0.78em;
  margin-left: 0.15rem;
}

/* —— Workspace grid —— */
.ncalc-workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 360px);
  gap: 1.5rem;
  align-items: start;
  width: 100%;
}

.ncalc-products,
.ncalc-meal {
  min-width: 0;
  max-width: 100%;
}

.ncalc-products__head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.35rem 1rem;
  margin-bottom: 0.75rem;
}

.ncalc-status {
  margin: 0;
  font-size: 0.82rem;
  color: var(--menuusa-text-muted, #6e655a);
  min-height: 1.1em;
}

/* —— Product cards —— */
.ncalc-product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 0.85rem;
}

.ncalc-card {
  display: flex;
  flex-direction: column;
  background: #fff;
  border: 1px solid var(--menuusa-border, #ede3d3);
  border-radius: var(--menuusa-radius-sm, 8px);
  overflow: hidden;
  min-width: 0;
  transition: box-shadow 0.15s ease, border-color 0.15s ease;
}

.ncalc-card:hover,
.ncalc-card:focus-within {
  border-color: var(--menuusa-border-strong, #dac9ac);
  box-shadow: var(--menuusa-shadow);
}

.ncalc-card__media {
  aspect-ratio: 1 / 1;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding: 0.5rem;
  box-sizing: border-box;
}

.ncalc-card__img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
  display: block;
}

.ncalc-card__ph {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.55);
  border: 1px solid rgba(0, 0, 0, 0.06);
}

.ncalc-card__body {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  padding: 0.7rem 0.75rem 0.8rem;
  flex: 1;
  min-width: 0;
}

.ncalc-card__title {
  margin: 0;
  font-size: 0.92rem;
  font-weight: 650;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  overflow-wrap: anywhere;
}

.ncalc-card__meta {
  margin: 0;
  font-size: 0.75rem;
  color: var(--menuusa-text-muted, #6e655a);
}

.ncalc-card__facts {
  margin: 0.15rem 0 0;
  font-size: 0.84rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 0.55rem;
  align-items: baseline;
}

.ncalc-card__cal {
  font-weight: 650;
  color: var(--menuusa-text, #2b2b2b);
}

.ncalc-card__serving {
  color: var(--menuusa-text-muted, #6e655a);
  font-size: 0.78rem;
}

.ncalc-badge {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  padding: 0.18rem 0.4rem;
  border-radius: 4px;
  background: #f3f1ec;
  border: 1px solid var(--menuusa-border, #ede3d3);
  color: #5c554c;
}

.ncalc-badge--ok {
  background: #eef7f0;
  border-color: #c9e4d0;
  color: #1f6b35;
}

.ncalc-card__actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.35rem;
  margin-top: auto;
  padding-top: 0.55rem;
}

.ncalc-btn {
  appearance: none;
  border: 1px solid var(--menuusa-border-strong, #dac9ac);
  background: #fff;
  border-radius: 7px;
  padding: 0.42rem 0.55rem;
  font: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  color: var(--menuusa-text, #2b2b2b);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  box-sizing: border-box;
}

.ncalc-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.ncalc-btn:focus-visible,
.ncalc-cat:focus-visible,
.ncalc-search__input:focus-visible,
.ncalc-qty__btn:focus-visible,
.ncalc-qty__input:focus-visible,
.ncalc-link-btn:focus-visible,
.ncalc-dock__btn:focus-visible {
  outline: 2px solid var(--menuusa-accent, #c0392b);
  outline-offset: 2px;
}

.ncalc-btn--primary {
  background: var(--menuusa-accent, #c0392b);
  border-color: var(--menuusa-accent, #c0392b);
  color: #fff;
}

.ncalc-btn--primary:hover:not(:disabled) {
  background: var(--menuusa-accent-dark, #96281b);
  border-color: var(--menuusa-accent-dark, #96281b);
}

.ncalc-btn--ghost {
  background: #fff;
}

.ncalc-btn--ghost:hover:not(:disabled) {
  background: #faf8f4;
}

.ncalc-pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  margin-top: 1rem;
}

.ncalc-pager__label {
  font-size: 0.85rem;
  color: var(--menuusa-text-muted, #6e655a);
}

.ncalc-empty {
  margin: 0.5rem 0;
  padding: 1.25rem;
  text-align: center;
  color: var(--menuusa-text-muted, #6e655a);
  font-size: 0.95rem;
  border: 1px dashed var(--menuusa-border, #ede3d3);
  border-radius: var(--menuusa-radius-sm, 8px);
  background: #faf8f4;
}

.ncalc-loading {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 0.85rem;
}

.ncalc-skeleton {
  height: 220px;
  border-radius: var(--menuusa-radius-sm, 8px);
  background: linear-gradient(90deg, #f0ebe3 25%, #f7f3ec 50%, #f0ebe3 75%);
  background-size: 200% 100%;
  animation: ncalc-shimmer 1.2s ease-in-out infinite;
}

@media (prefers-reduced-motion: reduce) {
  .ncalc-skeleton {
    animation: none;
  }
}

@keyframes ncalc-shimmer {
  0% { background-position: 100% 0; }
  100% { background-position: -100% 0; }
}

/* —— Meal panel —— */
.ncalc-meal__card {
  position: sticky;
  top: 0.85rem;
  border: 1px solid var(--menuusa-border, #ede3d3);
  border-radius: var(--menuusa-radius, 12px);
  background: #fcfbf8;
  padding: 0.95rem;
  box-shadow: var(--menuusa-shadow);
}

.ncalc-meal__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.ncalc-meal__badge {
  min-width: 1.65rem;
  height: 1.65rem;
  padding: 0 0.4rem;
  border-radius: 999px;
  background: var(--menuusa-accent, #c0392b);
  color: #fff;
  font-size: 0.78rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.ncalc-meal-empty {
  text-align: center;
  padding: 1rem 0.5rem 1.15rem;
}

.ncalc-meal-empty[hidden],
.ncalc-meal-list[hidden],
.ncalc-summary[hidden],
.ncalc-actions[hidden],
.ncalc-notice[hidden],
.ncalc-dock[hidden] {
  display: none !important;
}

.ncalc-meal-empty__icon {
  display: inline-flex;
  color: var(--menuusa-text-muted, #6e655a);
  margin-bottom: 0.45rem;
}

.ncalc-meal-empty__title {
  margin: 0 0 0.3rem;
  font-weight: 700;
  font-size: 0.98rem;
}

.ncalc-meal-empty__desc {
  margin: 0 0 0.85rem;
  font-size: 0.86rem;
  color: var(--menuusa-text-muted, #6e655a);
  line-height: 1.45;
}

.ncalc-meal-list {
  list-style: none;
  margin: 0 0 0.85rem;
  padding: 0;
  display: grid;
  gap: 0.65rem;
  max-height: min(42vh, 360px);
  overflow: auto;
}

.ncalc-meal-row {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  gap: 0.55rem;
  padding: 0.5rem;
  background: #fff;
  border: 1px solid var(--menuusa-border, #ede3d3);
  border-radius: 8px;
}

.ncalc-meal-row__thumb {
  width: 48px;
  height: 48px;
  border-radius: 6px;
  object-fit: contain;
  object-position: center;
  background: #fff;
  border: 1px solid rgba(0, 0, 0, 0.05);
}

.ncalc-meal-row__ph {
  width: 48px;
  height: 48px;
  border-radius: 6px;
  background: linear-gradient(145deg, #f0ebe3, #e5ddd0);
}

.ncalc-meal-row__name {
  font-weight: 650;
  font-size: 0.86rem;
  color: inherit;
  text-decoration: none;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  overflow-wrap: anywhere;
}

.ncalc-meal-row__name:hover {
  text-decoration: underline;
}

.ncalc-meal-row__cal {
  display: block;
  font-size: 0.75rem;
  color: var(--menuusa-text-muted, #6e655a);
  margin-top: 0.1rem;
}

.ncalc-qty {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.25rem;
  margin-top: 0.4rem;
}

.ncalc-qty__btn {
  appearance: none;
  border: 1px solid var(--menuusa-border-strong, #dac9ac);
  background: #fff;
  border-radius: 5px;
  width: 30px;
  height: 30px;
  cursor: pointer;
  font: inherit;
  font-weight: 700;
  line-height: 1;
}

.ncalc-qty__input {
  width: 2.6rem;
  height: 30px;
  text-align: center;
  border: 1px solid var(--menuusa-border-strong, #dac9ac);
  border-radius: 5px;
  font: inherit;
  font-size: 0.85rem;
}

.ncalc-qty__remove {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--menuusa-accent, #c0392b);
  font: inherit;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  margin-left: 0.15rem;
  padding: 0.25rem 0.3rem;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.ncalc-notice {
  margin: 0 0 0.75rem;
  padding: 0.55rem 0.65rem;
  font-size: 0.8rem;
  line-height: 1.45;
  color: #5a4520;
  background: #fff8e8;
  border: 1px solid #ecd9a8;
  border-radius: 7px;
}

.ncalc-dashboard {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.45rem;
  margin: 0 0 0.75rem;
}

.ncalc-dash-card {
  border: 1px solid var(--menuusa-border, #ede3d3);
  border-radius: 7px;
  padding: 0.45rem 0.5rem;
  background: #fff;
  min-height: 3.4rem;
}

.ncalc-dash-card--partial {
  border-style: dashed;
  border-color: #c9a24a;
}

.ncalc-dash-card--unavailable {
  background: #faf8f4;
}

.ncalc-dash__label {
  display: block;
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--menuusa-text-muted, #6e655a);
  margin-bottom: 0.15rem;
}

.ncalc-dash__value {
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.2;
}

.ncalc-dash__value small {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--menuusa-text-muted, #6e655a);
}

.ncalc-dash__note {
  display: block;
  font-size: 0.68rem;
  color: #7a5a18;
  margin-top: 0.15rem;
  line-height: 1.3;
}

/* Nutrition detail table — must fit meal panel without horizontal scroll.
   Root cause of overflow: global `.table-wrap table { min-width: 560px }`
   plus four columns in a ~320–360px sticky panel. */
.ncalc-table-wrap {
  margin: 0 0 0.75rem;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow-x: visible;
  box-sizing: border-box;
  border: 0;
  box-shadow: none;
  background: transparent;
}

.ncalc-table-wrap .ncalc-table,
.ncalc-table {
  width: 100%;
  max-width: 100%;
  min-width: 0 !important; /* override global .table-wrap table min-width: 560px */
  table-layout: fixed;
  border-collapse: collapse;
  font-size: 0.8rem;
  box-sizing: border-box;
}

.ncalc-table__col-nutrient {
  width: 58%;
}

.ncalc-table__col-total {
  width: 42%;
}

.ncalc-table th,
.ncalc-table td {
  border-bottom: 1px solid var(--menuusa-border, #ede3d3);
  padding: 0.45rem 0.4rem;
  text-align: left;
  vertical-align: top;
  box-sizing: border-box;
  overflow-wrap: break-word;
  word-wrap: break-word;
  white-space: normal;
  hyphens: auto;
}

.ncalc-table thead th {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--menuusa-text-muted, #6e655a);
  font-weight: 700;
}

.ncalc-table th[scope="row"] {
  font-weight: 600;
  color: var(--menuusa-text, #2b2b2b);
  padding-right: 0.55rem;
}

.ncalc-table__total {
  color: var(--menuusa-text, #2b2b2b);
}

.ncalc-table__unit {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--menuusa-text-muted, #6e655a);
}

.ncalc-table__partial {
  display: block;
  margin-top: 0.15rem;
  font-size: 0.68rem;
  font-weight: 600;
  color: #7a5a18;
}

.ncalc-table__row--unavailable .ncalc-table__total {
  color: var(--menuusa-text-muted, #6e655a);
}

@media (max-width: 430px) {
  .ncalc-table {
    font-size: 0.78rem;
  }

  .ncalc-table th,
  .ncalc-table td {
    padding: 0.38rem 0.28rem;
  }

  .ncalc-table__col-nutrient {
    width: 50%;
  }

  .ncalc-table__col-total {
    width: 50%;
  }

  .ncalc-table__total {
    overflow-wrap: anywhere;
  }
}

.ncalc-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.ncalc-actions .ncalc-btn {
  flex: 1 1 auto;
  min-width: 4.5rem;
  font-size: 0.78rem;
  min-height: 34px;
  padding: 0.35rem 0.45rem;
}

.ncalc-action-status {
  min-height: 1.15em;
  font-size: 0.8rem;
  color: var(--menuusa-text-muted, #6e655a);
  margin: 0.4rem 0 0;
}

/* —— Related + prose —— */
.ncalc-related {
  margin: 0 0 1.75rem;
  padding: 0.9rem 1rem;
  background: var(--menuusa-surface, #fff);
  border: 1px solid var(--menuusa-border, #ede3d3);
  border-radius: var(--menuusa-radius-sm, 8px);
}

.ncalc-related__list {
  margin: 0.55rem 0 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem 1.1rem;
}

.ncalc-related__list a {
  font-size: 0.92rem;
  font-weight: 600;
}

.ncalc-prose {
  max-width: 46rem;
  margin: 0 0 1.5rem;
}

.ncalc-prose h2 {
  font-size: 1.25rem;
  margin: 0 0 0.55rem;
}

.ncalc-disclaimer {
  border-left: 3px solid var(--menuusa-accent, #c0392b);
  padding-left: 0.85rem;
}

.ncalc-faq__item {
  border-bottom: 1px solid var(--menuusa-border, #ede3d3);
  padding: 0.5rem 0;
}

.ncalc-faq__item summary {
  cursor: pointer;
  font-weight: 650;
}

.ncalc-faq__item p {
  margin: 0.4rem 0 0.15rem;
  color: var(--menuusa-text, #2b2b2b);
  font-size: 0.95rem;
}

/* —— Dialog —— */
.ncalc-dialog[hidden] {
  display: none !important;
}

.ncalc-dialog {
  position: fixed;
  inset: 0;
  z-index: 10050;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 0;
}

@media (min-width: 640px) {
  .ncalc-dialog {
    align-items: center;
    padding: 1rem;
  }
}

.ncalc-dialog__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(30, 24, 18, 0.45);
}

.ncalc-dialog__panel {
  position: relative;
  z-index: 1;
  width: min(560px, 100%);
  max-height: min(92vh, 900px);
  overflow: auto;
  background: #fff;
  border-radius: 14px 14px 0 0;
  padding: 1.15rem 1.15rem 1.35rem;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.18);
}

@media (min-width: 640px) {
  .ncalc-dialog__panel {
    border-radius: 12px;
  }
}

.ncalc-dialog__close {
  position: absolute;
  top: 0.45rem;
  right: 0.5rem;
  appearance: none;
  border: 0;
  background: #f3f1ec;
  border-radius: 50%;
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
  width: 2rem;
  height: 2rem;
}

.ncalc-dialog__top {
  display: flex;
  gap: 0.85rem;
  margin-bottom: 0.85rem;
  padding-right: 1.6rem;
}

.ncalc-dialog__img {
  width: 96px;
  height: 96px;
  object-fit: contain;
  object-position: center;
  border-radius: 10px;
  background: #fff;
  border: 1px solid rgba(0, 0, 0, 0.05);
  flex: 0 0 auto;
}

.ncalc-dialog__ph {
  width: 96px;
  height: 96px;
  border-radius: 10px;
  background: linear-gradient(145deg, #f0ebe3, #e5ddd0);
  flex: 0 0 auto;
}

body.ncalc-dialog-open {
  overflow: hidden;
}

.ncalc-dialog__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-top: 0.85rem;
}

/* —— Mobile dock —— */
.ncalc-dock {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 40;
  padding: 0.65rem var(--menuusa-gutter, 1rem) calc(0.65rem + env(safe-area-inset-bottom, 0px));
  background: linear-gradient(180deg, transparent, rgba(255, 253, 248, 0.92) 28%, var(--menuusa-bg, #fffdf8));
  pointer-events: none;
}

.ncalc-dock__btn {
  pointer-events: auto;
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 0.55rem;
  appearance: none;
  border: 0;
  border-radius: 999px;
  padding: 0.7rem 1rem;
  background: var(--menuusa-text, #2b2b2b);
  color: #fff;
  font: inherit;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
}

.ncalc-dock__label {
  font-weight: 700;
}

.ncalc-dock__count {
  min-width: 1.4rem;
  height: 1.4rem;
  border-radius: 999px;
  background: var(--menuusa-accent, #c0392b);
  font-size: 0.75rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.ncalc-dock__hint {
  margin-left: auto;
  font-size: 0.8rem;
  opacity: 0.85;
}

/* —— Sheet mode for meal on small screens —— */
@media (max-width: 899px) {
  .ncalc-workspace {
    grid-template-columns: minmax(0, 1fr);
  }

  .ncalc-meal {
    position: fixed;
    inset: auto 0 0 0;
    z-index: 45;
    transform: translateY(110%);
    transition: transform 0.25s ease;
    max-height: min(88vh, 720px);
    padding: 0;
    background: transparent;
  }

  .ncalc-meal.is-open {
    transform: translateY(0);
  }

  .ncalc-meal__card {
    position: static;
    border-radius: 16px 16px 0 0;
    max-height: min(88vh, 720px);
    overflow-x: hidden;
    overflow-y: auto;
    box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.16);
    min-width: 0;
    box-sizing: border-box;
  }

  .site-main--nutrition-calculator.has-meal-items {
    padding-bottom: 5.5rem;
  }

  .ncalc-product-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 430px) {
  .ncalc-product-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .ncalc-card__actions {
    grid-template-columns: 1fr;
  }

  .ncalc-shell {
    padding-left: 0.85rem;
    padding-right: 0.85rem;
  }

  .ncalc-app {
    padding: 0.85rem;
  }

  .ncalc-controls {
    flex-direction: column;
    align-items: stretch;
  }

  .ncalc-controls__meta {
    width: 100%;
    justify-content: space-between;
  }

  .ncalc-search {
    flex: 1 1 auto;
    width: 100%;
  }
}

/* Soften focus ring on category scroller */
.ncalc-categories:focus {
  outline: none;
}

@media (min-width: 900px) {
  .ncalc-dock {
    display: none !important;
  }
}

@media print {
  .site-header,
  .site-footer,
  .ncalc-controls,
  .ncalc-cats-wrap,
  .ncalc-products,
  .ncalc-related,
  .ncalc-faq,
  .ncalc-dock,
  .back-to-top,
  .breadcrumbs,
  .ncalc-actions {
    display: none !important;
  }

  .ncalc-workspace {
    display: block;
  }

  .ncalc-meal,
  .ncalc-meal__card {
    position: static !important;
    transform: none !important;
    box-shadow: none;
    border: 0;
    max-height: none;
    overflow: visible;
  }

  .ncalc-summary {
    display: block !important;
  }
}
