/* ── CSS Variables ──────────────────────────────────────────────── */
:root {
  --bg:        #f4f4f5;
  --surface:   #ffffff;
  --surface2:  #f9f9fb;
  --border:    #e4e4e7;
  --text:      #18181b;
  --text-muted:#71717a;
  --accent:    #4f46e5;
  --accent-lt: #eef2ff;
  --success:   #10b981;
  --warning:   #f59e0b;
  --danger:    #ef4444;
  --protein:   #3b82f6;
  --carbs:     #f59e0b;
  --fat:       #f43f5e;
  --fiber:     #10b981;
  --shadow:    0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.04);
  --radius:    12px;
  --radius-lg: 16px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg:        #09090b;
    --surface:   #18181b;
    --surface2:  #27272a;
    --border:    #3f3f46;
    --text:      #fafafa;
    --text-muted:#a1a1aa;
    --accent-lt: #1e1b4b;
    --shadow:    0 1px 3px rgba(0,0,0,.4);
  }
}

/* ── Reset ──────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 16px; -webkit-text-size-adjust: 100%; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100dvh;
  padding-bottom: 80px;
}

button { cursor: pointer; font: inherit; }
input  { font: inherit; }
a      { color: inherit; text-decoration: none; }

/* ── Layout ─────────────────────────────────────────────────────── */
.container {
  max-width: 680px;
  margin: 0 auto;
  padding: 0 16px;
}

/* ── Header ─────────────────────────────────────────────────────── */
#app-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 56px;
  gap: 8px;
}

.header-inner h1 {
  font-size: .75rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--accent);
}

.date-nav {
  display: flex;
  align-items: center;
  gap: 6px;
}

.date-nav .date-label {
  font-size: .9rem;
  font-weight: 600;
  min-width: 120px;
  text-align: center;
}

.btn-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: none;
  background: var(--surface2);
  border-radius: 8px;
  color: var(--text);
  transition: background .15s;
}
.btn-icon:hover { background: var(--border); }

.btn-today {
  font-size: .75rem;
  font-weight: 600;
  padding: 4px 10px;
  border: 1px solid var(--accent);
  background: var(--accent-lt);
  color: var(--accent);
  border-radius: 6px;
  transition: background .15s;
}
.btn-today:hover { background: var(--accent); color: #fff; }
.btn-today.hidden { visibility: hidden; }

/* ── Main content ───────────────────────────────────────────────── */
main { padding: 16px 0 8px; }
.stack { display: flex; flex-direction: column; gap: 12px; }

/* ── Card ───────────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  overflow: hidden;
}

/* ── Macro Summary Card ─────────────────────────────────────────── */
#macro-summary {
  padding: 20px;
}

.summary-layout {
  display: flex;
  align-items: center;
  gap: 24px;
}

