:root {
  --bg: #f4f6f3;
  --surface: #ffffff;
  --ink: #1a2420;
  --muted: #5c6b64;
  --accent: #2d6a4f;
  --accent-2: #40916c;
  --danger: #9b2226;
  --border: #d8e0db;
  --radius: 12px;
  --nav-h: 64px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  font-family: "Avenir Next", "Segoe UI", system-ui, sans-serif;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: linear-gradient(165deg, #e8f0ea 0%, var(--bg) 40%, #eef2f0 100%);
  color: var(--ink);
  min-height: 100dvh;
  padding-bottom: calc(var(--nav-h) + var(--safe-bottom) + 12px);
}
a { color: var(--accent); text-decoration: none; }

/* Shell chrome lives in app.css — keep nutrition-specific surfaces only. */

h1 { font-size: 1.4rem; margin: 0 0 8px; }
h2 { font-size: 1.05rem; margin: 0; }
.sub, .tz, .hint, .empty, .meta { color: var(--muted); font-size: 0.9rem; }
.flag { color: #b08900; font-size: 0.85rem; }

.totals {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 16px;
  border: 1px solid var(--border);
}
.kcal { display: flex; align-items: baseline; gap: 6px; }
.kcal .num { font-size: 2.4rem; font-weight: 700; letter-spacing: -0.02em; }
.kcal .unit { color: var(--muted); }
.macros {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-top: 12px;
  font-size: 0.95rem;
}
.macros span { color: var(--muted); font-size: 0.75rem; display: block; }

.meal {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 12px 14px;
  margin-bottom: 12px;
  border: 1px solid var(--border);
}
.meal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.entries, .results, .recipe-list, .history-list, .ing-list { list-style: none; margin: 0; padding: 0; }
.entries li {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
  padding: 10px 0;
  border-top: 1px solid var(--border);
}
.entry-main { display: flex; flex-direction: column; gap: 2px; }

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  margin: 14px 0;
}
label { display: block; font-size: 0.85rem; color: var(--muted); margin: 10px 0 4px; }
input, select, textarea, button {
  font: inherit;
  width: 100%;
  padding: 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--ink);
}
button, .btn-primary, .btn-small, .btn-danger {
  cursor: pointer;
  border: none;
  font-weight: 600;
}
.btn-primary, button.btn-primary {
  background: var(--accent);
  color: #fff;
  margin-top: 12px;
  padding: 12px;
  border-radius: 10px;
  display: inline-block;
  text-align: center;
  width: auto;
}
.btn-small {
  background: var(--accent-2);
  color: #fff;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  padding: 0;
}
.btn-danger {
  background: transparent;
  color: var(--danger);
  border: 1px solid #f0c4c4;
  width: auto;
  padding: 6px 10px;
  font-size: 0.8rem;
  border-radius: 8px;
}
.results li, .recipe-list li, .history-list li {
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.results li button {
  text-align: left;
  background: transparent;
  border: none;
  padding: 0;
  color: var(--ink);
}
.row-between { display: flex; justify-content: space-between; align-items: center; }
.actions { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin-top: 16px; }
.ing-list li { display: flex; justify-content: space-between; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--border); }
.range-form { display: flex; flex-wrap: wrap; gap: 8px; align-items: end; margin-bottom: 12px; }
.range-form label { margin: 0; }
.range-form input { width: auto; }
.range-form button { width: auto; background: var(--accent); color: #fff; }

.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100dvh;
  padding: 24px;
}
.login-box {
  width: 100%;
  max-width: 360px;
  background: var(--surface);
  padding: 28px 24px;
  border-radius: 16px;
  border: 1px solid var(--border);
  box-shadow: 0 12px 40px rgba(26, 36, 32, 0.08);
}
.login-box h1 { margin-bottom: 4px; }
.error { color: var(--danger); }
.day-picker input { width: auto; }
.day-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
