/* ── NUTRITION — style MyFitnessPal / Lifesum modernisé ───────────────────── */
#v-nutrition {
  --nut-protein: #38bdf8;
  --nut-carbs: #f59e0b;
  --nut-fat: #a78bfa;
  --nut-accent: var(--accent, #e84c0d);
  --nut-card: var(--bg2, #111114);
  --nut-card-elevated: #16171a;
  --nut-line: rgba(255, 255, 255, 0.08);
}

.nut-wrap {
  max-width: 620px;
  margin: 0 auto;
  padding: 8px 16px 140px;
}

/* Header */
.nut-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 2px 10px;
}

.nut-badge {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 2.2px;
  text-transform: uppercase;
  color: var(--nut-accent);
}

.nut-title {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 30px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: -0.4px;
  line-height: 1;
  margin-top: 4px;
}

.nut-goal-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 14px;
  background: var(--nut-card);
  border: 1px solid var(--nut-line);
  border-radius: 12px;
  color: var(--text);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: background .2s, border-color .2s;
}

.nut-goal-btn:active {
  background: rgba(255, 255, 255, .07);
}

/* Day nav */
.nut-daynav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 6px 0 14px;
  padding: 6px;
  background: var(--nut-card);
  border: 1px solid var(--nut-line);
  border-radius: 14px;
}

.nut-daynav-btn {
  width: 38px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  border-radius: 10px;
  color: var(--text);
  font-size: 22px;
  font-weight: 300;
  cursor: pointer;
}

.nut-daynav-btn:active {
  background: rgba(255, 255, 255, .07);
}

.nut-daynav-btn:disabled {
  opacity: .25;
}

.nut-daynav-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 16px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .6px;
}

.nut-today-badge {
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--nut-accent);
  background: rgba(232, 76, 13, .12);
  padding: 3px 8px;
  border-radius: 20px;
}

/* Summary card */
.nut-summary {
  background: var(--nut-card);
  border: 1px solid var(--nut-line);
  border-radius: 22px;
  padding: 20px 18px 18px;
  margin-bottom: 12px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, .22);
}

.nut-summary-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.nut-cal-main {
  flex: 1;
  min-width: 0;
}

.nut-cal-main-kicker {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 6px;
}

.nut-cal-main-num {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 48px;
  font-weight: 900;
  line-height: 1;
  letter-spacing: -1.5px;
}

.nut-cal-main-num small {
  font-size: 16px;
  font-weight: 600;
  color: var(--muted);
  margin-left: 4px;
}

.nut-cal-main-sub {
  margin-top: 6px;
  font-size: 13px;
  color: var(--muted);
}

.nut-cal-main-sub b {
  color: var(--text);
  font-weight: 700;
}

.nut-cal-ring-wrap {
  position: relative;
  width: 110px;
  height: 110px;
  flex-shrink: 0;
}

.nut-cal-ring-wrap svg {
  transform: rotate(-90deg);
}

.nut-cal-ring-center {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.nut-cal-ring-center strong {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 26px;
  font-weight: 900;
  line-height: 1;
}

.nut-cal-ring-center span {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--muted);
  margin-top: 3px;
}

.nut-macros {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.nut-macro {
  background: rgba(0, 0, 0, .18);
  border-radius: 14px;
  padding: 12px 10px;
  text-align: left;
}

.nut-macro-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.nut-macro-name {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .8px;
  text-transform: uppercase;
  color: var(--muted);
}

.nut-macro-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
}

.nut-macro-dot.p { background: var(--nut-protein); }
.nut-macro-dot.c { background: var(--nut-carbs); }
.nut-macro-dot.f { background: var(--nut-fat); }

.nut-macro-bar {
  height: 5px;
  background: rgba(255, 255, 255, .08);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 7px;
}

.nut-macro-fill {
  height: 100%;
  border-radius: 3px;
  transition: width .45s cubic-bezier(.22, 1, .36, 1);
}

.nut-macro-fill.p { background: var(--nut-protein); }
.nut-macro-fill.c { background: var(--nut-carbs); }
.nut-macro-fill.f { background: var(--nut-fat); }

.nut-macro-vals {
  font-size: 12px;
  color: var(--muted);
}

.nut-macro-vals b {
  color: var(--text);
  font-weight: 800;
}

/* Quick add button */
.nut-quick-add {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  margin: 0 0 12px;
  padding: 16px 18px;
  border: 1px solid rgba(232, 76, 13, .25);
  border-radius: 18px;
  background: linear-gradient(135deg, rgba(232, 76, 13, .14), rgba(232, 76, 13, .04));
  color: var(--text);
  text-align: left;
  cursor: pointer;
  transition: transform .15s, box-shadow .2s;
}

