.ingredient-composer-card {
  display: grid;
  min-width: 0;
  overflow: hidden;
  gap: 20px;
  border-radius: 20px;
  background: var(--surface);
  padding: 32px;
  box-shadow: var(--shadow-composer);
}

.ingredient-search-field {
  display: flex;
  min-height: 52px;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  padding: 0 16px;
  color: var(--text-muted);
}

.ingredient-search-field input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font-size: 15px;
  line-height: 22px;
}

.ingredient-tabs {
  display: flex;
  min-width: 0;
  gap: 18px;
  overflow-x: auto;
  scrollbar-width: none;
}

.ingredient-tabs-wrap {
  position: relative;
  min-width: 0;
  border-bottom: 1px solid var(--border);
}

.ingredient-tabs::-webkit-scrollbar {
  display: none;
}

.ingredient-tabs-cue {
  position: absolute;
  top: 0;
  bottom: 0;
  display: flex;
  box-sizing: border-box;
  width: 32px;
  margin: 0;
  padding: 0;
  align-items: center;
  border: 0;
  appearance: none;
  color: var(--text-muted);
  opacity: 0;
  pointer-events: none;
  transition: opacity 120ms ease-out;
}

.ingredient-tabs-cue-start {
  left: -1px;
  justify-content: flex-start;
  background: var(--bg);
}

.ingredient-tabs-cue-end {
  right: -1px;
  justify-content: flex-end;
  background: var(--bg);
}

.ingredient-composer-card .ingredient-tabs-cue-start,
.ingredient-composer-card .ingredient-tabs-cue-end {
  background: var(--surface);
}

.ingredient-tabs-cue.visible {
  opacity: 1;
  pointer-events: auto;
  cursor: pointer;
}

.ingredient-tabs-cue:hover.visible {
  color: var(--text);
}

.ingredient-tabs button {
  flex: 0 0 auto;
  min-height: 46px;
  border: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 700;
  line-height: 19px;
  white-space: nowrap;
}

.ingredient-tabs button.active {
  border-bottom-color: var(--primary);
  color: var(--primary-active);
}

.ingredient-browse {
  display: grid;
  align-content: start;
  align-items: start;
  gap: 16px;
}

.ingredient-composer-card .ingredient-browse {
  max-height: 360px;
  overflow-y: auto;
  padding-right: 4px;
}

.ingredient-category-section {
  display: grid;
  align-content: start;
  align-items: start;
  gap: 12px;
}

.ingredient-category-section h3 {
  margin: 0;
  font-family: 'Manrope', sans-serif;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .06em;
  line-height: 18px;
  color: var(--text-muted);
  text-transform: uppercase;
}

.ingredient-item-grid {
  display: flex;
  flex-wrap: wrap;
  align-content: flex-start;
  align-items: flex-start;
  gap: 8px;
}

.ingredient-item {
  position: relative;
  display: inline-flex;
  width: fit-content;
  min-height: 38px;
  flex: 0 0 auto;
  align-self: flex-start;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-subtle);
  padding: 8px 13px;
  color: var(--text);
  font-size: 14px;
  font-weight: 700;
  line-height: 19px;
  cursor: pointer;
}

.ingredient-item input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.ingredient-item input:focus-visible + span {
  outline: 3px solid rgba(31, 90, 68, .24);
  outline-offset: 5px;
  border-radius: 6px;
}

.ingredient-item span {
  display: block;
  max-width: min(260px, calc(100vw - 80px));
  overflow-wrap: anywhere;
  white-space: nowrap;
}

.ingredient-item.selected {
  border-color: rgba(31, 90, 68, .36);
  background: var(--primary-soft);
  color: var(--primary-active);
}

.ingredient-item.ingredient-item-view-all {
  gap: 8px;
  border-color: var(--primary-active);
  background: var(--primary-active);
  color: #FFF;
  text-decoration: none;
}

.ingredient-item.ingredient-item-view-all:hover,
.ingredient-item.ingredient-item-view-all:focus-visible {
  border-color: var(--primary-hover);
  background: var(--primary-hover);
}

.selected-ingredients {
  display: grid;
  min-width: 0;
  overflow: hidden;
  gap: 10px;
}

.selected-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 700;
  line-height: 18px;
}

.selected-heading button {
  border: 0;
  background: transparent;
  color: var(--primary);
  font-size: 13px;
  font-weight: 700;
}

.selected-chip-row {
  display: grid;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.selected-chip-line {
  display: flex;
  gap: 8px;
  min-width: max-content;
}

.selected-chip {
  display: inline-flex;
  min-height: 36px;
  flex: 0 0 auto;
  align-items: center;
  gap: 8px;
  border: 1px solid rgba(31, 90, 68, .2);
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary-active);
  padding: 7px 12px;
  font-size: 13px;
  font-weight: 700;
  line-height: 18px;
}

.selected-empty {
  margin: 0;
  color: var(--text-muted);
  font-size: 14px;
  line-height: 22px;
}

.composer-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 16px;
  padding-top: 4px;
}

.inline-error {
  display: grid;
  gap: 4px;
  border-radius: 14px;
  background: var(--error-soft);
  padding: 16px;
  color: var(--error);
  font-size: 14px;
  line-height: 22px;
}

