:root {
  --bg: #f7f9fb;
  --surface: #ffffff;
  --surface-soft: #f0f6ff;
  --ink: #14202b;
  --muted: #697886;
  --line: #e2e9f0;
  --blue: #2f80ed;
  --blue-dark: #1f66c2;
  --green: #2aa36b;
  --amber: #c98225;
  --shadow: 0 10px 28px rgba(28, 48, 68, 0.08);
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--bg);
  color-scheme: light;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  line-height: 1.35;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.app {
  min-height: 100vh;
  max-width: 560px;
  margin: 0 auto;
  padding: 18px 16px 92px;
  background: var(--bg);
}

.screen {
  display: none;
}

.screen.active {
  display: grid;
  gap: 14px;
}

.hero {
  padding: 4px 0 6px;
}

.brand-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

.brand-mark {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  background: #eaf7f0;
}

.brand-mark img {
  width: 30px;
  height: 30px;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 32px;
  line-height: 1.06;
  letter-spacing: 0;
  max-width: 12ch;
}

h2 {
  font-size: 24px;
  line-height: 1.1;
  letter-spacing: 0;
}

.hero p,
.section-head p {
  margin-top: 10px;
  color: var(--muted);
  font-size: 15px;
}

.ghost-button,
.text-button {
  border: 0;
  background: transparent;
  color: var(--blue);
  font-weight: 700;
  padding: 8px 0;
}

.quick-actions {
  display: grid;
  gap: 10px;
}