.nut-quick-add:active {
  transform: scale(.98);
}

.nut-quick-add-icon {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 14px;
  background: var(--nut-accent);
  color: #fff;
  font-size: 28px;
  font-weight: 500;
  flex-shrink: 0;
}

.nut-quick-add span:nth-child(2) {
  display: flex;
  flex: 1;
  min-width: 0;
  flex-direction: column;
  gap: 3px;
}

.nut-quick-add b {
  font-size: 15px;
  font-weight: 800;
}

.nut-quick-add small {
  font-size: 11px;
  color: var(--muted);
}

.nut-quick-add i {
  color: var(--nut-accent);
  font-size: 22px;
  font-style: normal;
}

/* Water */
.nut-water {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--nut-card);
  border: 1px solid var(--nut-line);
  border-radius: 18px;
  padding: 14px 16px;
  margin-bottom: 12px;
}

.nut-water-info {
  flex: 1;
  min-width: 0;
}

.nut-water-head {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 9px;
}

.nut-water-head span:last-child {
  color: var(--dim);
  font-weight: 600;
}

.nut-water-bar {
  height: 7px;
  background: rgba(255, 255, 255, .08);
  border-radius: 4px;
  overflow: hidden;
}

.nut-water-fill {
  height: 100%;
  background: #38bdf8;
  border-radius: 4px;
  transition: width .45s cubic-bezier(.22, 1, .36, 1);
}

.nut-water-btns {
  display: flex;
  gap: 7px;
  flex-shrink: 0;
}

.nut-water-btns button {
  width: 42px;
  height: 38px;
  background: rgba(56, 189, 248, .1);
  border: 1px solid rgba(56, 189, 248, .22);
  color: #7dd3fc;
  border-radius: 11px;
  font-size: 18px;
  font-weight: 800;
  cursor: pointer;
}

.nut-water-btns button:active {
  background: rgba(56, 189, 248, .22);
}

/* Section heading */
.nut-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 2px 10px;
}

.nut-section-head span {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 17px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: .8px;
}

.nut-section-head small {
  font-size: 11px;
  color: var(--muted);
}

/* Meals */
.nut-meals {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.nut-meal {
  background: var(--nut-card);
  border: 1px solid var(--nut-line);
  border-radius: 18px;
  padding: 14px 16px 12px;
  box-shadow: 0 10px 26px rgba(0, 0, 0, .12);
}

.nut-meal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.nut-meal-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 15px;
  font-weight: 800;
}

.nut-meal-title span {
  font-size: 18px;
}

.nut-meal-kcal {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 17px;
  font-weight: 900;
  color: var(--text);
}

.nut-meal-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.nut-meal-actions button {
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, .05);
  border: 1px solid var(--nut-line);
  border-radius: 9px;
  color: var(--muted);
  font-size: 16px;
  cursor: pointer;
}

.nut-meal-actions button:active {
  background: rgba(255, 255, 255, .1);
}

.nut-meal-empty {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0 6px;
  color: var(--muted);
}

.nut-meal-empty span {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 11px;
  background: rgba(255, 255, 255, .04);
  font-size: 17px;
}

.nut-meal-empty div {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nut-meal-empty b {
  color: var(--text);
  font-size: 12px;
}

.nut-meal-empty small {
  font-size: 10px;
  line-height: 1.3;
}

.nut-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-top: 1px solid var(--nut-line);
}

.nut-item-main {
  flex: 1 1 auto;
  min-width: 0;
  text-align: left;
  background: none;
  border: none;
  color: var(--text);
  cursor: pointer;
  padding: 0;
}