.ingredient-item-skeleton {
  min-height: 48px;
  border-radius: 10px;
  background: linear-gradient(90deg, var(--skeleton), #F7F2EA, var(--skeleton));
  background-size: 220% 100%;
  animation: skeletonPulse 1.3s ease-in-out infinite;
}

.ingredient-no-results {
  border-radius: 14px;
  background: var(--surface-subtle);
  padding: 18px;
  color: var(--text-muted);
}

.ingredient-full-page {
  padding-bottom: 24px;
}

.ingredient-mobile-top {
  display: none;
}

.ingredient-full-shell {
  width: min(var(--max-content), calc(100% - (var(--gutter) * 2)));
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 32px;
  padding: 48px 0 24px;
}

.ingredient-browser-panel {
  min-width: 0;
}

.ingredient-browser-panel .ingredient-browse {
  margin-top: 20px;
}

.ingredient-desktop-heading {
  max-width: 680px;
  margin-bottom: 32px;
}

.ingredient-desktop-heading .eyebrow {
  margin-bottom: 8px;
  color: var(--accent);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: .08em;
  line-height: 18px;
  text-transform: uppercase;
}

.ingredient-desktop-heading p:last-child {
  color: var(--text-muted);
  font-size: 18px;
  line-height: 29px;
}

.ingredient-summary-rail {
  position: sticky;
  top: 92px;
  align-self: stretch;
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-height: calc(100vh - 140px);
  overflow: hidden;
  border-radius: 20px;
  background: var(--surface);
  padding: 24px;
  box-shadow: var(--shadow-composer);
}

.selected-ingredients-stacked {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.selected-ingredients-stacked .selected-chip-row {
  display: grid;
  gap: 8px;
  flex: 1 1 auto;
  align-content: start;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 0 4px 0 0;
}

.selected-ingredients-stacked .selected-chip {
  width: 100%;
  justify-content: space-between;
  text-align: left;
}

.summary-action {
  flex: 0 0 auto;
  width: 100%;
}

.ingredient-mobile-action {
  display: none;
}

.ingredient-mobile-selected {
  display: none;
}

@keyframes skeletonPulse {
  0% { background-position: 180% 0; }
  100% { background-position: -180% 0; }
}

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

@media (min-width: 900px) {
  .ingredient-full-page .ingredient-item-grid {
    gap: 10px;
  }
}

@media (min-width: 1200px) {
  .ingredient-full-page .ingredient-item-grid {
    gap: 10px;
  }
}

@media (max-width: 899px) {
  .ingredient-composer-card {
    padding: 24px;
  }

  .ingredient-full-page {
    padding-bottom: calc(88px + env(safe-area-inset-bottom));
  }

  .ingredient-mobile-top {
    position: static;
    z-index: 20;
    display: block;
    border-bottom: 1px solid var(--border);
    background: rgba(251, 248, 242, .96);
    backdrop-filter: blur(12px);
  }

  .ingredient-mobile-title-row {
    width: min(var(--max-content), calc(100% - (var(--gutter) * 2)));
    min-height: 56px;
    margin: 0 auto;
    display: flex;
    align-items: center;
  }

  .ingredient-mobile-title-row h1 {
    margin: 0;
    font-family: 'Manrope', sans-serif;
    font-size: 18px;
    font-weight: 800;
    letter-spacing: 0;
    line-height: 24px;
  }

  .ingredient-full-shell {
    display: block;
    padding: 16px 0 0;
  }

  .ingredient-desktop-heading,
  .ingredient-summary-rail {
    display: none;
  }

  .ingredient-browser-panel {
    display: grid;
    gap: 16px;
  }

  .ingredient-browser-panel .ingredient-browse {
    padding-bottom: 20px;
  }

  .ingredient-mobile-selected {
    display: block;
  }

  .ingredient-full-page .ingredient-item-grid {
    gap: 8px;
  }

  .ingredient-mobile-action {
    position: fixed;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 40;
    width: 100vw;
    max-width: 100vw;
    display: grid;
    gap: 8px;
    border-top: 1px solid var(--border);
    background: rgba(255, 255, 255, .96);
    padding: 12px var(--gutter) calc(12px + env(safe-area-inset-bottom));
    backdrop-filter: blur(12px);
  }

  .ingredient-mobile-action-summary {
    min-width: 0;
    color: var(--text-muted);
    font-size: 13px;
    line-height: 18px;
    white-space: nowrap;
  }

  .ingredient-mobile-action strong {
    color: var(--text);
  }

  .ingredient-mobile-action-buttons {
    display: grid;
    gap: 8px;
  }

  .ingredient-mobile-action-buttons.has-fridge-action {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  }

  .ingredient-mobile-action .wu-button {
    width: calc(100vw - (var(--gutter) * 2));
    margin-left: 0;
    padding-right: 18px;
    padding-left: 18px;
  }

  .ingredient-mobile-action-buttons.has-fridge-action .wu-button {
    width: 100%;
  }
}

@media (max-width: 599px) {
  .ingredient-composer-card {
    grid-template-rows: auto auto minmax(0, 1fr) auto auto auto;
    gap: 12px;
    padding: 16px;
  }

  .ingredient-item-grid {
    gap: 6px;
  }

  .ingredient-search-field {
    min-height: 46px;
    padding: 0 12px;
  }

  .ingredient-tabs {
    gap: 12px;
    padding-right: 0;
  }

  .ingredient-tabs button {
    min-height: 38px;
  }

  .ingredient-tabs-cue {
    width: 34px;
  }

  .ingredient-composer-card .ingredient-browse {
    min-height: 0;
    overflow-y: auto;
    gap: 8px;
    padding-right: 2px;
  }

  .ingredient-category-section {
    gap: 6px;
  }

  .ingredient-item {
    min-height: 36px;
    padding: 7px 11px;
  }

  .composer-footer {
    align-items: stretch;
    border-top: 1px solid var(--border);
    padding-top: 12px;
  }

  .composer-footer .wu-button {
    width: 100%;
  }

  .selected-ingredients {
    gap: 8px;
  }

  .selected-chip-row {
    display: grid;
    align-items: flex-start;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 12px;
  }

  .selected-chip {
    width: max-content;
    justify-self: start;
    min-height: 34px;
    padding: 6px 10px;
  }
}
