:root {
  color-scheme: only light;
  font-family: 'Inter', 'Segoe UI', sans-serif;
  background-color: #fef5ff;
  color: #111827;
  --control-font-size: 1rem;
  --control-padding-y: 0.375rem;
  --control-padding-x: 0.45rem;
  --control-radius: 0.75rem;
  --control-border-color: rgba(124, 58, 237, 0.28);
  --control-border: 1px solid rgba(124, 58, 237, 0.28);
  --control-bg: rgba(250, 245, 255, 0.7);
  --control-bg-focus: rgba(255, 255, 255, 0.98);
  --control-text: #111827;
  --control-placeholder: rgba(17, 24, 39, 0.55);
  --control-focus-border: #8b5cf6;
  --control-focus-ring: rgba(139, 92, 246, 0.18);
  --control-disabled-bg: rgba(241, 245, 249, 0.6);
  --control-disabled-text: rgba(15, 23, 42, 0.45);
  --button-padding-y: 0.75rem;
  --button-padding-x: 1.8rem;
  --button-radius: 9999px;
  --button-background: linear-gradient(135deg, #f97316 0%, #f43f5e 50%, #8b5cf6 100%);
  --button-color: #ffffff;
  --button-shadow: 0 20px 35px -15px rgba(244, 63, 94, 0.55);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: linear-gradient(160deg, rgba(255, 239, 250, 0.85) 0%, rgba(235, 248, 255, 0.9) 45%, rgba(243, 247, 255, 0.95) 100%);
}

a {
  color: #2563eb;
}

header,
main,
footer {
  max-width: 960px;
  margin: 0 auto;
  padding: 1.5rem;
}

.footer-version {
  margin-left: 0.75rem;
  font-size: 0.85rem;
  color: rgba(17, 24, 39, 0.6);
  letter-spacing: 0.01em;
}

nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: rgba(251, 191, 36, 0.18);
  color: #92400e;
  padding: 0.35rem 0.8rem;
  border-radius: 9999px;
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.hero {
  display: grid;
  gap: 1.5rem;
  background: #ffffffee;
  border-radius: 1.5rem;
  padding: 2rem;
  box-shadow: 0 24px 60px rgba(79, 70, 229, 0.15);
  border: 1px solid rgba(79, 70, 229, 0.12);
}

.hero h1 {
  font-size: 2.5rem;
  line-height: 1.1;
  color: #312e81;
  margin: 0;
}

.hero p {
  margin: 0;
  font-size: 1.05rem;
  color: rgba(17, 24, 39, 0.75);
}

.hero-actions {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  align-items: center;
}

button,
input[type="submit"],
input[type="button"],
input[type="reset"],
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: var(--button-padding-y) var(--button-padding-x);
  border-radius: var(--button-radius);
  border: none;
  background: var(--button-background);
  color: var(--button-color);
  font-weight: 600;
  font-size: 1rem;
  line-height: 1;
  text-decoration: none;
  box-shadow: var(--button-shadow);
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.2s ease, background 0.3s ease;
}

button,
input[type="submit"],
input[type="button"],
input[type="reset"] {
  -webkit-appearance: none;
  appearance: none;
}

.button-secondary {
  --button-shadow: 0 16px 30px -20px rgba(99, 102, 241, 0.45);
  background: rgba(99, 102, 241, 0.12);
  border: 1px solid rgba(99, 102, 241, 0.4);
  color: #4c1d95;
}

button:hover,
.button:hover,
input[type="submit"]:hover,
input[type="button"]:hover,
input[type="reset"]:hover {
  transform: translateY(-1px);
}

button:focus-visible,
.button:focus-visible,
a.button:focus-visible,
input[type="submit"]:focus-visible,
input[type="button"]:focus-visible,
input[type="reset"]:focus-visible {
  outline: none;
  box-shadow: 0 0 0 4px rgba(139, 92, 246, 0.25), var(--button-shadow);
}

.button-secondary:focus-visible {
  box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.2), var(--button-shadow);
}

button:disabled,
input[type="submit"]:disabled,
input[type="button"]:disabled,
input[type="reset"]:disabled {
  opacity: 0.65;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

form {
  max-width: 420px;
  margin: 0 auto;
  background: #ffffff;
  padding: 2rem;
  border-radius: 1.25rem;
  box-shadow: 0 30px 60px rgba(79, 70, 229, 0.18);
  border: 1px solid rgba(79, 70, 229, 0.1);
}

label {
  display: block;
  margin-bottom: 0.45rem;
  font-weight: 600;
  color: rgba(17, 24, 39, 0.85);
  letter-spacing: 0.01em;
}

input,
select,
textarea {
  font-family: inherit;
  font-size: var(--control-font-size);
  color: var(--control-text);
}

input::placeholder,
textarea::placeholder {
  color: var(--control-placeholder);
}

input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="color"]),
select,
textarea {
  width: 100%;
  padding: var(--control-padding-y) var(--control-padding-x);
  border-radius: var(--control-radius);
  border: var(--control-border);
  background: var(--control-bg);
  color: var(--control-text);
  margin-bottom: 1.1rem;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
  box-shadow: 0 1px 2px rgba(148, 163, 184, 0.08);
}

textarea {
  min-height: 120px;
  resize: vertical;
}

select {
  cursor: pointer;
}

input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="color"]):focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: none;
  border-color: var(--control-focus-border);
  box-shadow: 0 0 0 4px var(--control-focus-ring), 0 1px 2px rgba(148, 163, 184, 0.08);
  background: var(--control-bg-focus);
}

input:disabled,
select:disabled,
textarea:disabled {
  background: var(--control-disabled-bg);
  color: var(--control-disabled-text);
  cursor: not-allowed;
}

input[type="checkbox"],
input[type="radio"] {
  width: 1.05rem;
  height: 1.05rem;
  margin: 0 0.45rem 0 0;
  vertical-align: middle;
  accent-color: #6366f1;
}

input[type="radio"] {
  border-radius: 50%;
}

input[type="file"] {
  cursor: pointer;
}