/* Calorie donut ring */
.calorie-ring-wrap {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.calorie-ring-wrap svg {
  width: 120px;
  height: 120px;
  transform: rotate(-90deg);
}

.ring-label {
  text-align: center;
}

.ring-label .cal-value {
  font-size: 1.6rem;
  font-weight: 700;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.ring-label .cal-sub {
  font-size: .7rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .06em;
}

/* Macro bars column */
.macro-bars {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.macro-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.macro-row-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}

.macro-name {
  font-size: .75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
}

.macro-value {
  font-size: .8rem;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.bar-track {
  height: 8px;
  background: var(--surface2);
  border-radius: 99px;
  overflow: hidden;
  border: 1px solid var(--border);
}

.bar-fill {
  height: 100%;
  border-radius: 99px;
  transition: width .4s ease;
}

.bar-fill.over { background: var(--danger) !important; }

/* ── Meal Section ───────────────────────────────────────────────── */
.meal-card { }

.meal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  cursor: pointer;
  user-select: none;
  border-bottom: 1px solid var(--border);
}

.meal-header:hover { background: var(--surface2); }

.meal-title {
  font-size: .85rem;
  font-weight: 700;
  text-transform: capitalize;
  letter-spacing: .02em;
}

.meal-meta {
  display: flex;
  align-items: center;
  gap: 10px;
}

.meal-cal {
  font-size: .8rem;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.collapse-icon {
  color: var(--text-muted);
  transition: transform .2s;
  font-size: .7rem;
}

.meal-body { display: block; }
.meal-body.collapsed { display: none; }

.meal-entries { }

.food-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
}

.food-row:last-of-type { border-bottom: none; }

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

.food-name {
  font-size: .875rem;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.food-brand {
  font-size: .75rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.food-serving {
  font-size: .72rem;
  color: var(--text-muted);
  margin-top: 1px;
}

.food-macros {
  font-size: .72rem;
  color: var(--text-muted);
  display: flex;
  gap: 8px;
  margin-top: 2px;
}

.food-macros span { white-space: nowrap; }

.food-cal {
  font-size: .9rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.food-actions {
  display: flex;
  gap: 4px;
}

.btn-del, .btn-edit {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--text-muted);
  transition: background .15s, color .15s;
}

.btn-del:hover  { background: #fee2e2; color: var(--danger); }
.btn-edit:hover { background: var(--accent-lt); color: var(--accent); }

.meal-footer {
  padding: 10px 16px;
  border-top: 1px solid var(--border);
}

.btn-add-food {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border: 1.5px dashed var(--border);
  background: transparent;
  border-radius: 8px;
  color: var(--text-muted);
  font-size: .8rem;
  font-weight: 500;
  width: 100%;
  justify-content: center;
  transition: border-color .15s, color .15s, background .15s;
}

.btn-add-food:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-lt);
}

.empty-meal {
  padding: 14px 16px;
  text-align: center;
  font-size: .8rem;
  color: var(--text-muted);
}

/* ── Micronutrient Panel ────────────────────────────────────────── */
#micros-card {
  overflow: visible;
}

.micros-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  cursor: pointer;
  user-select: none;
}

.micros-header:hover { background: var(--surface2); border-radius: var(--radius-lg); }

.micros-title {
  font-size: .85rem;
  font-weight: 700;
}

.micros-body { padding: 0 16px 16px; }
.micros-body.collapsed { display: none; }

.micros-group-title {
  font-size: .7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-muted);
  margin: 12px 0 6px;
}

.micro-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .8rem;
}

.micro-table th {
  text-align: left;
  font-size: .7rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .05em;
  padding: 6px 8px;
  border-bottom: 1px solid var(--border);
}