.nut-item-name {
  font-size: 14px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nut-item-meta {
  font-size: 11px;
  color: var(--muted);
  margin-top: 2px;
}

.nut-item-kcal {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 15px;
  font-weight: 800;
  flex-shrink: 0;
}

.nut-item-kcal::after {
  content: ' kcal';
  font-size: 9px;
  font-weight: 600;
  color: var(--dim);
}

.nut-item-del {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  border: none;
  background: rgba(255, 255, 255, .05);
  color: var(--dim);
  font-size: 12px;
  cursor: pointer;
}

.nut-item-del:active {
  background: rgba(244, 63, 94, .18);
  color: #f43f5e;
}

/* Floating action button */
.nut-fab {
  position: fixed;
  bottom: calc(88px + env(safe-area-inset-bottom, 0px));
  right: 16px;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: var(--nut-accent);
  color: #fff;
  border: none;
  box-shadow: 0 10px 30px rgba(232, 76, 13, .4);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  font-weight: 300;
  cursor: pointer;
  z-index: 90;
  transition: transform .2s, box-shadow .2s;
}

.nut-fab:active {
  transform: scale(.92);
  box-shadow: 0 6px 18px rgba(232, 76, 13, .35);
}

/* Footer */
.nut-foot {
  text-align: center;
  color: var(--dim);
  font-size: 11px;
  margin-top: 22px;
  padding: 0 20px;
  line-height: 1.5;
  opacity: .8;
}

/* Modal */
#nut-modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 350;
  background: rgba(0, 0, 0, .72);
  backdrop-filter: blur(10px);
  align-items: flex-end;
  justify-content: center;
}

#nut-modal.open {
  display: flex;
}

.nut-modal-open,
.nut-modal-open body {
  overflow: hidden !important;
  overscroll-behavior: none !important;
}

.nut-modal-open body {
  position: fixed;
  left: 0;
  right: 0;
  width: 100%;
}

.nut-sheet {
  width: 100%;
  max-width: 480px;
  max-height: 92dvh;
  background: #141518;
  border: 0.5px solid var(--nut-line);
  border-radius: 24px 24px 0 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 -20px 50px rgba(0, 0, 0, .5);
  animation: nutSheetIn .3s cubic-bezier(.22, 1, .36, 1) both;
}

@keyframes nutSheetIn {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

.nut-sheet-body {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

.nut-sheet-head {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 18px 14px 14px;
  border-bottom: 1px solid var(--nut-line);
}

.nut-sheet-head::before {
  content: '';
  position: absolute;
  top: 8px;
  left: 50%;
  transform: translateX(-50%);
  width: 38px;
  height: 4px;
  border-radius: 3px;
  background: rgba(255, 255, 255, .16);
}

.nut-sheet-title {
  font-weight: 800;
  font-size: 16px;
  flex: 1;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nut-back {
  background: none;
  border: none;
  color: var(--nut-accent);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  padding: 5px 8px;
  min-width: 60px;
}

/* Search */
.nut-search-bar {
  position: relative;
  display: flex;
  gap: 9px;
  padding: 12px 16px 10px;
}

.nut-search-icon {
  position: absolute;
  left: 30px;
  top: 50%;
  transform: translateY(-42%);
  z-index: 1;
  color: var(--muted);
  font-size: 18px;
  pointer-events: none;
}

#nut-search-input {
  flex: 1;
  background: rgba(255, 255, 255, .06);
  border: 1px solid var(--nut-line);
  border-radius: 14px;
  padding: 13px 15px 13px 42px;
  color: var(--text);
  font-size: 15px;
  min-height: 50px;
}

#nut-search-input:focus {
  outline: none;
  border-color: rgba(232, 76, 13, .5);
}

.nut-scan-btn {
  flex: 0 0 auto;
  width: 50px;
  border: 1px solid var(--nut-line);
  background: rgba(255, 255, 255, .06);
  color: var(--text);
  border-radius: 14px;
  font-size: 22px;
  cursor: pointer;
}

/* Tabs */
.nut-library-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  margin: 2px 16px 10px;
  padding: 4px;
  border-radius: 12px;
  background: rgba(255, 255, 255, .04);
}

.nut-library-tabs button {
  min-height: 36px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .5px;
  cursor: pointer;
}

.nut-library-tabs button.on {
  background: var(--nut-accent);
  color: #fff;
}

/* Results */
.nut-results {
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 0 16px 22px;
  max-height: 58dvh;
}

.nut-results-hint {
  color: var(--dim);
  font-size: 12px;
  padding: 10px 4px;
  line-height: 1.5;
}

.nut-res {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 56px;
  text-align: left;
  background: rgba(255, 255, 255, .04);
  border: 1px solid var(--nut-line);
  border-radius: 14px;
  padding: 10px 12px;
  margin-bottom: 8px;
  color: var(--text);
  cursor: pointer;
  transition: background .15s, border-color .15s;
}

.nut-res:hover,
.nut-res:focus-within {
  background: rgba(255, 255, 255, .08);
  border-color: rgba(255, 255, 255, .14);
}

.nut-res:active {
  background: rgba(255, 255, 255, .1);
  transform: scale(.99);
}