input[type="file"]::file-selector-button,
input[type="file"]::-webkit-file-upload-button {
  margin-right: 0.85rem;
  padding: 0.55rem 1.25rem;
  border: none;
  border-radius: 9999px;
  background: var(--button-background);
  color: var(--button-color);
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.3s ease;
}

input[type="file"]::file-selector-button:hover,
input[type="file"]::-webkit-file-upload-button:hover {
  transform: translateY(-1px);
}

input[type="file"]::file-selector-button:focus-visible,
input[type="file"]::-webkit-file-upload-button:focus-visible {
  outline: none;
  box-shadow: 0 0 0 4px rgba(139, 92, 246, 0.25);
}

.alert {
  border-radius: 1rem;
  padding: 1rem;
  margin-bottom: 1rem;
  border: 1px solid transparent;
  background: #fff;
  box-shadow: 0 20px 35px rgba(79, 70, 229, 0.12);
}

.alert-success {
  border-color: rgba(34, 197, 94, 0.35);
  background: rgba(220, 252, 231, 0.8);
  color: #047857;
}

.alert-error {
  border-color: rgba(244, 63, 94, 0.4);
  background: rgba(254, 226, 226, 0.85);
  color: #be123c;
}

.alert-info {
  border-color: rgba(59, 130, 246, 0.4);
  background: rgba(225, 239, 254, 0.9);
  color: #1d4ed8;
}

.card {
  background: #ffffff;
  border-radius: 1.25rem;
  padding: 1.75rem;
  box-shadow: 0 24px 60px rgba(79, 70, 229, 0.1);
  border: 1px solid rgba(99, 102, 241, 0.12);
  margin-bottom: 1.5rem;
}

.card h2 {
  margin-top: 0;
  color: #4c1d95;
}

footer {
  font-size: 0.85rem;
  color: rgba(17, 24, 39, 0.54);
  text-align: center;
}

.photo-preview {
  margin: 1.5rem 0;
  border-radius: 1.25rem;
  overflow: hidden;
  max-height: 420px;
  box-shadow: 0 20px 40px rgba(79, 70, 229, 0.18);
  border: 1px solid rgba(79, 70, 229, 0.16);
}

.photo-preview img {
  width: 100%;
  height: auto;
  display: block;
}

form.photo-review-form {
  max-width: none;
  width: 100%;
  background: transparent;
  box-shadow: none;
  border: none;
  padding: 0;
  margin-top: 1.5rem;
}


.detected-item {
  background: rgba(255, 255, 255, 0.92);
  border-radius: 1.25rem;
  border: 1px solid rgba(99, 102, 241, 0.2);
  padding: 1.25rem;
  margin-bottom: 1rem;
  box-shadow: 0 16px 40px rgba(79, 70, 229, 0.1);
  display: grid;
  gap: 1rem;
}

.detected-item-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.detected-item-header label {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin: 0;
  font-weight: 600;
}

.detected-item-label {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.25rem;
}

.detected-item-label strong {
  color: #4c1d95;
}

.confidence {
  font-size: 0.85rem;
  color: rgba(17, 24, 39, 0.6);
}

.detected-item-body {
  display: grid;
  gap: 1rem;
}

.field textarea {
  resize: vertical;
}

.quantity-field input[type="number"] {
  max-width: 160px;
}

.unit-field select {
  max-width: 180px;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-top: 1.5rem;
}

.actions .button {
  flex: 1;
  min-width: 200px;
}

.form-helper {
  font-size: 0.85rem;
  color: rgba(17, 24, 39, 0.6);
  margin: 0 0 1rem;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.explore-search {
  max-width: none;
  margin: 0;
  background: transparent;
  border: none;
  box-shadow: none;
  padding: 0;
  display: grid;
  gap: 1rem;
}

.explore-search__bar {
  position: relative;
}

.explore-search__bar input {
  width: 100%;
  padding: 1rem 1.25rem;
  border-radius: 1.25rem;
  border: 1px solid rgba(99, 102, 241, 0.3);
  background: rgba(255, 255, 255, 0.92);
  font-size: 1rem;
  box-shadow: 0 20px 45px rgba(99, 102, 241, 0.18);
}

.autocomplete-list {
  position: absolute;
  top: calc(100% + 0.35rem);
  left: 0;
  right: 0;
  background: #fff;
  border-radius: 1rem;
  border: 1px solid rgba(99, 102, 241, 0.2);
  box-shadow: 0 22px 45px rgba(17, 24, 39, 0.12);
  z-index: 30;
  padding: 0.35rem 0;
  max-height: 280px;
  overflow-y: auto;
}

.autocomplete-list[hidden] {
  display: none;
}

.autocomplete-item {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  padding: 0.65rem 1rem;
  cursor: pointer;
}

.autocomplete-item:hover,
.autocomplete-item:focus,
.autocomplete-item.is-active {
  background: rgba(99, 102, 241, 0.08);
}

.autocomplete-item__title {
  font-weight: 600;
  color: #312e81;
}

.autocomplete-item__meta {
  font-size: 0.85rem;
  color: rgba(17, 24, 39, 0.6);
}

.explore-search__filters {
  display: grid;
  gap: 0.75rem;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.data-type-toggle {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  border: none;
  margin: 1rem 0 0.5rem;
  padding: 0;
}

.data-type-toggle legend {
  width: 100%;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: rgba(55, 65, 81, 0.72);
  margin-bottom: 0.35rem;
}

.toggle-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.4);
  padding: 0.35rem 0.85rem;
  cursor: pointer;
  font-size: 0.85rem;
  background: rgba(255, 255, 255, 0.85);
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}

.toggle-chip input {
  display: none;
}

.toggle-chip.is-active {
  transform: translateY(-1px);
  border-color: rgba(79, 70, 229, 0.45);
  box-shadow: 0 8px 20px rgba(79, 70, 229, 0.15);
}