.micro-table td {
  padding: 7px 8px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.micro-table tr:last-child td { border-bottom: none; }
.micro-table tr:nth-child(even) td { background: var(--surface2); }

.micro-bar-cell { width: 80px; }

.micro-bar-track {
  height: 5px;
  background: var(--border);
  border-radius: 99px;
  overflow: hidden;
}

.micro-bar-fill {
  height: 100%;
  border-radius: 99px;
  transition: width .4s ease;
}

.badge {
  display: inline-block;
  padding: 2px 7px;
  border-radius: 99px;
  font-size: .65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.badge-excellent { background: #d1fae5; color: #065f46; }
.badge-good      { background: #fef3c7; color: #92400e; }
.badge-low       { background: #fee2e2; color: #991b1b; }
.badge-unknown   { background: var(--border); color: var(--text-muted); }

@media (prefers-color-scheme: dark) {
  .badge-excellent { background: #064e3b; color: #6ee7b7; }
  .badge-good      { background: #451a03; color: #fcd34d; }
  .badge-low       { background: #450a0a; color: #fca5a5; }
}

/* ── Modal ──────────────────────────────────────────────────────── */
#modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.55);
  backdrop-filter: blur(4px);
  z-index: 100;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

#modal-overlay.hidden { display: none; }

#modal {
  background: var(--surface);
  width: 100%;
  max-width: 560px;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  max-height: 92dvh;
  display: flex;
  flex-direction: column;
  animation: slideUp .25s ease;
}

@keyframes slideUp {
  from { transform: translateY(100%); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}

@media (min-width: 600px) {
  #modal-overlay { align-items: center; }
  #modal {
    border-radius: var(--radius-lg);
    max-height: 85dvh;
  }
}

.modal-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 16px 12px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.modal-title {
  flex: 1;
  font-size: .95rem;
  font-weight: 700;
}

.btn-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: none;
  background: var(--surface2);
  border-radius: 50%;
  color: var(--text-muted);
  font-size: 1.1rem;
  line-height: 1;
}

.btn-close:hover { background: var(--border); color: var(--text); }

.modal-body {
  flex: 1;
  overflow-y: auto;
  overscroll-behavior: contain;
}

/* Search step */
#search-step, #serving-step { display: flex; flex-direction: column; height: 100%; }
#serving-step { display: none; }

.search-input-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.btn-scan {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  border: 1.5px solid var(--border);
  background: var(--surface2);
  border-radius: 10px;
  color: var(--text-muted);
  transition: background .15s, border-color .15s, color .15s;
}
.btn-scan:hover { background: var(--accent-lt); border-color: var(--accent); color: var(--accent); }

.search-input-wrap {
  flex: 1;
  position: relative;
}

.search-input-wrap input {
  width: 100%;
  padding: 10px 38px 10px 36px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  background: var(--surface2);
  color: var(--text);
  font-size: .9rem;
  outline: none;
  transition: border-color .15s;
}

.search-input-wrap input:focus { border-color: var(--accent); }

.search-icon {
  position: absolute;
  left: 28px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}

.search-spinner {
  position: absolute;
  right: 28px;
  top: 50%;
  transform: translateY(-50%);
}

.spinner {
  width: 16px;
  height: 16px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .6s linear infinite;
}

.spinner.hidden { display: none; }

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

#search-results {
  flex: 1;
  overflow-y: auto;
}

.search-placeholder {
  padding: 40px 20px;
  text-align: center;
  color: var(--text-muted);
  font-size: .9rem;
}

.search-placeholder .icon { font-size: 2rem; margin-bottom: 8px; }

.result-item {
  display: flex;
  align-items: center;
  padding: 12px 16px;
  gap: 12px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background .1s;
}

.result-item:hover { background: var(--surface2); }

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

.result-name {
  font-size: .875rem;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.result-brand {
  font-size: .75rem;
  color: var(--text-muted);
}

.result-macros {
  font-size: .72rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.result-cal {
  font-size: .85rem;
  font-weight: 700;
  color: var(--text-muted);
  white-space: nowrap;
}

.load-more-btn {
  display: block;
  width: 100%;
  padding: 14px;
  border: none;
  background: transparent;
  color: var(--accent);
  font-size: .85rem;
  font-weight: 600;
  border-top: 1px solid var(--border);
  transition: background .15s;
}

.load-more-btn:hover { background: var(--accent-lt); }

/* Serving step */
.serving-back {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.btn-back {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 6px 10px;
  border: 1px solid var(--border);
  background: var(--surface2);
  border-radius: 6px;
  font-size: .8rem;
  color: var(--text-muted);
  transition: background .15s;
}
.btn-back:hover { background: var(--border); }

.serving-food-name {
  flex: 1;
  font-size: .875rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.serving-form {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.form-group label {
  font-size: .75rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .05em;
}

.form-group input {
  padding: 9px 12px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  background: var(--surface2);
  color: var(--text);
  font-size: .9rem;
  outline: none;
  transition: border-color .15s;
}

.form-group input:focus { border-color: var(--accent); }

.total-display {
  font-size: .78rem;
  color: var(--text-muted);
  text-align: center;
}

/* Nutrient preview in serving editor */
.nutrient-preview {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
}

.preview-title {
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-muted);
  margin-bottom: 10px;
}

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

.preview-item {
  text-align: center;
}

.preview-value {
  font-size: 1.1rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.preview-label {
  font-size: .65rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .05em;
  margin-top: 2px;
}

.preview-unit {
  font-size: .65rem;
  color: var(--text-muted);
}

.btn-add-confirm {
  padding: 13px;
  border: none;
  background: var(--accent);
  color: #fff;
  border-radius: var(--radius);
  font-size: .95rem;
  font-weight: 700;
  width: 100%;
  transition: opacity .15s, transform .1s;
}

.btn-add-confirm:hover  { opacity: .9; }
.btn-add-confirm:active { transform: scale(.98); }

/* ── Bottom Nav ─────────────────────────────────────────────────── */
#bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--surface);
  border-top: 1px solid var(--border);
  display: flex;
  z-index: 10;
}

.nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 10px;
  color: var(--text-muted);
  font-size: .65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
  transition: color .15s;
  min-height: 56px;
}

.nav-item.active { color: var(--accent); }
.nav-item:hover  { color: var(--text); }

.nav-item svg { width: 20px; height: 20px; }

/* ── Settings page ──────────────────────────────────────────────── */
.settings-section {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 20px;
  margin-bottom: 12px;
}

.settings-section h2 {
  font-size: .8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--text-muted);
  margin-bottom: 14px;
}

.settings-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}

.settings-row:last-child { border-bottom: none; }

.settings-label {
  flex: 1;
}

.settings-label span {
  font-size: .875rem;
  font-weight: 500;
  display: block;
}

.settings-label small {
  font-size: .75rem;
  color: var(--text-muted);
}

.settings-input {
  padding: 7px 10px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  background: var(--surface2);
  color: var(--text);
  font-size: .875rem;
  width: 200px;
  outline: none;
}

.settings-input:focus { border-color: var(--accent); }

.btn-primary {
  padding: 10px 20px;
  border: none;
  background: var(--accent);
  color: #fff;
  border-radius: 8px;
  font-size: .875rem;
  font-weight: 600;
  transition: opacity .15s;
}

.btn-primary:hover { opacity: .85; }

.btn-ghost {
  padding: 10px 20px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  border-radius: 8px;
  font-size: .875rem;
  font-weight: 600;
  transition: background .15s;
}

.btn-ghost:hover { background: var(--surface2); }

/* Goals page */
.goals-group {
  margin-bottom: 12px;
}

.goals-group-title {
  font-size: .75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--text-muted);
  padding: 0 16px;
  margin-bottom: 6px;
}

.goal-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
}

.goal-row:last-child { border-bottom: none; }

.goal-name {
  flex: 1;
  font-size: .875rem;
  font-weight: 500;
}

.goal-input-wrap {
  display: flex;
  align-items: center;
  gap: 5px;
}

.goal-input {
  width: 80px;
  padding: 6px 8px;
  border: 1.5px solid var(--border);
  border-radius: 6px;
  background: var(--surface2);
  color: var(--text);
  font-size: .875rem;
  text-align: right;
  outline: none;
}

.goal-input:focus { border-color: var(--accent); }

.goal-unit {
  font-size: .78rem;
  color: var(--text-muted);
  width: 32px;
}

/* ── Utility ────────────────────────────────────────────────────── */
.hidden { display: none !important; }

.text-muted { color: var(--text-muted); }

.error-msg {
  padding: 12px 16px;
  background: #fee2e2;
  color: #991b1b;
  border-radius: var(--radius);
  font-size: .85rem;
  margin: 12px 0;
}

@media (prefers-color-scheme: dark) {
  .error-msg { background: #450a0a; color: #fca5a5; }
}

.success-toast {
  position: fixed;
  bottom: 72px;
  left: 50%;
  transform: translateX(-50%);
  background: #18181b;
  color: #fff;
  padding: 10px 18px;
  border-radius: 8px;
  font-size: .85rem;
  font-weight: 500;
  z-index: 200;
  animation: toastIn .2s ease, toastOut .3s ease 1.7s forwards;
}

@keyframes toastIn  { from { opacity: 0; transform: translateX(-50%) translateY(10px); } to { opacity: 1; transform: translateX(-50%) translateY(0); } }
@keyframes toastOut { to   { opacity: 0; } }

/* ── Barcode Scanner ────────────────────────────────────────────── */
.scan-viewport {
  flex: 1;
  position: relative;
  background: #000;
  overflow: hidden;
  min-height: 240px;
  display: flex;
  align-items: center;
  justify-content: center;
}

#scan-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.scan-frame {
  position: absolute;
  width: 65%;
  max-width: 260px;
  aspect-ratio: 2/1;
  border: 2px solid rgba(255,255,255,.85);
  border-radius: 8px;
  box-shadow: 0 0 0 9999px rgba(0,0,0,.45);
  overflow: hidden;
}

.scan-line {
  position: absolute;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  animation: scanLine 1.8s ease-in-out infinite;
}

@keyframes scanLine {
  0%   { top: 8%; }
  50%  { top: 88%; }
  100% { top: 8%; }
}

.scan-footer {
  padding: 14px 16px;
  background: var(--surface);
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

.scan-status {
  font-size: .82rem;
  color: var(--text-muted);
  text-align: center;
  margin-bottom: 10px;
  min-height: 1.2em;
}

.scan-manual {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
}

.scan-manual input {
  flex: 1;
  padding: 9px 12px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  background: var(--surface2);
  color: var(--text);
  font-size: .875rem;
  outline: none;
  transition: border-color .15s;
}

.scan-manual input:focus { border-color: var(--accent); }

.scan-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
  align-items: center;
}

.btn-scan-file {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border: 1px solid var(--border);
  background: var(--surface2);
  border-radius: 8px;
  font-size: .8rem;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  transition: background .15s;
}
.btn-scan-file:hover { background: var(--border); }
#scan-file-input { display: none; }

/* ── Search: My Foods section headers ──────────────────────────── */
.results-section-header {
  font-size: .68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--text-muted);
  padding: 8px 16px 5px;
  background: var(--surface2);
  border-bottom: 1px solid var(--border);
  border-top: 1px solid var(--border);
}

/* Custom food badge and delete button in search results */
.badge-my-food {
  display: inline-block;
  padding: 1px 6px;
  background: var(--accent-lt);
  color: var(--accent);
  border-radius: 99px;
  font-size: .6rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  margin-left: 6px;
  vertical-align: middle;
}

.result-item-custom { background: var(--surface2); }
.result-item-custom:hover { background: var(--border); }

.result-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  flex-shrink: 0;
}

.btn-result-delete {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  border-radius: 4px;
  transition: background .15s, color .15s;
}
.btn-result-delete:hover { background: #fee2e2; color: var(--danger); }

/* ── Search: Create Custom Food footer ─────────────────────────── */
.search-custom-footer {
  flex-shrink: 0;
  padding: 10px 16px;
  border-top: 1px solid var(--border);
  background: var(--surface);
}

.btn-create-food {
  display: flex;
  align-items: center;
  gap: 7px;
  width: 100%;
  padding: 9px 14px;
  border: 1.5px dashed var(--border);
  background: transparent;
  border-radius: 8px;
  color: var(--accent);
  font-size: .82rem;
  font-weight: 600;
  justify-content: center;
  transition: border-color .15s, background .15s;
}
.btn-create-food:hover { border-color: var(--accent); background: var(--accent-lt); }

/* ── Label scan button (serving step) ──────────────────────────── */
.label-scan-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.btn-label-scan {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  border: 1px solid var(--border);
  background: var(--surface2);
  border-radius: 8px;
  font-size: .78rem;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  transition: background .15s, border-color .15s, color .15s;
  white-space: nowrap;
}
.btn-label-scan:hover { background: var(--accent-lt); border-color: var(--accent); color: var(--accent); }

.label-scan-status {
  font-size: .78rem;
  color: var(--text-muted);
  flex: 1;
}

.btn-save-label-food {
  display: inline;
  border: none;
  background: none;
  color: var(--accent);
  font-size: .78rem;
  font-weight: 600;
  cursor: pointer;
  padding: 0;
  text-decoration: underline;
}

/* ── Create Custom Food step ───────────────────────────────────── */
.create-form {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  overflow-y: auto;
  flex: 1;
}

.btn-label-scan-lg {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 12px;
  border: 1.5px dashed var(--accent);
  background: var(--accent-lt);
  border-radius: var(--radius);
  font-size: .85rem;
  font-weight: 600;
  color: var(--accent);
  cursor: pointer;
  transition: opacity .15s;
}
.btn-label-scan-lg:hover { opacity: .8; }

.create-nutrients-header {
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--text-muted);
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}

.create-nutrient-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
