/* ── Nutrition Lab ── */

/* View mode toggle (Today / Saved) */
.nl-view-toggle {
  display:flex; background:var(--subtle-bg); border-radius:12px;
  padding:3px; margin-bottom:16px;
}
.nl-view-btn {
  flex:1; background:none; border:none; color:var(--muted);
  padding:10px; border-radius:10px; font-size:0.9rem; font-weight:600;
  cursor:pointer; font-family:inherit; transition:all 0.2s;
}
.nl-view-btn.active {
  background:var(--card); color:var(--text);
  box-shadow:0 1px 4px rgba(0,0,0,0.1);
}

.nl-sort-row { display:flex; gap:8px; margin-bottom:16px; }
.nl-sort-btn { flex:1; background:var(--card); border:1px solid var(--border-med); color:var(--muted); padding:10px; border-radius:12px; font-size:0.85rem; font-family:inherit; cursor:pointer; }
.nl-sort-btn.active { color:var(--accent); border-color:var(--accent); background:rgba(233,69,96,0.12); font-weight:700; }
.nl-fav-btn { flex:0 0 48px; font-size:1.1rem; }
.nl-fav-btn.active { color:#ffd93d; border-color:#ffd93d; background:rgba(255,217,61,0.1); }
.nl-meal-card { background:var(--card); border-radius:16px; padding:16px; margin-bottom:12px; cursor:pointer; border:1px solid var(--border); }
.nl-meal-card:active { opacity:0.85; }
.nl-meal-top { display:flex; align-items:center; gap:6px; margin-bottom:8px; }
.nl-meal-name { font-weight:700; font-size:1.05rem; }
.nl-meal-fav { background:none; border:none; font-size:1rem; cursor:pointer; padding:2px 4px; color:#ffd93d; flex-shrink:0; }
.nl-meal-del {
  background:none; border:none; color:var(--accent); font-size:1rem;
  cursor:pointer; padding:4px 6px; margin-left:auto; opacity:0.7; flex-shrink:0;
}
.nl-meal-del:active { opacity:1; }
.nl-meal-macros { display:flex; gap:14px; font-size:0.8rem; color:var(--muted); }
.nl-meal-macros b { color:var(--text-secondary); font-weight:600; }
.nl-meal-cals { font-size:0.85rem; font-weight:700; color:var(--accent); margin-top:6px; }
.nl-empty { text-align:center; padding:60px 20px; color:var(--muted); }
.nl-empty-icon { font-size:3rem; margin-bottom:12px; }
.nl-empty-text { font-size:0.95rem; line-height:1.6; }
.nl-chart-wrap { display:flex; align-items:center; justify-content:center; gap:20px; padding:16px 0 20px; }
.nl-pie-svg { transform:rotate(-90deg); }
.nl-chart-legend { display:flex; flex-direction:column; gap:8px; font-size:0.88rem; }
.nl-chart-empty { color:var(--muted); font-size:0.9rem; text-align:center; padding:30px; }
.nl-totals { display:flex; justify-content:space-around; background:var(--card); border-radius:16px; padding:14px 8px; margin-bottom:18px; }
.nl-total-item { text-align:center; }
.nl-total-val { font-size:1.1rem; font-weight:700; }
.nl-total-label { font-size:0.68rem; color:var(--muted); margin-top:2px; }
.nl-ing-card { background:var(--card); border-radius:14px; padding:14px; margin-bottom:10px; border:1px solid var(--border); }
.nl-ing-top { display:flex; align-items:center; gap:12px; margin-bottom:8px; }
.nl-ing-name { font-weight:600; font-size:0.95rem; flex:1; }
.nl-ing-remove { background:none; border:none; color:var(--accent); font-size:1.2rem; cursor:pointer; padding:4px 8px; }
.nl-ing-controls { display:flex; align-items:center; gap:12px; margin-bottom:8px; }
.nl-ing-btn { background:var(--subtle-bg); border:none; color:var(--text); width:36px; height:36px; border-radius:50%; font-size:1.1rem; font-weight:700; cursor:pointer; display:flex; align-items:center; justify-content:center; }
.nl-ing-btn:active { background:var(--subtle-bg-hover); }
.nl-ing-grams { font-size:1rem; font-weight:700; min-width:55px; text-align:center; }
.nl-ing-macros { display:flex; gap:10px; font-size:0.78rem; color:var(--muted); flex-wrap:wrap; }
.nl-ing-macros span { color:var(--text-secondary); }
.nl-meal-actions { display:flex; gap:10px; margin-top:16px; margin-bottom:20px; }
.nl-action-btn { flex:1; background:var(--subtle-bg); border:1px solid var(--border-med); color:var(--text); padding:14px; border-radius:14px; font-size:0.88rem; font-family:inherit; cursor:pointer; text-align:center; }
.nl-action-btn:active { opacity:0.8; }
.nl-notes { width:100%; box-sizing:border-box; background:var(--card); color:var(--text); border:1px solid var(--border-med); border-radius:12px; padding:12px 14px; font-size:0.92rem; font-family:inherit; resize:none; height:80px; outline:none; margin-bottom:16px; }
.nl-search { width:100%; box-sizing:border-box; background:var(--card); border:1px solid var(--border-med); color:var(--text); padding:14px 16px; border-radius:14px; font-size:1rem; font-family:inherit; outline:none; margin-bottom:14px; }
.nl-search::placeholder { color:var(--muted); }
.nl-cat-label { font-size:0.72rem; color:var(--muted); text-transform:uppercase; letter-spacing:1px; margin:14px 0 8px; font-weight:600; }
.nl-pick-item { display:flex; align-items:center; gap:12px; background:var(--card); border-radius:12px; padding:13px 16px; margin-bottom:8px; cursor:pointer; border:1px solid var(--border); }
.nl-pick-img { width:42px; height:42px; border-radius:10px; object-fit:cover; flex-shrink:0; }
.nl-pick-initial { width:42px; height:42px; border-radius:10px; background:var(--subtle-bg); display:flex; align-items:center; justify-content:center; font-size:1.1rem; font-weight:700; color:var(--muted); flex-shrink:0; }
.nl-ing-img { width:38px; height:38px; border-radius:9px; object-fit:cover; flex-shrink:0; }
.nl-ing-initial { width:38px; height:38px; border-radius:9px; background:var(--subtle-bg); display:flex; align-items:center; justify-content:center; font-size:0.95rem; font-weight:700; color:var(--muted); flex-shrink:0; }
.nl-pick-item:active { opacity:0.85; }
.nl-pick-name { font-weight:600; font-size:0.93rem; }
.nl-pick-sub { font-size:0.72rem; color:var(--muted); margin-top:2px; }
.nl-amount-title { font-size:1.1rem; font-weight:700; text-align:center; margin-bottom:4px; }
.nl-amount-sub { font-size:0.78rem; color:var(--muted); text-align:center; margin-bottom:20px; }
.nl-quick-row { display:flex; gap:10px; margin-bottom:18px; }
.nl-quick-btn { flex:1; background:var(--subtle-bg); border:1px solid var(--border-med); color:var(--text); padding:12px; border-radius:12px; font-size:0.9rem; font-family:inherit; cursor:pointer; text-align:center; }
.nl-quick-btn:active { background:rgba(233,69,96,0.2); border-color:var(--accent); }
.nl-gram-row { display:flex; align-items:center; justify-content:center; gap:18px; margin-bottom:18px; }
.nl-gram-display { font-size:1.5rem; font-weight:700; min-width:80px; text-align:center; }
.nl-gram-btn { background:var(--accent); border:none; color:#fff; width:46px; height:46px; border-radius:50%; font-size:1.3rem; font-weight:700; cursor:pointer; display:flex; align-items:center; justify-content:center; }
.nl-gram-btn:active { opacity:0.8; }
.nl-amount-preview { display:flex; justify-content:space-around; background:var(--subtle-bg); border-radius:12px; padding:12px; margin-bottom:20px; }
.nl-amount-preview div { text-align:center; }
.nl-amount-preview .val { font-weight:700; font-size:1rem; display:block; }
.nl-amount-preview .lbl { color:var(--muted); font-size:0.68rem; display:block; }
.nl-confirm-btn { width:100%; background:var(--accent); border:none; color:#fff; padding:16px; border-radius:16px; font-size:1rem; font-weight:700; font-family:inherit; cursor:pointer; }
.nl-confirm-btn:active { opacity:0.85; }
.nl-custom-row { display:flex; gap:10px; margin-bottom:12px; }
.nl-custom-field { flex:1; }
.nl-custom-field label { display:block; font-size:0.72rem; color:var(--muted); margin-bottom:4px; }
.nl-custom-field input { width:100%; box-sizing:border-box; background:var(--subtle-bg); border:1px solid var(--border-med); color:var(--text); padding:12px; border-radius:10px; font-size:0.95rem; font-family:inherit; outline:none; }
.nl-add-ing-btn { width:100%; background:rgba(233,69,96,0.12); border:1px solid rgba(233,69,96,0.3); color:var(--accent); padding:15px; border-radius:14px; font-size:0.95rem; font-weight:600; font-family:inherit; cursor:pointer; margin-bottom:12px; }
.nl-add-ing-btn:active { opacity:0.85; }
.nl-eat-today-btn {
  width:100%; background:var(--green); border:none; color:#fff;
  padding:15px; border-radius:14px; font-size:1rem; font-weight:700;
  font-family:inherit; cursor:pointer; margin-bottom:12px; margin-top:4px;
}
.nl-eat-today-btn:active { opacity:0.85; }
.nl-browse-btn { width:100%; background:var(--subtle-bg); border:1px solid var(--border-med); color:var(--text); padding:14px; border-radius:14px; font-size:0.95rem; font-family:inherit; cursor:pointer; margin-bottom:18px; text-align:center; }
.nl-browse-btn:active { background:var(--subtle-bg-hover); }
.nl-amount-header { display:flex; align-items:center; gap:14px; justify-content:center; margin-bottom:16px; }
.nl-amount-img { width:56px; height:56px; border-radius:14px; object-fit:cover; flex-shrink:0; }
.nl-amount-initial { width:56px; height:56px; border-radius:14px; background:var(--subtle-bg); display:flex; align-items:center; justify-content:center; font-size:1.4rem; font-weight:700; color:var(--muted); flex-shrink:0; }
.nl-custom-photo-area { margin:-4px 0 16px; }
.nl-custom-photo-btn { width:100%; background:var(--subtle-bg); border:1px dashed var(--border-med); color:var(--muted); padding:12px; border-radius:12px; font-size:0.85rem; font-family:inherit; cursor:pointer; text-align:center; }
.nl-custom-photo-btn:active { background:var(--subtle-bg-hover); }
.nl-custom-thumb { width:60px; height:60px; border-radius:12px; object-fit:cover; }

/* ── Nutrition Calendar ── */
#nlCalSection { margin-bottom: 18px; }

/* ── Macro Slider Modal ── */
.macro-input-label {
  display:block; font-size:0.72rem; color:var(--muted); text-transform:uppercase;
  letter-spacing:0.8px; font-weight:600; margin-bottom:6px;
}
.macro-cal-input {
  width:100%; box-sizing:border-box; background:var(--subtle-bg);
  border:1px solid var(--border-med); color:var(--text); padding:14px;
  border-radius:12px; font-size:1.1rem; font-weight:700;
  font-family:inherit; outline:none; text-align:center;
}
.macro-cal-quick {
  display:flex; gap:8px; margin:10px 0 0;
}
.macro-cal-quick button {
  flex:1; background:var(--card); border:1px solid var(--border-med);
  color:var(--muted); padding:8px; border-radius:10px; font-size:0.8rem;
  font-family:inherit; cursor:pointer;
}
.macro-cal-quick button:active { border-color:var(--accent); color:var(--accent); }

.macro-slider-wrap {
  position:relative; margin:10px 0 16px; padding:6px 0;
  touch-action:none; user-select:none;
}
.macro-slider-track {
  display:flex; height:36px; border-radius:18px; overflow:hidden;
}
.macro-slider-seg:nth-child(1) { background:#4ecdc4; }
.macro-slider-seg:nth-child(2) { background:#ff6b6b; }
.macro-slider-seg:nth-child(3) { background:#ffd93d; }
.macro-slider-handle {
  position:absolute; top:50%; transform:translate(-50%,-50%);
  width:26px; height:26px; border-radius:50%; background:#fff;
  box-shadow:0 2px 8px rgba(0,0,0,0.35); cursor:grab; z-index:2;
}
.macro-slider-handle:active { cursor:grabbing; transform:translate(-50%,-50%) scale(1.15); }

.macro-dist-info { display:flex; flex-direction:column; gap:8px; margin-bottom:18px; }
.macro-dist-item {
  display:flex; align-items:center; gap:10px; font-size:0.88rem;
}
.macro-dot {
  width:10px; height:10px; border-radius:50%; flex-shrink:0;
}
.macro-dist-name { flex:1; font-weight:600; }
.macro-dist-pct { min-width:36px; text-align:right; color:var(--muted); font-size:0.82rem; }
.macro-dist-g { min-width:48px; text-align:right; font-weight:700; font-size:0.9rem; }

.macro-clear-btn {
  width:100%; background:none; border:1px solid var(--border-med);
  color:var(--muted); padding:13px; border-radius:14px; font-size:0.88rem;
  font-family:inherit; cursor:pointer; margin-top:10px;
}
.macro-clear-btn:active { color:var(--accent); border-color:var(--accent); }

/* ── FAB Choice ── */
.nl-fab-choice-btn {
  width:100%; background:var(--card); border:1px solid var(--border-med);
  color:var(--text); padding:16px; border-radius:14px; font-size:0.95rem;
  font-weight:600; font-family:inherit; cursor:pointer; margin-bottom:10px;
  text-align:center;
}
.nl-fab-choice-btn:active { opacity:0.8; }
.nl-fab-choice-saved { background:var(--subtle-bg); }

/* ── Macro Goals ── */
.macro-goals-wrap {
  background:var(--card); border-radius:16px; padding:16px;
  margin-bottom:16px; border:1px solid var(--border);
}
.macro-goals-header {
  display:flex; justify-content:space-between; align-items:center; margin-bottom:14px;
}
.macro-goals-title {
  font-size:0.85rem; font-weight:700; text-transform:uppercase;
  letter-spacing:0.8px; color:var(--muted);
}
.macro-goals-edit {
  background:none; border:none; color:var(--accent);
  font-size:0.85rem; font-weight:600; cursor:pointer; font-family:inherit;
}
.macro-goal-row { margin-bottom:10px; }
.macro-goal-row:last-child { margin-bottom:0; }
.macro-goal-label { display:flex; justify-content:space-between; font-size:0.8rem; margin-bottom:4px; }
.macro-goal-name { font-weight:600; }
.macro-goal-nums { color:var(--muted); }
.macro-goal-bar {
  height:8px; border-radius:4px; background:var(--subtle-bg); overflow:hidden;
}
.macro-goal-fill { height:100%; border-radius:4px; transition:width 0.3s ease; }
.macro-set-btn {
  background:var(--subtle-bg); border:1px solid var(--border-med);
  color:var(--text-secondary); border-radius:12px;
  padding:14px; width:100%; text-align:center;
  font-size:0.9rem; font-weight:600; cursor:pointer; font-family:inherit;
  margin-bottom:16px;
}
.macro-set-btn:active { background:var(--subtle-bg-hover); }