.camera-action,
.action-card,
.today-card,
.search-panel,
.result-card,
.builder-card,
.total-card,
.profile-card,
.plan-summary,
.shopping-list {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.camera-action,
.action-card {
  min-height: 118px;
  padding: 16px;
  display: grid;
  grid-template-columns: 52px 1fr;
  align-items: center;
  gap: 14px;
  color: var(--ink);
  text-align: left;
}

.camera-action {
  border-color: #d7e8fb;
  background: #ffffff;
}

.camera-action input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.camera-action strong,
.action-card strong {
  display: block;
  font-size: 20px;
  line-height: 1.15;
  grid-column: 2;
}

.camera-action small,
.action-card small {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: 14px;
  grid-column: 2;
}

.camera-icon,
.action-icon {
  width: 52px;
  height: 52px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  grid-row: 1 / 3;
}

.camera-icon {
  background: var(--surface-soft);
  color: var(--blue);
}

.camera-icon svg {
  width: 28px;
  height: 28px;
}

.action-icon {
  background: #eef8f3;
  color: var(--green);
  font-size: 30px;
  line-height: 1;
}

.today-card {
  padding: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  box-shadow: none;
}

.today-card span,
.result-head span,
.total-top span,
.plan-summary span,
.nutrient-rings span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.today-card strong {
  display: block;
  margin-top: 3px;
  font-size: 16px;
}

.search-panel,
.builder-card,
.profile-card,
.total-card {
  padding: 14px;
}

.search-panel label,
.field label {
  display: block;
  margin-bottom: 8px;
  color: #314252;
  font-size: 13px;
  font-weight: 720;
}

.search-box {
  display: grid;
  grid-template-columns: 22px 1fr;
  align-items: center;
  gap: 8px;
  min-height: 46px;
  border: 1px solid #d8e2eb;
  border-radius: var(--radius);
  padding: 0 12px;
  color: var(--muted);
  background: #fbfdff;
}

.search-box svg {
  width: 20px;
  height: 20px;
}

input,
select {
  width: 100%;
  min-width: 0;
  min-height: 44px;
  border: 1px solid #d8e2eb;
  border-radius: var(--radius);
  background: #fbfdff;
  color: var(--ink);
  padding: 10px 11px;
  outline: none;
}

.search-box input {
  border: 0;
  padding: 0;
  min-height: 42px;
}

input:focus,
select:focus,
.search-box:focus-within {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(47, 128, 237, 0.13);
}

.food-results {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.food-result {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #ffffff;
  color: var(--ink);
  padding: 11px 12px;
  text-align: left;
}

.food-result span,
.food-result small {
  display: block;
}

.food-result span {
  font-weight: 700;
}

.food-result small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
}

.food-result strong {
  color: var(--blue);
  white-space: nowrap;
}

.food-preview {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.food-preview img {
  display: block;
  width: 100%;
  max-height: 250px;
  object-fit: cover;
}

.result-card {
  padding: 14px;
}

.result-head,
.section-head,
.total-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.section-head {
  justify-content: flex-start;
}

.result-head strong {
  display: block;
  margin-top: 3px;
  font-size: 20px;
}

.icon-button,
.back-button {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fbfdff;
  color: var(--muted);
  display: grid;
  place-items: center;
  flex: 0 0 auto;
}

.icon-button {
  width: 38px;
  height: 38px;
}

.back-button {
  width: 42px;
  height: 42px;
}

.icon-button svg,
.back-button svg {
  width: 20px;
  height: 20px;
}

.nutrient-rings {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 7px;
  margin-top: 13px;
}

.nutrient-rings div {
  min-height: 70px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fbfdff;
  padding: 10px 8px;
}

.nutrient-rings strong {
  display: block;
  margin-top: 7px;
  font-size: 16px;
}

.soft-note {
  margin-top: 12px;
  color: var(--muted);
  font-size: 14px;
}

.primary {
  width: 100%;
  min-height: 48px;
  margin-top: 13px;
  border: 1px solid var(--blue);
  border-radius: var(--radius);
  background: var(--blue);
  color: #ffffff;
  font-weight: 760;
}

.primary:active {
  background: var(--blue-dark);
}

.ingredient-form {
  display: grid;
  grid-template-columns: 0.9fr 1.3fr 0.8fr;
  gap: 8px;
}

.ingredient-form button {
  grid-column: 1 / -1;
}

.ingredient-list {
  display: grid;
  gap: 8px;
}

.empty-state,
.ingredient-item {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 12px;
}

.empty-state {
  color: var(--muted);
  text-align: center;
}

.ingredient-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.ingredient-item strong,
.ingredient-item span {
  display: block;
}

.ingredient-item span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 13px;
}

.remove-ingredient {
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #ffffff;
  color: var(--muted);
}

.meal-alerts {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.checkline {
  display: grid;
  grid-template-columns: 10px 1fr;
  gap: 9px;
  border-radius: var(--radius);
  padding: 10px;
  font-size: 14px;
}

.checkline span {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-top: 5px;
}

.checkline.ok {
  background: #eef8f3;
  color: #246344;
}

.checkline.ok span {
  background: var(--green);
}

.checkline.warn {
  background: #fff7e8;
  color: #76511d;
}

.checkline.warn span {
  background: var(--amber);
}

.plan-summary {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1px;
  overflow: hidden;
}

.plan-summary div {
  padding: 14px;
  background: var(--surface);
}

.plan-summary strong {
  display: block;
  margin-top: 5px;
  font-size: 22px;
}

.shopping-list {
  overflow: hidden;
  box-shadow: none;
}

.shopping-list div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px;
  border-bottom: 1px solid var(--line);
}

.shopping-list div:last-child {
  border-bottom: 0;
}

.shopping-list span {
  color: var(--muted);
}

.field {
  margin-bottom: 13px;
}

.bottom-nav {
  position: fixed;
  left: 50%;
  bottom: 12px;
  transform: translateX(-50%);
  width: min(528px, calc(100vw - 24px));
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  padding: 6px;
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 14px 34px rgba(30, 45, 60, 0.12);
  backdrop-filter: blur(14px);
}

.nav-item {
  min-height: 50px;
  border: 0;
  border-radius: var(--radius);
  background: transparent;
  color: var(--muted);
  display: grid;
  place-items: center;
  gap: 2px;
  font-size: 12px;
  font-weight: 720;
}

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

.nav-item.active {
  background: var(--surface-soft);
  color: var(--blue);
}

@media (max-width: 420px) {
  .app {
    padding-inline: 14px;
  }

  h1 {
    font-size: 30px;
  }

  .ingredient-form {
    grid-template-columns: 1fr;
  }

  .nutrient-rings {
    grid-template-columns: repeat(2, 1fr);
  }
}