.toggle-chip--foundation_food.is-active { background: rgba(37, 99, 235, 0.15); color: #1e3a8a; }
.toggle-chip--survey_fndds_food.is-active { background: rgba(16, 185, 129, 0.18); color: #065f46; }
.toggle-chip--sr_legacy_food.is-active { background: rgba(245, 158, 11, 0.18); color: #92400e; }
.toggle-chip--branded_food.is-active { background: rgba(168, 85, 247, 0.18); color: #6b21a8; }
.toggle-chip--macros.is-active { background: rgba(37, 99, 235, 0.18); color: #1d4ed8; }
.toggle-chip--vitamins.is-active { background: rgba(249, 115, 22, 0.18); color: #c2410c; }
.toggle-chip--minerals.is-active { background: rgba(16, 185, 129, 0.2); color: #047857; }
.toggle-chip--amino_acids.is-active { background: rgba(168, 85, 247, 0.18); color: #7c3aed; }

.popular-tag-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  border: 1px solid rgba(148, 163, 184, 0.45);
  border-radius: 999px;
  padding: 0.25rem 0.65rem;
  background: rgba(255, 255, 255, 0.92);
  color: #1f2937;
  cursor: pointer;
  font-size: 0.75rem;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

.popular-tag-chip input {
  display: none;
}

.popular-tag-chip__label {
  font-weight: 500;
  text-transform: none;
  letter-spacing: 0;
}

.popular-tag-chip__stat {
  font-size: 0.7rem;
  opacity: 0.65;
}

.popular-tag-chip.is-active {
  transform: translateY(-1px);
  border-color: rgba(79, 70, 229, 0.45);
  box-shadow: 0 10px 20px rgba(79, 70, 229, 0.12);
  background: rgba(129, 140, 248, 0.14);
  color: #312e81;
}

.explore-search__filters select,
.explore-search__filters input {
  border-radius: 1rem;
  border: 1px solid rgba(124, 58, 237, 0.28);
  background: rgba(250, 245, 255, 0.7);
  padding: 0.8rem 1rem;
}

.explore-search__actions {
  align-items: center;
}

.search-loader {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: rgba(17, 24, 39, 0.65);
  font-size: 0.95rem;
}

.search-loader[hidden] {
  display: none;
}

.spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(99, 102, 241, 0.2);
  border-top-color: rgba(99, 102, 241, 0.8);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.analyze-loader {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  margin-top: 1rem;
  font-size: 0.95rem;
  color: rgba(17, 24, 39, 0.7);
}

.analyze-loader[hidden] {
  display: none;
}

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

.food-page {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 1.5rem;
}

.food-page__sidebar {
  display: grid;
  gap: 1.5rem;
}

.food-page__content {
  display: grid;
  gap: 1.5rem;
}

.food-dv-card {
  display: grid;
  gap: 1.25rem;
}

.daily-value-header h2 {
  margin: 0 0 0.35rem 0;
  color: #312e81;
}

.daily-value-subtitle {
  margin: 0;
  font-size: 0.9rem;
  color: rgba(55, 65, 81, 0.65);
}

.daily-value-body {
  display: grid;
  gap: 1.2rem;
  grid-template-columns: minmax(0, 2fr) minmax(220px, 1fr);
  align-items: flex-start;
}

.daily-value-chart {
  min-height: 360px;
}

.daily-value-controls h3 {
  margin-top: 0;
  font-size: 0.95rem;
  color: rgba(55, 65, 81, 0.75);
}

.daily-value-toggles {
  display: grid;
  gap: 0.6rem;
}

.tracker-widget {
  background: #ffffff;
  border-radius: 1.25rem;
  padding: 1.5rem;
  box-shadow: 0 26px 55px rgba(79, 70, 229, 0.15);
  border: 1px solid rgba(99, 102, 241, 0.12);
  display: grid;
  gap: 1rem;
}

.tracker-widget__subtitle {
  margin: 0;
  font-size: 0.95rem;
  color: rgba(17, 24, 39, 0.65);
}

.tracker-widget__form {
  display: grid;
  gap: 1rem;
  margin: 0;
  padding: 0;
  border: none;
  background: transparent;
  box-shadow: none;
}

.tracker-widget__row {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.tracker-widget__field--unit {
  max-width: 140px;
}

.tracker-widget__field {
  display: grid;
  gap: 0.35rem;
}

.tracker-widget__hint {
  font-size: 0.85rem;
  color: rgba(17, 24, 39, 0.6);
  margin: 0;
  text-align: center;
}

.tracker-widget__hint-icon {
  font-weight: 700;
  color: #4c1d95;
}

.recent-logs-card {
  display: grid;
  gap: 1rem;
}

.recent-logs-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 0.65rem;
}

.recent-logs-list li {
  padding: 0.75rem 1rem;
  border-radius: 1rem;
  border: 1px solid rgba(112, 26, 117, 0.15);
  background: rgba(255, 246, 255, 0.92);
  display: grid;
  gap: 0.25rem;
}

.recent-logs-list .timestamp {
  font-size: 0.85rem;
  color: rgba(17, 24, 39, 0.55);
}

.recent-logs-list .note {
  font-size: 0.85rem;
  color: rgba(17, 24, 39, 0.65);
}

.food-nutrition-card {
  display: grid;
  gap: 2rem;
}

.food-nutrition-card__section {
  display: grid;
  gap: 1rem;
}

.nutrition-pill-grid {
  display: grid;
  gap: 0.75rem;
}

.nutrition-pill {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(255, 246, 255, 0.9);
  border: 1px solid rgba(112, 26, 117, 0.18);
  border-radius: 0.85rem;
  padding: 0.75rem 1rem;
}

.quick-add {
  position: fixed;
  top: 1.5rem;
  right: 1.5rem;
  z-index: 100;
}

.quick-add__button {
  width: 58px;
  height: 58px;
  padding: 0;
  border-radius: 20px;
  background: linear-gradient(135deg, #22d3ee 0%, #6366f1 50%, #a855f7 100%);
  border: none;
  color: #fff;
  font-size: 2rem;
  font-weight: 700;
  box-shadow: 0 28px 45px rgba(99, 102, 241, 0.25);
  cursor: pointer;
}

.quick-add__backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.4);
  backdrop-filter: blur(4px);
  z-index: 99;
}

.quick-add__modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 100;
  width: min(480px, 90%);
}

.quick-add__modal[hidden],
.quick-add__backdrop[hidden] {
  display: none;
}

.quick-add__dialog {
  background: #fff;
  border-radius: 1.5rem;
  padding: 1.5rem;
  box-shadow: 0 40px 70px rgba(15, 23, 42, 0.25);
  border: 1px solid rgba(99, 102, 241, 0.2);
  display: grid;
  gap: 1.25rem;
}

.quick-add__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.quick-add__header h2 {
  margin: 0;
  font-size: 1.4rem;
  color: #312e81;
}

.quick-add__header-actions {
  display: flex;
  gap: 0.5rem;
}

.quick-add__icon-button {
  border: 1px solid rgba(99, 102, 241, 0.35);
  background: rgba(243, 232, 255, 0.8);
  color: #4c1d95;
  border-radius: 50%;
  width: 42px;
  height: 42px;
  font-weight: 600;
  cursor: pointer;
}

.quick-add__body form {
  display: grid;
  gap: 1rem;
  margin: 0;
  padding: 0;
  background: transparent;
  border: none;
  box-shadow: none;
}

.quick-add__field {
  display: grid;
  gap: 0.35rem;
  position: relative;
}

.quick-add__field-group {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
}

.quick-add__feedback {
  padding: 0.75rem 1rem;
  border-radius: 1rem;
  border: 1px solid transparent;
  background: rgba(34, 197, 94, 0.1);
  color: #047857;
}

.quick-add__feedback[data-state="error"] {
  background: rgba(244, 63, 94, 0.1);
  color: #be123c;
  border-color: rgba(244, 63, 94, 0.3);
}

.quick-add__feedback[hidden] {
  display: none;
}

.quick-add__selection {
  background: rgba(243, 232, 255, 0.5);
  border: 1px solid rgba(139, 92, 246, 0.25);
  border-radius: 1rem;
  padding: 0.75rem 1rem;
}

.quick-add__selection[hidden] {
  display: none;
}

.quick-add__selection p {
  margin: 0;
  font-size: 0.95rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
}

.quick-add__selection-label {
  font-weight: 600;
  color: #312e81;
}

.quick-add__selection a {
  font-size: 0.85rem;
}

.vision-summary {
  margin: 1.5rem 0;
  padding: 1.25rem;
  border-radius: 1rem;
  border: 1px solid rgba(99, 102, 241, 0.2);
  background: rgba(238, 242, 255, 0.6);
  display: grid;
  gap: 1rem;
}

.vision-summary h2 {
  margin: 0;
  color: #312e81;
}

.vision-summary__literal {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 600;
  color: #1f1d63;
}


.nutrient-detail {
  display: grid;
  gap: 1.5rem;
}

.nutrient-detail__header {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.nutrient-detail__header .button {
  align-self: flex-start;
}

.nutrient-detail__header h1 {
  margin: 0;
  color: #1f1d63;
}

.nutrient-detail__nav {
  display: flex;
}

.nutrient-detail__nav .button {
  align-self: flex-start;
}

.nutrient-detail__hero {
  display: grid;
  gap: 0.75rem;
  padding: 1.5rem;
  border-radius: 1.2rem;
  border: 1px solid rgba(124, 58, 237, 0.18);
  background: linear-gradient(165deg, rgba(238, 242, 255, 0.85) 0%, rgba(224, 231, 255, 0.92) 100%);
  box-shadow: 0 18px 34px rgba(79, 70, 229, 0.14);
}

.nutrient-detail__hero h1 {
  margin: 0;
  color: #1f1d63;
  font-size: clamp(2rem, 2.8vw, 2.5rem);
}

.nutrient-detail__meta {
  margin: 0;
  font-size: 0.95rem;
  color: rgba(30, 41, 59, 0.75);
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-wrap: wrap;
}

.nutrient-detail__insight-body {
  display: grid;
  gap: 0.65rem;
  font-size: 0.95rem;
  color: rgba(17, 24, 39, 0.82);
  line-height: 1.6;
}

.nutrient-detail__insight-body p {
  margin: 0;
}

.nutrient-detail__insight-body strong {
  color: #1f2937;
}

.nutrient-prioritize {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
  padding: 0.85rem 1.1rem;
  border-radius: 1rem;
  border: 1px solid rgba(148, 163, 184, 0.35);
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.06);
}

.nutrient-prioritize__label {
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: rgba(55, 65, 81, 0.72);
}

.nutrient-prioritize__options {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.nutrient-prioritize__button {
  border: 1px solid rgba(148, 163, 184, 0.4);
  background: rgba(248, 250, 252, 0.9);
  border-radius: 999px;
  padding: 0.4rem 0.95rem;
  font-size: 0.8rem;
  color: #1f2937;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}

.nutrient-prioritize__button:hover,
.nutrient-prioritize__button:focus-visible {
  outline: none;
  transform: translateY(-1px);
  border-color: rgba(99, 102, 241, 0.45);
  box-shadow: 0 10px 22px rgba(99, 102, 241, 0.15);
  background: rgba(238, 242, 255, 0.95);
}

.nutrient-prioritize__button.is-active {
  border-color: rgba(129, 140, 248, 0.55);
  background: rgba(129, 140, 248, 0.16);
  color: #312e81;
  box-shadow: 0 12px 24px rgba(129, 140, 248, 0.18);
}

.nutrient-detail__sections {
  display: grid;
  gap: 1.25rem;
}

.nutrient-panel {
  border-radius: 1.25rem;
  border: 1px solid rgba(148, 163, 184, 0.24);
  background: rgba(255, 255, 255, 0.95);
  box-shadow: 0 22px 45px rgba(15, 23, 42, 0.08);
  overflow: hidden;
}

.nutrient-panel summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  list-style: none;
  cursor: pointer;
  padding: 1.25rem 1.5rem;
}

.nutrient-panel summary::-webkit-details-marker {
  display: none;
}

.nutrient-panel__summary {
  display: grid;
  gap: 0.35rem;
}

.nutrient-panel__summary h2 {
  margin: 0;
  font-size: 1.1rem;
  color: #111827;
}

.nutrient-panel__summary p {
  margin: 0;
  font-size: 0.88rem;
  color: rgba(55, 65, 81, 0.7);
}

.nutrient-panel__chevron {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 999px;
  background: rgba(129, 140, 248, 0.16);
  color: #4338ca;
  font-size: 1rem;
  transition: transform 0.2s ease;
}

.nutrient-panel[open] .nutrient-panel__chevron {
  transform: rotate(180deg);
}

.nutrient-panel__content {
  padding: 0 1.5rem 1.5rem;
  display: grid;
  gap: 1rem;
}

.nutrient-panel__empty {
  margin: 0;
  font-size: 0.9rem;
  color: rgba(55, 65, 81, 0.65);
}

.nutrient-dataset-filter {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  padding: 0.85rem 1.1rem;
  border-radius: 1rem;
  border: 1px solid rgba(148, 163, 184, 0.35);
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.06);
}

.nutrient-dataset-filter__label {
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: rgba(55, 65, 81, 0.72);
}

.nutrient-dataset-filter__options {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.nutrient-dataset-filter__chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.85rem;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.45);
  text-decoration: none;
  font-size: 0.8rem;
  color: #1f2937;
  background: rgba(248, 250, 252, 0.9);
  transition: transform 0.15s ease, box-shadow 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}

.nutrient-dataset-filter__chip:hover,
.nutrient-dataset-filter__chip:focus-visible {
  transform: translateY(-1px);
  border-color: rgba(99, 102, 241, 0.45);
  box-shadow: 0 10px 22px rgba(99, 102, 241, 0.15);
  background: rgba(238, 242, 255, 0.95);
  outline: none;
}

.nutrient-dataset-filter__chip.is-active {
  background: rgba(129, 140, 248, 0.16);
  color: #312e81;
  border-color: rgba(129, 140, 248, 0.55);
  box-shadow: 0 12px 24px rgba(129, 140, 248, 0.18);
}

.nutrient-dataset-filter__chip-label {
  font-weight: 600;
}

.nutrient-dataset-filter__chip-count {
  font-size: 0.7rem;
  opacity: 0.7;
}

.nutrient-detail__columns {
  display: grid;
  gap: 1.5rem;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.nutrient-detail__columns section {
  background: rgba(255, 255, 255, 0.95);
  border-radius: 1.25rem;
  border: 1px solid rgba(148, 163, 184, 0.2);
  padding: 1.5rem;
  box-shadow: 0 22px 45px rgba(15, 23, 42, 0.08);
  display: grid;
  gap: 1rem;
}

.nutrient-detail__columns h2 {
  margin: 0;
  color: #111827;
  font-size: 1.1rem;
}

.nutrient-detail__empty {
  margin: 0;
  font-size: 0.95rem;
  color: rgba(30, 41, 59, 0.68);
}

.nutrient-detail__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 1rem;
}

.nutrient-panel__list {
  display: flex;
  gap: 1rem;
  overflow-x: auto;
  padding-bottom: 0.35rem;
  scroll-snap-type: x proximity;
}

.nutrient-panel__list::-webkit-scrollbar {
  height: 0.5rem;
}

.nutrient-panel__list::-webkit-scrollbar-thumb {
  background: rgba(99, 102, 241, 0.25);
  border-radius: 999px;
}

.nutrient-panel__list::-webkit-scrollbar-track {
  background: rgba(210, 214, 255, 0.2);
}

.nutrient-detail__list li {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
  border-radius: 1rem;
  border: 1px solid rgba(99, 102, 241, 0.18);
  background: rgba(238, 242, 255, 0.55);
  padding: 0.9rem 1rem;
}

.nutrient-panel__list li {
  min-width: min(320px, 100%);
  scroll-snap-align: start;
}

.nutrient-detail__list li[hidden],
.nutrient-detail__list li.is-hidden {
  display: none;
}

.nutrient-detail__badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: 999px;
  background: rgba(99, 102, 241, 0.15);
  color: #4338ca;
  font-weight: 700;
}

.nutrient-detail__item-body {
  display: grid;
  gap: 0.35rem;
  flex: 1;
}

.nutrient-detail__item-body strong {
  color: #1f2937;
}

.nutrient-detail__item-body p {
  margin: 0;
  font-size: 0.9rem;
  color: rgba(30, 41, 59, 0.68);
}

.nutrient-detail__labels {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  margin-top: 0.35rem;
}

.nutrient-detail__label-pill {
  display: inline-flex;
  align-items: center;
  padding: 0.15rem 0.5rem;
  border-radius: 0.75rem;
  background: rgba(148, 163, 184, 0.24);
  color: #1f2937;
  font-size: 0.68rem;
  font-weight: 500;
}

.nutrient-detail__actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-top: 0.6rem;
}

.nutrient-detail__action-button {
  padding: 0.4rem 0.9rem;
  font-size: 0.75rem;
  border-radius: 0.75rem;
  white-space: nowrap;
}

.nutrient-detail__actions .button.button-secondary {
  background: rgba(148, 163, 184, 0.18);
  border: 1px solid rgba(148, 163, 184, 0.35);
  color: #1f2937;
  box-shadow: none;
}

.nutrient-detail__meta-line {
  display: inline-flex;
  gap: 0.35rem;
  align-items: center;
  font-size: 0.8rem;
  color: rgba(55, 65, 81, 0.75);
}

.nutrient-detail__insight {
  margin: 1.5rem 0 1.75rem;
  padding: 1.25rem 1.5rem;
  border-radius: 1.1rem;
  border: 1px solid rgba(129, 140, 248, 0.28);
  background: linear-gradient(180deg, rgba(238, 242, 255, 0.9) 0%, rgba(224, 231, 255, 0.85) 100%);
  display: grid;
  gap: 0.65rem;
  box-shadow: 0 18px 32px rgba(79, 70, 229, 0.12);
}

.nutrient-detail__insight h2 {
  margin: 0;
  font-size: 1.05rem;
  color: #312e81;
}

.nutrient-detail__insight p {
  margin: 0;
  font-size: 0.9rem;
  color: rgba(17, 24, 39, 0.78);
  line-height: 1.55;
}

.nutrient-detail__insight p strong {
  color: #1f2937;
}

.nutrient-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  align-items: center;
  padding: 0.75rem 1rem;
  border-radius: 0.9rem;
  background: rgba(238, 242, 255, 0.65);
  border: 1px solid rgba(99, 102, 241, 0.18);
}

.nutrient-filter__label {
  font-size: 0.85rem;
  font-weight: 600;
  color: #312e81;
}

.nutrient-filter__options {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.nutrient-filter__button {
  border: none;
  border-radius: 999px;
  padding: 0.45rem 0.9rem;
  font-size: 0.8rem;
  font-weight: 600;
  background: rgba(99, 102, 241, 0.12);
  color: #4338ca;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
}

.nutrient-filter__button:hover,
.nutrient-filter__button:focus-visible {
  background: rgba(99, 102, 241, 0.22);
  color: #312e81;
  outline: none;
  box-shadow: 0 0 0 3px rgba(129, 140, 248, 0.35);
}

.nutrient-filter__button.is-active {
  background: linear-gradient(180deg, #4f46e5 0%, #4338ca 100%);
  color: #f8fafc;
  box-shadow: 0 14px 28px rgba(79, 70, 229, 0.22);
}

.nutrient-filter--top {
  margin-bottom: 1.75rem;
}

.nutrient-detail__link {
  font-size: 0.85rem;
  font-weight: 600;
  color: #4338ca;
  text-decoration: none;
}

.nutrient-detail__link:hover,
.nutrient-detail__link:focus-visible {
  text-decoration: underline;
}

.nutrient-detail__cta {
  margin: 0;
  font-size: 0.95rem;
  color: rgba(30, 41, 59, 0.8);
  background: rgba(238, 242, 255, 0.7);
  border: 1px solid rgba(99, 102, 241, 0.3);
  border-radius: 0.9rem;
  padding: 0.75rem 1rem;
}

.nutrient-detail__cta a {
  color: #4338ca;
  font-weight: 600;
  text-decoration: none;
}

.nutrient-detail__cta a:hover,
.nutrient-detail__cta a:focus-visible {
  text-decoration: underline;
}

@media (max-width: 1024px) {
  .nutrient-detail__columns {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 768px) {
  .nutrient-detail__columns {
    grid-template-columns: 1fr;
  }
}

.suggest-feedback {
  font-size: 0.85rem;
  color: rgba(17, 24, 39, 0.6);
  margin-top: 0.35rem;
}

.manual-fdc {
  margin-top: 0.75rem;
  display: grid;
  gap: 0.35rem;
}

.debug-panel {
  margin-top: 1.5rem;
  background: rgba(15, 23, 42, 0.05);
  border: 1px dashed rgba(15, 23, 42, 0.2);
  border-radius: 1rem;
  padding: 1rem 1.25rem;
  overflow-x: auto;
}

.debug-panel h2 {
  margin-top: 0;
  font-size: 1rem;
  color: #1d4ed8;
}

.debug-panel pre {
  margin: 0;
  font-size: 0.85rem;
  white-space: pre-wrap;
  word-break: break-word;
}

@media (max-width: 640px) {
  .detected-item {
    padding: 1rem;
  }

.today-overview {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  margin-top: 1rem;
}

.stat {
  background: rgba(99, 102, 241, 0.08);
  border: 1px solid rgba(99, 102, 241, 0.2);
  border-radius: 1rem;
  padding: 1rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.stat-label {
  font-size: 0.85rem;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: rgba(17, 24, 39, 0.58);
}

.stat-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: #312e81;
}

.stat-footnote {
  margin-top: 0.75rem;
  font-size: 0.85rem;
  color: rgba(17, 24, 39, 0.6);
}

.trend-table-wrapper {
  margin-top: 1rem;
  overflow-x: auto;
}

.trend-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 520px;
}

.trend-table th,
.trend-table td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid rgba(148, 163, 184, 0.25);
  text-align: left;
  font-size: 0.95rem;
}

.trend-table tbody tr:nth-child(even) {
  background: rgba(241, 245, 249, 0.4);
}

.trend-table tbody tr:hover {
  background: rgba(99, 102, 241, 0.08);
}

.results-table-wrapper {
  margin-top: 1rem;
  overflow-x: auto;
}

.results-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 640px;
}

.results-table th,
.results-table td {
  padding: 0.6rem 0.75rem;
  border-bottom: 1px solid rgba(203, 213, 225, 0.7);
  text-align: left;
  font-size: 0.9rem;
}

.results-table th {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: rgba(55, 65, 81, 0.68);
}

.results-table__actions {
  text-align: right;
  white-space: nowrap;
}

.results-table tbody tr:hover {
  background: rgba(239, 246, 255, 0.6);
}

.explore-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
  background: rgba(148, 163, 184, 0.18);
  color: #1f2937;
  border: 1px solid rgba(148, 163, 184, 0.35);
}

button.explore-tag {
  border: none;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.2s ease, background 0.2s ease, border-color 0.2s ease;
}

button.explore-tag:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 14px rgba(148, 163, 184, 0.25);
  background: rgba(148, 163, 184, 0.28);
}

button.explore-tag:focus-visible {
  outline: 3px solid rgba(148, 163, 184, 0.35);
  outline-offset: 1px;
}

.explore-tag.is-active {
  background: rgba(129, 140, 248, 0.16);
  color: #1e3a8a;
  border-color: rgba(129, 140, 248, 0.45);
  box-shadow: 0 6px 16px rgba(129, 140, 248, 0.2);
}

.explore-tag--modifier {
  background: rgba(241, 245, 249, 0.7);
  color: #1f2937;
  border-color: rgba(203, 213, 225, 0.7);
}

.explore-tag--amino {
  background: rgba(14, 165, 233, 0.16);
  color: #0369a1;
}

.dataset-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #111827;
}

