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

body {
  font-family: system-ui, sans-serif;
  font-size: 15px;
  background: #f7f7f5;
  color: #1a1a1a;
  max-width: 820px;
  margin: 0 auto;
  padding: 1rem;
}

nav {
  display: flex;
  gap: 1rem;
  padding: 0.5rem 0 1.25rem;
  border-bottom: 1px solid #ddd;
  margin-bottom: 1.5rem;
}

nav a { color: #555; text-decoration: none; font-weight: 500; }
nav a:hover { color: #000; }

h2 { font-size: 1.2rem; font-weight: 600; }
h3 { font-size: 1rem; font-weight: 600; margin: 1.5rem 0 0.6rem; }

/* ── Meal sections ── */
.meal-section {
  margin-bottom: 1.5rem;
  border: 1px solid #e8e8e4;
  border-radius: 6px;
}

.meal-header {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
  padding: 0.5rem 0.75rem;
  background: #f0f0ec;
  border-bottom: 1px solid #e8e8e4;
  border-radius: 6px 6px 0 0;
}

.meal-name {
  font-weight: 600;
  font-size: 0.95rem;
}

.meal-summary {
  font-size: 0.8rem;
  color: #666;
}

.meal-add {
  padding: 0.5rem 0.6rem;
  background: #fafaf8;
  border-top: 1px solid #eee;
  border-radius: 0 0 6px 6px;
}

.meal-section table {
  margin: 0;
  border-radius: 0;
}

.meal-section table th,
.meal-section table td {
  padding: 0.35rem 0.5rem;
}

.meal-section table th { background: #f7f7f5; }

.day-total {
  font-size: 0.9rem;
  color: #444;
  padding: 0.5rem 0;
  border-top: 2px solid #ccc;
  margin-top: 0.5rem;
}
.goal-row { margin-bottom: 0.3rem; }
.goal-bar {
  height: 6px;
  background: #e8e8e4;
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 0.4rem;
}
.goal-bar-fill {
  height: 100%;
  background: #4a9a4a;
  border-radius: 3px;
  transition: width 0.3s;
}
.goal-macros {
  display: flex;
  gap: 1rem;
  font-size: 0.85rem;
  color: #555;
}
.over-goal { color: #c00; font-weight: 600; }

/* ── Dashboard ── */
.dash-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 1rem;
}
.dash-full { grid-column: 1 / -1; }

.dash-card {
  border: 1px solid #e8e8e4;
  border-radius: 6px;
  padding: 0.75rem 1rem 1rem;
  background: #fff;
}
.dash-card h3 { margin-top: 0; margin-bottom: 0.6rem; }

.pie-wrap { display: flex; justify-content: center; margin-bottom: 0.6rem; }
.pie-legend { font-size: 0.82rem; line-height: 1.8; }
.legend-dot {
  display: inline-block;
  width: 10px; height: 10px;
  border-radius: 50%;
  margin-right: 5px;
  vertical-align: middle;
}

.today-stat { display: flex; align-items: baseline; gap: 0.4rem; margin-bottom: 0.1rem; }
.today-kcal { font-size: 2rem; font-weight: 700; line-height: 1; }
.today-goal { color: #888; font-size: 0.9rem; }

.macro-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.82rem;
}
.macro-label { width: 90px; color: #555; }
.macro-val   { width: 80px; text-align: right; color: #444; }

.mini-bar-wrap {
  flex: 1;
  height: 6px;
  background: #eee;
  border-radius: 3px;
  overflow: hidden;
}
.mini-bar-fill {
  height: 100%;
  background: #4a9a4a;
  border-radius: 3px;
}
.mini-bar-fill.over { background: #c00; }

.today-row td { font-weight: 600; background: #fafaf8; }
a.date-link { color: #1a1a1a; text-decoration: none; }
a.date-link:hover { text-decoration: underline; }

@media (max-width: 600px) {
  .dash-grid { grid-template-columns: 1fr; }
}

/* ── Profile form ── */
.profile-form { max-width: 480px; }
.macro-inputs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: flex-end;
  margin-bottom: 0.75rem;
}
.macro-inputs label {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 0.85rem;
  color: #555;
  font-weight: 500;
}
.macro-inputs input { width: 70px; }
.macro-sum-display { font-size: 0.85rem; color: #555; align-self: flex-end; padding-bottom: 0.4rem; }
.sum-warning { color: #c00; font-size: 0.8rem; margin-left: 0.4rem; }
.macro-preview {
  display: flex;
  gap: 1rem;
  font-size: 0.82rem;
  color: #666;
  background: #f0f0ec;
  padding: 0.4rem 0.75rem;
  border-radius: 4px;
  margin-top: 0.25rem;
}

/* ── Date nav ── */
.date-nav {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.25rem;
}
.date-nav a { font-size: 1.2rem; color: #555; text-decoration: none; }
.date-nav a:hover { color: #000; }
.arrow-placeholder { display: inline-block; width: 1.2rem; }

.today-badge {
  font-size: 0.7rem;
  font-weight: 500;
  background: #e0f0e0;
  color: #2a6a2a;
  padding: 1px 6px;
  border-radius: 10px;
  vertical-align: middle;
}

/* ── Tables ── */
table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }

th {
  text-align: left;
  font-weight: 600;
  padding: 0.4rem 0.5rem;
  border-bottom: 2px solid #ccc;
  color: #555;
}

td { padding: 0.4rem 0.5rem; border-bottom: 1px solid #eee; }
tr:last-child td { border-bottom: none; }

tfoot tr.totals td {
  font-weight: 600;
  border-top: 2px solid #ccc;
  border-bottom: none;
  padding-top: 0.5rem;
}

/* Composition rows in log */
tr.comp-header td {
  background: #f0f0ec;
  border-top: 1px solid #ddd;
  padding-top: 0.5rem;
}
tr.comp-item td { color: #444; }
td.indent { padding-left: 1.5rem; }
td.indent::before { content: "↳ "; color: #aaa; }

table.compact th,
table.compact td { padding: 0.3rem 0.5rem; }

/* ── Buttons ── */
button[type="submit"] {
  padding: 0.4rem 1rem;
  background: #1a1a1a;
  color: #fff;
  border: none;
  border-radius: 4px;
  font-size: 0.9rem;
  cursor: pointer;
}
button[type="submit"]:hover { background: #333; }

.btn-delete {
  background: none;
  border: none;
  color: #bbb;
  font-size: 1.1rem;
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
}
.btn-delete:hover { color: #c00; }

.btn-delete-inline {
  background: none;
  border: none;
  color: #bbb;
  font-size: 0.9rem;
  cursor: pointer;
  padding: 0 3px;
  line-height: 1;
  vertical-align: middle;
}
.btn-delete-inline:hover { color: #c00; }

.btn-delete-text {
  background: none;
  border: none;
  color: #c00;
  font-size: 0.85rem;
  cursor: pointer;
  padding: 0;
  text-decoration: underline;
}
.btn-delete-text:hover { color: #900; }

/* ── Composition buttons on log page ── */
.comp-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.25rem;
}
.btn-comp {
  display: inline-block;
  padding: 0.35rem 0.85rem;
  background: #fff;
  border: 1px solid #ccc;
  border-radius: 20px;
  font-size: 0.9rem;
  color: #333;
  text-decoration: none;
}
.btn-comp:hover { background: #f0f0ec; border-color: #999; }

/* ── Forms ── */
.add-entry-form {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.25rem;
}

.add-food-form {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  max-width: 500px;
}

.form-row {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  align-items: flex-end;
}

.form-row.macros label {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 0.8rem;
  color: #555;
  font-weight: 500;
}
.form-row.macros input { width: 80px; }

.form-row label {
  display: inline-flex;
  flex-direction: column;
  gap: 2px;
  font-size: 0.8rem;
  color: #555;
  font-weight: 500;
}

input[type="text"],
input[type="number"],
select {
  padding: 0.4rem 0.6rem;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-size: 0.9rem;
  background: #fff;
}
input[type="text"]:focus,
input[type="number"]:focus,
select:focus { outline: none; border-color: #888; }

input[name="name"] { min-width: 180px; }

/* ── Ingredient / suggestion lists ── */
.ingredient-list,
.suggestion-list {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-bottom: 0.5rem;
}

.ingredient-row,
.suggestion-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.ing-name { min-width: 140px; font-size: 0.9rem; }

.sug-inputs {
  display: none;
  align-items: center;
  gap: 0.4rem;
}

.form-actions {
  margin-top: 1.25rem;
  display: flex;
  align-items: center;
  gap: 1rem;
}
.form-actions a { color: #555; font-size: 0.9rem; }

/* ── Composition list ── */
.comp-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-bottom: 0.5rem;
}
.comp-list li { display: flex; align-items: center; gap: 0.75rem; }
.comp-list a { font-weight: 500; color: #1a1a1a; text-decoration: none; }
.comp-list a:hover { text-decoration: underline; }

/* ── Tag list (suggestions) ── */
.tag-list {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 0.5rem;
}
.tag-list li {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  background: #eee;
  padding: 2px 8px 2px 10px;
  border-radius: 12px;
  font-size: 0.85rem;
}

/* ── Page header with delete ── */
.page-header {
  display: flex;
  align-items: baseline;
  gap: 1rem;
  margin-bottom: 0.5rem;
}

/* ── Food picker (autocomplete) ── */
.food-picker { position: relative; }
.food-text { min-width: 200px; }
.food-text.input-error { border-color: #c00; }

.food-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 2px);
  left: 0;
  z-index: 200;
  background: #fff;
  border: 1px solid #ccc;
  border-radius: 4px;
  list-style: none;
  min-width: 240px;
  max-height: 240px;
  overflow-y: auto;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}
.food-dropdown li {
  padding: 0.4rem 0.75rem;
  font-size: 0.9rem;
  cursor: pointer;
  border-bottom: 1px solid #f0f0ec;
}
.food-dropdown li:last-child { border-bottom: none; }
.food-dropdown li:hover,
.food-dropdown li.active { background: #f0f0ec; }
.food-dropdown li.dropdown-header {
  font-size: 0.7rem;
  font-weight: 600;
  color: #aaa;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.35rem 0.75rem 0.2rem;
  cursor: default;
  background: #fafaf8;
}
.food-dropdown li.dropdown-header:hover { background: #fafaf8; }

/* ── Inline quantity edit in log table ── */
.inline-qty-form {
  display: flex;
  align-items: center;
  gap: 2px;
}
.inline-qty-form input {
  width: 52px;
  padding: 0.15rem 0.3rem;
  font-size: 0.9rem;
  border: 1px solid transparent;
  border-radius: 3px;
  background: transparent;
  text-align: right;
}
.inline-qty-form select {
  padding: 0.15rem 0.2rem;
  font-size: 0.8rem;
  border: 1px solid transparent;
  border-radius: 3px;
  background: transparent;
  color: #666;
}
.inline-qty-form input:hover,
.inline-qty-form select:hover { border-color: #ccc; background: #fff; }
.inline-qty-form input:focus,
.inline-qty-form select:focus { border-color: #888; background: #fff; outline: none; }

/* ── Size pills on log form ── */
.size-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.4rem;
}
.btn-size-pill {
  padding: 0.3rem 0.75rem;
  background: #fff;
  border: 1px solid #ccc;
  border-radius: 16px;
  font-size: 0.85rem;
  color: #333;
  cursor: pointer;
}
.btn-size-pill:hover { background: #f0f0ec; border-color: #999; }

/* ── Food name link in table ── */
a.food-link { color: #1a1a1a; text-decoration: none; }
a.food-link:hover { text-decoration: underline; }

/* ── Food detail info table ── */
table.info-table { max-width: 320px; }
table.info-table th { color: #555; font-weight: 500; width: 140px; }

.back-link { font-size: 0.85rem; color: #555; text-decoration: none; }
.back-link:hover { color: #000; }

/* ── Inline default qty form in foods table ── */
.inline-default-form input {
  width: 60px;
  padding: 0.2rem 0.4rem;
  font-size: 0.85rem;
  border: 1px solid transparent;
  border-radius: 3px;
  background: transparent;
  text-align: right;
}
.inline-default-form input:hover { border-color: #ccc; background: #fff; }
.inline-default-form input:focus { border-color: #888; background: #fff; outline: none; }

/* ── Livsmedelsverket search ── */
.slv-search { max-width: 480px; margin-bottom: 0.5rem; }
.slv-search input[type="text"] { width: 100%; margin-bottom: 0.4rem; }

.slv-result-list {
  list-style: none;
  border: 1px solid #ddd;
  border-radius: 4px;
  background: #fff;
  max-height: 280px;
  overflow-y: auto;
}
.slv-result-list:empty { display: none; }

.slv-result-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.4rem 0.6rem;
  border-bottom: 1px solid #eee;
  font-size: 0.9rem;
}
.slv-result-list li:last-child { border-bottom: none; }
.slv-result-list li span { flex: 1; }
.slv-result-list li button {
  padding: 0.25rem 0.6rem;
  font-size: 0.8rem;
  background: #f0f0ec;
  color: #333;
  border: 1px solid #ccc;
  border-radius: 3px;
  cursor: pointer;
  white-space: nowrap;
}
.slv-result-list li button:hover { background: #e0e0da; }

/* ── Quick add ── */
.quick-add-toggle {
  display: inline-block;
  font-size: 0.82rem;
  margin-top: 0.4rem;
}

.quick-add-form {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.4rem;
  margin-top: 0.4rem;
  padding-top: 0.4rem;
  border-top: 1px dashed #ddd;
}

.quick-add-form input[name="food_name"] { min-width: 140px; }

.quick-add-macros {
  display: flex;
  gap: 0.4rem;
}

.quick-add-macros label {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 0.75rem;
  color: #555;
  font-weight: 500;
}

.quick-add-macros input { width: 64px; }

tr.quick-add-row td:first-child { font-style: italic; }

/* ── Active calories card ── */
.active-cal-card {
  border: 1px solid #e8e8e4;
  border-radius: 6px;
  padding: 0.5rem 0.75rem;
  margin-bottom: 1rem;
  background: #fafaf8;
}
.active-cal-form {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.active-cal-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: #555;
}
.active-cal-form input {
  width: 80px;
  padding: 0.3rem 0.5rem;
  font-size: 0.9rem;
  border: 1px solid #ccc;
  border-radius: 4px;
  background: #fff;
  text-align: right;
}
.active-cal-form input:focus { border-color: #888; outline: none; }
.active-cal-unit { font-size: 0.85rem; color: #666; }
.active-cal-hint { font-size: 0.78rem; color: #888; margin-left: auto; }

/* ── Food search + pagination ── */
.food-search-form {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  margin-bottom: 1rem;
}
.food-search-form input { flex: 1; }

.pagination {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-top: 1rem;
  font-size: 0.9rem;
}
.pagination a {
  color: #1a1a1a;
  text-decoration: none;
  font-weight: 500;
}
.pagination a:hover { text-decoration: underline; }

/* ── Scan page ── */
.scan-form { max-width: 500px; }
.scan-field { margin-bottom: 1rem; }
.scan-label { font-weight: 600; font-size: 0.9rem; display: block; margin-bottom: 0.3rem; }
.scan-upload-label input[type="file"] { display: none; }
.scan-preview-wrap { margin: 0.5rem 0; }
.scan-preview { max-width: 100%; max-height: 300px; border-radius: 6px; border: 1px solid #e8e8e4; }
.scan-submit-btn { width: 100%; }

/* ── Review page ── */
.review-card {
  display: flex;
  gap: 1rem;
  border: 1px solid #e8e8e4;
  border-radius: 6px;
  padding: 1rem;
  margin-bottom: 1rem;
  background: #fff;
}
.review-photos { flex: 0 0 240px; display: flex; flex-direction: column; gap: 0.75rem; }
.review-photo img { width: 100%; border-radius: 4px; }
.review-photo-label { font-size: 0.75rem; font-weight: 600; color: #888; text-transform: uppercase; letter-spacing: 0.03em; display: block; margin-bottom: 0.2rem; }
.review-photo-ean img { max-height: 120px; width: auto; }
.review-data { flex: 1; }
.review-fields {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0.5rem 0;
}
.review-fields label {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 0.8rem;
  color: #555;
  font-weight: 500;
}
.review-fields input { width: 100%; }
.review-fields label:first-child { flex: 2; }
.review-macros label { flex: 1; min-width: 0; }
.review-actions { margin-top: 0.75rem; display: flex; gap: 0.75rem; align-items: center; }
.review-reject-form { margin-top: 0.5rem; }

@media (max-width: 600px) {
  .review-card { flex-direction: column; }
  .review-photos { flex: none; flex-direction: row; gap: 0.5rem; }
  .review-photos .review-photo { flex: 1; }
  .review-photo-ean { flex: 0 0 auto !important; }
  .review-photo-ean img { max-height: 80px; }
}

/* ── Misc ── */
.add-section { margin-top: 1.5rem; }
.muted { color: #999; font-size: 0.85rem; }
.empty { color: #888; font-style: italic; margin: 0.4rem 0 0.8rem; }
.hint { font-size: 0.78rem; color: #888; margin-top: 0.25rem; }
.hint-inline { font-size: 0.75rem; color: #999; font-weight: 400; }
.freq-hint { font-size: 0.75rem; color: #aaa; }


/* ── Flash messages ── */
.flash { padding: 0.6rem 1rem; margin-bottom: 1rem; border-radius: 4px; font-size: 0.9rem; }
.flash-success { background: #e6f4ea; color: #2d6a3f; border: 1px solid #b7dfbf; }
.flash-error   { background: #fdecea; color: #8b1a1a; border: 1px solid #f5c6cb; }

/* ── Import / Export page ── */
.io-section { margin-bottom: 2rem; }
.io-section h3 { margin-bottom: 0.25rem; }
.io-section p  { margin: 0.1rem 0 0.5rem; }
.warning { color: #a0521a; }
.btn {
  display: inline-block;
  padding: 0.4rem 0.9rem;
  background: #f0f0ec;
  border: 1px solid #ccc;
  border-radius: 4px;
  color: #333;
  text-decoration: none;
  font-size: 0.9rem;
  cursor: pointer;
}
.btn:hover { background: #e0e0da; }
.btn-danger { background: #fdecea; border-color: #f5c6cb; color: #8b1a1a; }
.btn-danger:hover { background: #f8d7da; }

/* ── Auth ── */
.auth-box { max-width: 360px; margin: 3rem auto; }
.auth-box h2 { margin-bottom: 1.2rem; }
.auth-box label { display: block; margin-bottom: 1rem; font-size: 0.9rem; }
.auth-box input { display: block; width: 100%; margin-top: 0.25rem; padding: 0.45rem 0.6rem; border: 1px solid #ccc; border-radius: 4px; font-size: 1rem; box-sizing: border-box; }
.auth-box button { width: 100%; margin-top: 0.5rem; padding: 0.6rem; }
.nav-user { margin-left: auto; font-size: 0.85rem; color: #666; }
.nav-user a { color: #666; }

/* ── Weight form ── */
.weight-form { display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; }
.weight-form input { padding: 0.4rem 0.6rem; border: 1px solid #ccc; border-radius: 4px; font-size: 0.9rem; }
.weight-form input[type="number"] { width: 90px; }

/* ── Bottom navigation (mobile) ── */
.bottom-nav { display: none; }

@media (max-width: 600px) {
  /* ── Bottom nav ── */
  .bottom-nav {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: #fff;
    border-top: 1px solid #ddd;
    box-shadow: 0 -2px 8px rgba(0,0,0,0.06);
    z-index: 100;
    justify-content: space-around;
    padding: 0 env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
  }

  .bottom-nav a {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 1;
    padding: 0.6rem 0.25rem;
    min-height: 50px;
    font-size: 0.8rem;
    font-weight: 500;
    color: #888;
    text-decoration: none;
  }

  .bottom-nav a.active {
    color: #1a1a1a;
    font-weight: 700;
  }

  /* ── Top nav: hide page links, show only user info ── */
  nav:not(.bottom-nav) {
    gap: 0;
    padding: 0.25rem 0 0.75rem;
    border-bottom: none;
    margin-bottom: 0.75rem;
  }

  nav:not(.bottom-nav) > a { display: none; }

  .nav-user {
    margin-left: 0;
    width: 100%;
    text-align: right;
    font-size: 0.8rem;
  }

  /* ── Body: space for bottom nav ── */
  body { padding-bottom: 4rem; }

  /* ── Hide macro columns on mobile ── */
  .col-macro,
  .col-hide-mobile { display: none !important; }

  /* ── Tap targets: minimum 44px ── */
  button,
  .btn,
  .btn-comp {
    min-height: 44px;
  }

  input[type="text"],
  input[type="number"],
  input[type="date"],
  select {
    min-height: 44px;
    font-size: 16px; /* prevents iOS auto-zoom on focus */
  }

  /* ── Date navigation ── */
  .date-nav a {
    font-size: 1.8rem;
    min-width: 44px;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .date-nav h2 { font-size: 1.1rem; }

  /* ── Log add-entry form: stack food picker, row for qty+unit+btn ── */
  .meal-add { padding: 0.6rem; }

  .add-entry-form {
    gap: 0.4rem;
  }

  .food-picker { width: 100%; }

  .food-text {
    width: 100% !important;
    min-width: unset !important;
  }

  .food-dropdown {
    width: 100%;
    min-width: unset;
    max-height: 50vh;
  }

  .food-dropdown li {
    padding: 0.6rem 0.75rem;
    min-height: 44px;
    display: flex;
    align-items: center;
  }

  .add-entry-form .qty-input {
    flex: 1;
    min-width: 60px;
  }

  .add-entry-form button[type="submit"] {
    padding: 0 1rem;
  }

  /* ── Size pills ── */
  .btn-size-pill {
    min-height: 44px;
    flex: 1;
    text-align: center;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  /* ── Composition buttons on log ── */
  .comp-buttons { margin-top: 0.5rem; }

  .btn-comp {
    flex: 1 1 auto;
    text-align: center;
    padding: 0.5rem 0.75rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  /* ── Delete buttons ── */
  .btn-delete {
    font-size: 1.4rem;
    min-width: 44px;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  /* ── Inline qty form in table ── */
  .inline-qty-form input { width: 48px; min-height: 36px; }
  .inline-qty-form select { min-height: 36px; }

  /* ── Meal header: allow wrap ── */
  .meal-header { flex-wrap: wrap; }
  .meal-summary { width: 100%; font-size: 0.75rem; }

  /* ── Foods page ── */
  .add-food-form { max-width: 100%; }
  .slv-search { max-width: 100%; }

  .form-row.macros input { width: 100%; }
  .form-row.macros label { flex: 1; min-width: 0; }

  input[name="name"] { min-width: unset !important; width: 100%; }

  /* ── Composition detail: ingredient rows ── */
  .ingredient-row { gap: 0.4rem; }
  .ingredient-row input[type="number"],
  .ingredient-row select { min-width: 0; flex: 1; }

  .suggestion-row { gap: 0.4rem; }
  .sug-inputs { gap: 0.3rem; }
  .sug-inputs input,
  .sug-inputs select { flex: 1; min-width: 0; }

  /* ── Profile form ── */
  .profile-form { max-width: 100%; }
  .macro-inputs label { width: 100%; }
  .macro-inputs input { width: 100% !important; }

  /* ── Weight form ── */
  .weight-form {
    flex-direction: column;
    align-items: stretch;
  }
  .weight-form input[type="number"] { width: 100%; }

  /* ── Dashboard grid already goes 1-col ── */

  /* ── Auth box ── */
  .auth-box { margin: 1rem auto; }
  .auth-box input { font-size: 16px; }

  /* ── SLV result list ── */
  .slv-result-list li {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.3rem;
  }
  .slv-result-list li button { width: 100%; min-height: 44px; }

  /* ── Composition list ── */
  .comp-list li { min-height: 44px; }
  .comp-list a { padding: 0.4rem 0; }

  /* ── Log composition page ── */
  .ingredient-row,
  .suggestion-row { flex-wrap: wrap; }

  /* ── Table cells: tighter padding + smaller font on mobile ── */
  th, td { padding: 0.35rem 0.3rem; font-size: 0.8rem; }
  .meal-section table th,
  .meal-section table td { padding: 0.3rem 0.35rem; font-size: 0.8rem; }

  /* ── Log food search: compact input ── */
  .food-text { font-size: 15px !important; min-height: 40px !important; }

  /* ── Active calories card ── */
  .active-cal-hint { margin-left: 0; width: 100%; }

  /* ── Quick add form ── */
  .quick-add-form { flex-direction: column; align-items: stretch; }
  .quick-add-form input[name="food_name"] { width: 100%; min-width: unset; }
  .quick-add-macros { width: 100%; }
  .quick-add-macros label { flex: 1; min-width: 0; }
  .quick-add-macros input { width: 100%; }
  .quick-add-form button[type="submit"] { width: 100%; }

  /* ── Nav user: name left, settings right ── */
  .nav-user {
    display: flex;
    justify-content: space-between;
    align-items: center;
  }
}

/* ── Verification badges ── */
.badge { display: inline-block; padding: 0.2rem 0.6rem; border-radius: 4px; font-size: 0.8rem; font-weight: 600; }
.badge-verified { background: #d4edda; color: #155724; }
.badge-unverified { background: #fff3cd; color: #856404; }
.badge-inline { font-size: 0.65rem; padding: 0.1rem 0.35rem; margin-left: 0.3rem; vertical-align: middle; border-radius: 3px; }
