:root {
  color-scheme: light;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #f7f4ee;
  color: #161616;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  background: linear-gradient(180deg, #101827 0 260px, transparent 260px), #f7f4ee;
}
button, input { font: inherit; }
.app {
  width: min(100%, 520px);
  margin: 0 auto;
  padding: max(18px, env(safe-area-inset-top)) 16px 28px;
}
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: #fff;
}
.eyebrow {
  margin: 0 0 4px;
  color: #c8d0dc;
  font-size: 12px;
  letter-spacing: 0;
  text-transform: uppercase;
}
h1, h2, h3, p { margin: 0; }
h1 { font-size: 30px; line-height: 1.1; }
h2 { font-size: 18px; }
h3 {
  margin-top: 16px;
  color: #374151;
  font-size: 14px;
}
.icon-button {
  width: 44px;
  height: 44px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  font-size: 28px;
  line-height: 1;
}
.summary, .guidance, .panel {
  margin-top: 18px;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 18px 40px rgba(17, 24, 39, 0.12);
}
.summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 22px;
}
.label, .unit {
  display: block;
  color: #6b7280;
  font-size: 13px;
}
#remainingKcal {
  display: inline-block;
  margin-top: 3px;
  font-size: 42px;
  line-height: 1;
}
.ring {
  display: grid;
  width: 92px;
  height: 92px;
  place-items: center;
  border-radius: 50%;
  background: conic-gradient(#2f8f6b var(--progress, 0deg), #e6e1d8 0);
  color: #111827;
  font-weight: 800;
}
.ring::before {
  position: absolute;
  width: 66px;
  height: 66px;
  border-radius: 50%;
  background: #fff;
  content: "";
}
.ring span { position: relative; }
.guidance, .panel { padding: 16px; }
.guidance p {
  margin-top: 10px;
  color: #374151;
  line-height: 1.55;
}
.targets {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 12px;
}
.targets div {
  min-height: 76px;
  border-radius: 8px;
  background: #ffffff;
  padding: 14px;
  box-shadow: 0 8px 22px rgba(17, 24, 39, 0.08);
}
.targets span {
  display: block;
  color: #8a5b22;
  font-size: 12px;
  font-weight: 700;
}
.targets strong {
  display: block;
  margin-top: 9px;
  font-size: 22px;
}
input, select, textarea {
  width: 100%;
  min-height: 44px;
  border: 1px solid #d9d3c8;
  border-radius: 8px;
  background: #fffdf9;
  padding: 10px 12px;
}
textarea {
  min-height: 82px;
  margin-top: 10px;
  resize: vertical;
}
.panel > input { margin-top: 10px; }
.panel > select { margin-top: 10px; }
.grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-top: 10px;
}
.split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 10px;
}
.segmented {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 12px;
}
.segmented label {
  min-height: 44px;
}
.segmented input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.segmented span {
  display: grid;
  min-height: 44px;
  place-items: center;
  border: 1px solid #d9d3c8;
  border-radius: 8px;
  background: #fffdf9;
  color: #374151;
  font-weight: 800;
}
.segmented input:checked + span {
  border-color: #2f8f6b;
  background: #e7f4ee;
  color: #17654b;
}
.remaining-targets {
  margin-top: 10px;
}
.remaining-targets div {
  background: #f8fffb;
}
.food-buttons {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 10px;
}
.food-buttons button {
  min-height: 42px;
  border: 1px solid #d9d3c8;
  border-radius: 8px;
  background: #fffdf9;
  color: #111827;
  font-weight: 800;
}
label {
  color: #6b7280;
  font-size: 12px;
}
label input { margin-top: 5px; }
.primary, .secondary {
  width: 100%;
  min-height: 48px;
  margin-top: 12px;
  border-radius: 8px;
  font-weight: 800;
}
.primary {
  border: 0;
  background: #2f8f6b;
  color: #fff;
}
.secondary {
  border: 1px solid #d9d3c8;
  background: #fffdf9;
  color: #111827;
}
ul, ol {
  display: grid;
  gap: 10px;
  margin: 14px 0 0;
  padding: 0;
  list-style: none;
}
li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 54px;
  border-bottom: 1px solid #eee8de;
  gap: 12px;
}
li:last-child { border-bottom: 0; }
.meal-name { font-weight: 700; }
.meal-meta {
  color: #6b7280;
  font-size: 12px;
}
.delete {
  width: 34px;
  height: 34px;
  border: 1px solid #e5e0d7;
  border-radius: 8px;
  background: #fff;
  color: #8b1e1e;
}