.nut-res-main {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
  padding: 0;
  margin: 0;
  background: transparent;
  border: none;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
  min-height: 44px;
}

.nut-res-main:focus-visible {
  outline: none;
}

.nut-res-body {
  flex: 1;
  min-width: 0;
}

.nut-res-name {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nut-res-meta {
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
}

.nut-res-brand {
  color: var(--dim);
}

.nut-res-kcal {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 18px;
  font-weight: 800;
  color: var(--text);
  flex-shrink: 0;
}

.nut-res-fav {
  flex-shrink: 0;
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  border-radius: 10px;
  color: rgba(255, 255, 255, .18);
  font-size: 18px;
  cursor: pointer;
  transition: background .15s, color .15s;
}

.nut-res-fav:hover,
.nut-res-fav:focus {
  background: rgba(255, 255, 255, .07);
}

.nut-res-fav.on {
  color: #f6c84c;
}

/* Quantity sheet */
.nut-qty-wrap {
  padding: 18px 16px 24px;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}

.nut-qty-preview {
  text-align: center;
  background: rgba(255, 255, 255, .04);
  border: 1px solid var(--nut-line);
  border-radius: 18px;
  padding: 18px;
  margin-bottom: 18px;
}

.nut-prev-kcal {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 34px;
  font-weight: 900;
  line-height: 1;
}

.nut-prev-macros {
  display: flex;
  justify-content: center;
  gap: 18px;
  font-size: 13px;
  color: var(--muted);
  margin-top: 8px;
}

.nut-qty-row {
  display: flex;
  gap: 10px;
  align-items: stretch;
  margin-bottom: 14px;
}

.nut-qty-input {
  flex: 1;
  min-width: 0;
  background: rgba(255, 255, 255, .06);
  border: 1px solid var(--nut-line);
  border-radius: 14px;
  padding: 14px 4px;
  color: var(--text);
  font-size: 22px;
  font-weight: 800;
  text-align: center;
}

.nut-qty-input:focus {
  outline: none;
  border-color: rgba(232, 76, 13, .5);
}

.nut-units {
  display: flex;
  gap: 6px;
}

.nut-unit {
  padding: 0 16px;
  border-radius: 12px;
  border: 1px solid var(--nut-line);
  background: rgba(255, 255, 255, .04);
  color: var(--dim);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.nut-unit.on {
  background: var(--nut-accent);
  border-color: var(--nut-accent);
  color: #fff;
}

.nut-meal-pick {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 16px;
}

.nut-mealpick {
  padding: 12px;
  border-radius: 12px;
  border: 1px solid var(--nut-line);
  background: rgba(255, 255, 255, .04);
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.nut-mealpick.on {
  background: rgba(232, 76, 13, .15);
  border-color: var(--nut-accent);
  color: var(--nut-accent);
}

.nut-confirm {
  width: 100%;
  background: var(--nut-accent);
  border: none;
  color: #fff;
  border-radius: 15px;
  padding: 16px;
  font-size: 16px;
  font-weight: 800;
  cursor: pointer;
}

.nut-confirm:active {
  transform: scale(.98);
}

/* Manual form & goals */
.nut-manual {
  padding: 18px 16px 24px;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}

.nut-manual > label {
  display: block;
  font-size: 12px;
  color: var(--dim);
  font-weight: 700;
  margin-bottom: 14px;
}

.nut-manual input {
  display: block;
  width: 100%;
  margin-top: 6px;
  background: rgba(255, 255, 255, .06);
  border: 1px solid var(--nut-line);
  border-radius: 12px;
  padding: 13px;
  color: var(--text);
  font-size: 15px;
  font-weight: 600;
}

.nut-manual input:focus {
  outline: none;
  border-color: rgba(232, 76, 13, .5);
}

.nut-manual-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 11px;
  margin-bottom: 10px;
}

.nut-manual-grid label {
  display: block;
  font-size: 12px;
  color: var(--dim);
  font-weight: 700;
  margin: 0;
}

/* Responsive */
@media (max-width: 360px) {
  .nut-wrap {
    padding-left: 12px;
    padding-right: 12px;
  }
  .nut-title {
    font-size: 26px;
  }
  .nut-cal-main-num {
    font-size: 40px;
  }
  .nut-cal-ring-wrap {
    width: 90px;
    height: 90px;
  }
  .nut-macros {
    gap: 6px;
  }
  .nut-macro {
    padding: 10px 8px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .nut-macro-fill,
  .nut-water-fill {
    transition: none;
  }
  .nut-sheet {
    animation: none;
  }
}