.dataset-chip--foundation_food { background: rgba(37, 99, 235, 0.16); color: #1d4ed8; }
.dataset-chip--survey_fndds_food { background: rgba(16, 185, 129, 0.18); color: #047857; }
.dataset-chip--sr_legacy_food { background: rgba(245, 158, 11, 0.18); color: #b45309; }
.dataset-chip--branded_food { background: rgba(168, 85, 247, 0.18); color: #7c3aed; }

.results-row.dataset-tag--foundation_food td:first-child { border-left: 3px solid rgba(37, 99, 235, 0.5); }
.results-row.dataset-tag--survey_fndds_food td:first-child { border-left: 3px solid rgba(16, 185, 129, 0.5); }
.results-row.dataset-tag--sr_legacy_food td:first-child { border-left: 3px solid rgba(245, 158, 11, 0.5); }
.results-row.dataset-tag--branded_food td:first-child { border-left: 3px solid rgba(168, 85, 247, 0.5); }

.review-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 520px;
}

.review-table th,
.review-table td {
  padding: 0.6rem 0.8rem;
  border-bottom: 1px solid rgba(226, 232, 240, 0.8);
  text-align: left;
  vertical-align: top;
  font-size: 0.9rem;
}

.review-table th {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: rgba(55, 65, 81, 0.7);
}

.review-table tbody tr:nth-child(even) {
  background: rgba(248, 250, 255, 0.6);
}

.review-table tbody tr:hover {
  background: rgba(224, 231, 255, 0.4);
}

.review-table--vision th:nth-child(1) {
  width: 90px;
}

.review-table__arrow-col {
  width: 32px;
  text-align: center;
}

.review-table__arrow {
  font-size: 1.4rem;
  text-align: center;
  color: rgba(79, 70, 229, 0.55);
  font-weight: 600;
}

.review-table__detected {
  min-width: 220px;
}

.compact-input,
.review-table select {
  width: 100%;
  padding: 0.5rem 0.6rem;
  border-radius: 0.6rem;
  border: 1px solid rgba(148, 163, 184, 0.4);
  background: rgba(255, 255, 255, 0.92);
  font-size: 0.9rem;
}

.compact-input:focus,
.review-table select:focus {
  outline: none;
  border-color: rgba(99, 102, 241, 0.75);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.18);
}

.button-link {
  background: transparent;
  border: none;
  color: #4c1d95;
  padding: 0;
  font-size: 0.85rem;
  cursor: pointer;
  text-decoration: underline;
  margin-top: 0.35rem;
}

.vision-meta {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-top: 0.35rem;
  font-size: 0.75rem;
  color: rgba(55, 65, 81, 0.7);
}

.vision-flags {
  margin-top: 0.35rem;
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.vision-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  padding: 0.25rem 0.55rem;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 600;
  background: rgba(79, 70, 229, 0.12);
  color: #312e81;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.vision-chip--processing {
  background: rgba(16, 185, 129, 0.16);
  color: #047857;
}

.match-preference {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  margin-bottom: 0.6rem;
}

.match-preference select {
  width: 100%;
}

.match-preference__label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: rgba(49, 46, 129, 0.75);
}

.review-table__actions {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  min-width: 150px;
}

.review-table__status {
  font-size: 0.8rem;
  color: rgba(30, 41, 59, 0.65);
}

.review-table__status[data-state="success"] {
  color: #047857;
  font-weight: 600;
}

.review-table__status[data-state="error"] {
  color: #b91c1c;
  font-weight: 600;
}

.review-table__row--matched {
  opacity: 0.75;
}

.nutrient-groups {
  display: grid;
  gap: 1.75rem;
}

.nutrient-group {
  display: grid;
  gap: 1rem;
}

.nutrient-group h3 {
  margin: 0;
  font-size: 1.1rem;
  color: #312e81;
}

.nutrient-group__header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.nutrient-group__header-meta {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-wrap: wrap;
  font-size: 0.85rem;
  color: rgba(17, 24, 39, 0.6);
}

.nutrient-group__average {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.3rem 0.75rem;
  border-radius: 999px;
  border: 1px solid rgba(99, 102, 241, 0.2);
  background: rgba(99, 102, 241, 0.08);
  color: #4338ca;
  font-weight: 600;
  letter-spacing: 0.01em;
  text-transform: uppercase;
}

.nutrient-group__workspace {
  display: flex;
  flex-wrap: nowrap;
  align-items: stretch;
  gap: 1rem;
  transition: gap 0.35s ease;
}

.nutrient-group__workspace--open {
  gap: 1.15rem;
}

.nutrient-group__chart {
  position: relative;
  border: 1px solid rgba(148, 163, 184, 0.25);
  border-radius: 1rem;
  background: linear-gradient(180deg, rgba(248, 250, 252, 0.95) 0%, rgba(241, 245, 249, 0.85) 100%);
  padding: 1rem 1.25rem;
  min-width: 0;
  flex: 1 1 100%;
  transition: flex-basis 0.4s ease, transform 0.35s ease;
}

.nutrient-group__workspace--open .nutrient-group__chart {
  flex-basis: 72%;
}

.nutrient-group__chart-area {
  width: 100%;
  height: 100%;
}

.nutrient-group__drawer-toggle {
  border: none;
  background: linear-gradient(180deg, #4338ca 0%, #312e81 100%);
  color: #ffffff;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 0.85rem 0.5rem;
  border-radius: 1rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  align-self: stretch;
  width: 2.75rem;
  writing-mode: vertical-rl;
  text-orientation: mixed;
  box-shadow: 0 12px 24px rgba(79, 70, 229, 0.18);
  transition: transform 0.35s ease, background 0.2s ease, box-shadow 0.3s ease;
  transform: translateX(0);
  flex: 0 0 auto;
}

.nutrient-group__drawer-toggle:hover {
  background: linear-gradient(180deg, #4c40e0 0%, #1e1b4b 100%);
  box-shadow: 0 16px 28px rgba(79, 70, 229, 0.22);
}

.nutrient-group__drawer-label {
  font-size: 0.8rem;
}

.nutrient-group__workspace--open .nutrient-group__drawer-toggle {
  background: linear-gradient(180deg, #0f172a 0%, #1e293b 100%);
  transform: translateX(6px);
}

.nutrient-group__details {
  border: 1px solid rgba(148, 163, 184, 0.28);
  border-radius: 1rem;
  background: #ffffff;
  padding: 1.1rem 1.15rem;
  overflow: hidden;
  gap: 1rem;
  box-shadow: 0 20px 34px rgba(15, 23, 42, 0.08);
  opacity: 0;
  visibility: hidden;
  transform: translateX(18px);
  flex: 0 0 0%;
  width: 0;
  min-width: 0;
  max-height: 0;
  pointer-events: none;
  transition: flex-basis 0.4s ease, max-height 0.4s ease, opacity 0.25s ease, transform 0.35s ease, visibility 0s linear 0.35s, width 0.4s ease;
}

.nutrient-group__details[hidden] {
  display: none !important;
}

.nutrient-group__workspace--open .nutrient-group__details {
  opacity: 1;
  visibility: visible;
  transform: translateX(0);
  pointer-events: auto;
  flex: 0 0 28%;
  width: auto;
  transition: flex-basis 0.4s ease, max-height 0.4s ease, opacity 0.25s ease, transform 0.35s ease, visibility 0s, width 0.4s ease;
}

.nutrient-group__details-header {
  display: grid;
  gap: 0.2rem;
}

.nutrient-group__details-header h4 {
  margin: 0;
  font-size: 1rem;
  color: #1f2937;
}

.nutrient-group__details-subhead {
  margin: 0;
  font-size: 0.8rem;
  color: rgba(17, 24, 39, 0.6);
}

.nutrient-group__legend {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.75rem;
}

.nutrient-group__legend-item {
  border-radius: 0.9rem;
  border: 1px solid rgba(148, 163, 184, 0.25);
  background: rgba(255, 255, 255, 0.95);
  padding: 0;
}

.nutrient-group__legend-dot {
  width: 0.85rem;
  height: 0.85rem;
  border-radius: 999px;
  background: rgba(99, 102, 241, 0.75);
  margin-top: 0.25rem;
  flex-shrink: 0;
}

.nutrient-group__legend-entry {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
  width: 100%;
  background: rgba(255, 255, 255, 0.95);
  border-radius: inherit;
  padding: 0.7rem 0.95rem;
  text-decoration: none;
  color: inherit;
  cursor: pointer;
}

.nutrient-group__legend-text {
  display: grid;
  gap: 0.2rem;
}

.nutrient-group__legend-label {
  font-weight: 600;
  font-size: 0.95rem;
  color: #312e81;
}

.nutrient-group__legend-value {
  font-size: 0.85rem;
  color: rgba(17, 24, 39, 0.7);
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  align-items: center;
}

.nutrient-group__legend-value strong {
  font-weight: 600;
  color: rgba(17, 24, 39, 0.85);
}

.nutrient-group__legend-percent {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: 999px;
  padding: 0.15rem 0.55rem;
  background: rgba(99, 102, 241, 0.15);
  color: #4338ca;
}

.nutrient-group__footnote {
  font-size: 0.8rem;
  color: rgba(55, 65, 81, 0.65);
}

@media (max-width: 900px) {
  .nutrient-group__workspace {
    flex-direction: column;
  }

  .nutrient-group__workspace--open {
    gap: 0.75rem;
  }

  .nutrient-group__drawer-toggle {
    width: 100%;
    writing-mode: horizontal-tb;
    text-orientation: initial;
    padding: 0.75rem 1rem;
    border-radius: 1rem;
    box-shadow: 0 10px 18px rgba(79, 70, 229, 0.18);
  }

  .nutrient-group__drawer-label {
    transform: none;
  }

  .nutrient-group__workspace--open .nutrient-group__chart {
    flex-basis: auto;
  }

  .nutrient-group__details {
    width: 100%;
    flex: 1 1 auto;
    max-height: 0;
  }

  .nutrient-group__workspace--open .nutrient-group__details {
    flex: 1 1 auto;
  }
}

@media (min-width: 768px) {
  .nutrient-group__legend {
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  }
}

.nutrient-bar__label {
  display: flex;
  justify-content: space-between;
  font-size: 0.9rem;
  color: rgba(17, 24, 39, 0.75);
}

.nutrient-detail-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.6rem;
}

.nutrient-detail__label {
  font-weight: 600;
  color: #312e81;
}

.nutrient-detail__value {
  font-size: 0.9rem;
  color: rgba(17, 24, 39, 0.75);
}

.nutrient-detail__percent {
  margin-left: 0.35rem;
  font-size: 0.8rem;
  color: rgba(59, 130, 246, 0.85);
}

.nutrient-bar {
  height: 10px;
  border-radius: 999px;
  background: rgba(229, 231, 235, 0.9);
  overflow: hidden;
  position: relative;
}

.nutrient-bar__fill {
  height: 100%;
  background: linear-gradient(135deg, #38bdf8 0%, #6366f1 50%, #ec4899 100%);
  transition: width 0.2s ease;
}

.nutrient-bar__footnote {
  font-size: 0.8rem;
  color: rgba(55, 65, 81, 0.65);
}

.meal-template-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.85rem;
}

.meal-template-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid rgba(148, 163, 184, 0.25);
  border-radius: 0.85rem;
  padding: 0.9rem 1.1rem;
  gap: 1rem;
}

.meal-template-meta {
  display: inline-block;
  margin-left: 0.5rem;
  font-size: 0.85rem;
  color: rgba(55, 65, 81, 0.65);
}

.meal-template-actions {
  display: flex;
  gap: 0.6rem;
  align-items: center;
}

.top-food-list {
  list-style: decimal;
  padding-left: 1.25rem;
  display: grid;
  gap: 0.75rem;
  margin-top: 1rem;
}

.top-food-list li {
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(99, 102, 241, 0.18);
  border-radius: 1rem;
  padding: 1rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.top-food-meta {
  font-size: 0.9rem;
  color: rgba(17, 24, 39, 0.62);
}


@media (max-width: 640px) {
  .detected-item {
    padding: 1rem;
  }

  .detected-item-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .detected-item-label {
    align-items: flex-start;
  }

  .actions {
    flex-direction: column;
  }

  .today-overview {
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  }

  .trend-table {
    font-size: 0.9rem;
  }

  .food-page {
    grid-template-columns: 1fr;
  }

  .quick-add {
    top: auto;
    bottom: 1.5rem;
  }

  .quick-add__modal {
    top: 55%;
  }

  .explore-search__filters {
    grid-template-columns: 1fr;
  }
}
