@import url('https://fonts.googleapis.com/css2?family=Golos+Text:wght@400;500;600;700&display=swap');

:root {
  --bg: #FBF9F5;
  --card: #FFFFFF;
  --ink: #1B1A17;
  --ink-soft: #6B675E;
  --line: #E7E2D8;
  --accent: #2F6B4E;
  --accent-soft: #EAF2ED;
  --warm: #C25E32;
  --warm-soft: #FBEEE7;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(27, 26, 23, .04), 0 8px 24px -16px rgba(27, 26, 23, .22);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: 'Golos Text', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.wrap { max-width: 760px; margin: 0 auto; padding: 0 20px; }
.wrap-wide { max-width: 940px; margin: 0 auto; padding: 0 20px; }

/* ---------- Шапка ---------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 22px 0 0;
}
.logo { font-weight: 700; letter-spacing: -.02em; font-size: 17px; text-decoration: none; color: var(--ink); }
.logo span { color: var(--accent); }
.topbar-note { color: var(--ink-soft); font-size: 14px; }

/* ---------- Hero ---------- */
.hero { padding: 52px 0 34px; }
.hero h1 {
  font-size: clamp(30px, 5.4vw, 46px);
  line-height: 1.08;
  letter-spacing: -.03em;
  margin: 0 0 16px;
  font-weight: 700;
}
.hero p { font-size: 18px; color: var(--ink-soft); margin: 0; max-width: 34em; }
.hero-points { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 22px; }
.pill {
  background: var(--card); border: 1px solid var(--line); border-radius: 100px;
  padding: 7px 14px; font-size: 14px; color: var(--ink-soft);
}

/* ---------- Шаги ---------- */
.progress { display: flex; gap: 6px; margin: 8px 0 26px; }
.progress i {
  height: 4px; flex: 1; background: var(--line); border-radius: 4px;
  transition: background .25s ease;
}
.progress i.on { background: var(--accent); }

.step { display: none; animation: fade .28s ease; }
.step.active { display: block; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.step-kicker { font-size: 13px; letter-spacing: .08em; text-transform: uppercase; color: var(--accent); font-weight: 600; }
.step h2 { font-size: 26px; letter-spacing: -.02em; margin: 8px 0 6px; font-weight: 700; }
.step .sub { color: var(--ink-soft); margin: 0 0 22px; }

.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 20px; box-shadow: var(--shadow); margin-bottom: 16px;
}
.card h3 { margin: 0 0 4px; font-size: 17px; font-weight: 600; }
.card .hint { color: var(--ink-soft); font-size: 14px; margin: 0 0 14px; }

/* ---------- Поля ---------- */
label.field { display: block; margin-bottom: 14px; }
label.field > span { display: block; font-size: 14px; color: var(--ink-soft); margin-bottom: 6px; }

input[type=text], input[type=number], select, textarea {
  width: 100%; padding: 11px 13px; font: inherit; font-size: 15px;
  border: 1px solid var(--line); border-radius: 10px; background: #fff; color: var(--ink);
  transition: border-color .15s ease, box-shadow .15s ease;
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft);
}
textarea { resize: vertical; min-height: 76px; }

.row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.row-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
@media (max-width: 560px) { .row, .row-3 { grid-template-columns: 1fr; } }

/* Кнопки-плитки выбора */
.choices { display: flex; flex-wrap: wrap; gap: 8px; }
.choice {
  border: 1px solid var(--line); background: #fff; border-radius: 10px;
  padding: 10px 15px; font: inherit; font-size: 15px; cursor: pointer; color: var(--ink);
  transition: all .15s ease;
}
.choice:hover { border-color: #CFC8B8; }
.choice.on { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.choice small { display: block; font-size: 12px; color: var(--ink-soft); font-weight: 400; }
.choice.on small { color: var(--accent); }

.switch { display: inline-flex; background: #F1EDE4; border-radius: 10px; padding: 4px; gap: 4px; }
.switch button {
  border: 0; background: transparent; font: inherit; font-size: 14px; padding: 8px 14px;
  border-radius: 8px; cursor: pointer; color: var(--ink-soft);
}
.switch button.on { background: #fff; color: var(--ink); font-weight: 600; box-shadow: var(--shadow); }

/* ---------- Навигация ---------- */
.nav { display: flex; justify-content: space-between; gap: 12px; margin: 24px 0 60px; }
.btn {
  border: 0; border-radius: 11px; padding: 13px 24px; font: inherit; font-size: 16px;
  font-weight: 600; cursor: pointer; transition: transform .1s ease, background .15s ease;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: #27593F; }
.btn-primary:disabled { background: #B4C6BB; cursor: not-allowed; }
.btn-ghost { background: transparent; color: var(--ink-soft); border: 1px solid var(--line); }
.btn-ghost:hover { color: var(--ink); border-color: #CFC8B8; }
.btn-small { padding: 8px 14px; font-size: 14px; border-radius: 9px; }

/* ---------- Едоки ---------- */
.person { position: relative; }
.person .remove {
  position: absolute; top: 14px; right: 14px; border: 0; background: transparent;
  color: var(--ink-soft); cursor: pointer; font-size: 20px; line-height: 1; padding: 4px;
}
.person .remove:hover { color: var(--warm); }
.person-title { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.person-num {
  width: 26px; height: 26px; border-radius: 50%; background: var(--accent-soft); color: var(--accent);
  display: grid; place-items: center; font-size: 13px; font-weight: 700;
}
.norm-note { font-size: 13px; color: var(--accent); background: var(--accent-soft); border-radius: 8px; padding: 8px 11px; margin-top: 6px; }

/* ---------- Загрузка ---------- */
.loading { text-align: center; padding: 80px 20px; }
.spinner {
  width: 34px; height: 34px; border: 3px solid var(--line); border-top-color: var(--accent);
  border-radius: 50%; margin: 0 auto 20px; animation: spin .9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading h2 { font-size: 22px; margin: 0 0 6px; letter-spacing: -.02em; }
.loading p { color: var(--ink-soft); margin: 0; }

/* ---------- Результат ---------- */
.plan-head { padding: 30px 0 8px; }
.plan-head h1 { font-size: clamp(26px, 4.6vw, 36px); letter-spacing: -.03em; margin: 0 0 10px; }
.plan-meta { color: var(--ink-soft); font-size: 15px; }

.summary { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin: 22px 0 8px; }
@media (max-width: 700px) { .summary { grid-template-columns: repeat(2, 1fr); } }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 15px 16px; }
.stat b { display: block; font-size: 24px; letter-spacing: -.02em; font-weight: 700; }
.stat span { font-size: 13px; color: var(--ink-soft); }
.stat.good b { color: var(--accent); }
.stat.over b { color: var(--warm); }

/* ---------- Сравнение магазинов ---------- */
.compare {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px 20px 14px; margin-top: 16px; box-shadow: var(--shadow);
}
.cmp-head { margin-bottom: 14px; }
.cmp-head b { display: block; font-size: 17px; letter-spacing: -.01em; }
.cmp-head span { font-size: 14px; color: var(--ink-soft); }
.cmp-row {
  display: grid; grid-template-columns: 150px 1fr 82px 84px; gap: 12px; align-items: center;
  padding: 7px 0;
}
.cmp-name { font-size: 15px; }
.cmp-name i { display: block; font-style: normal; font-size: 11px; color: var(--ink-soft); }
.cmp-bar { background: #F1EDE4; border-radius: 4px; height: 8px; overflow: hidden; }
.cmp-bar i { display: block; height: 100%; background: #CFC8B8; border-radius: 4px; }
.cmp-sum { font-size: 15px; font-weight: 600; text-align: right; }
.cmp-delta { font-size: 13px; text-align: right; color: var(--ink-soft); }
.cmp-delta.up { color: var(--warm); }
.cmp-delta.down { color: var(--accent); }
.cmp-row.best .cmp-bar i { background: var(--accent); }
.cmp-row.best .cmp-name { font-weight: 600; color: var(--accent); }
.cmp-row.current { background: var(--bg); border-radius: 8px; padding: 7px 10px; margin: 0 -10px; }
.cmp-row.current .cmp-name { font-weight: 600; }
.cmp-foot { font-size: 13px; color: var(--ink-soft); margin-top: 12px; }
@media (max-width: 620px) {
  .cmp-row { grid-template-columns: 1fr 74px 76px; }
  .cmp-bar { display: none; }
}

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin: 26px 0 22px; }
.tabs button {
  border: 0; background: transparent; font: inherit; font-size: 15px; font-weight: 600;
  padding: 11px 16px; cursor: pointer; color: var(--ink-soft); border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.tabs button.on { color: var(--accent); border-bottom-color: var(--accent); }

.pane { display: none; }
.pane.on { display: block; }

/* Меню */
.day { margin-bottom: 26px; }
.day-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.day-head h3 { margin: 0; font-size: 20px; letter-spacing: -.02em; }
.day-kcal { font-size: 13px; color: var(--ink-soft); }
.meal {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px 18px; margin-bottom: 10px;
}
.meal-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.meal-head { display: flex; align-items: center; gap: 14px; min-width: 0; }
.dish-art { width: 62px; height: 52px; flex: none; border-radius: 10px; }
.dish-photo { width: 62px; height: 52px; flex: none; border-radius: 10px; object-fit: cover; background: var(--line); }
.photo-credit { font-size: 11px; color: var(--ink-soft); margin-top: 10px; }
.photo-credit a { color: var(--ink-soft); }
@media (max-width: 560px) { .dish-art, .dish-photo { width: 50px; height: 42px; } }
.meal-slot { font-size: 12px; letter-spacing: .07em; text-transform: uppercase; color: var(--accent); font-weight: 600; }
.meal h4 { margin: 3px 0 0; font-size: 17px; font-weight: 600; }
.meal-kcal { font-size: 13px; color: var(--ink-soft); white-space: nowrap; }
.meal-toggle {
  margin-top: 10px; border: 0; background: transparent; color: var(--accent); font: inherit;
  font-size: 14px; font-weight: 600; cursor: pointer; padding: 0;
}
.recipe { display: none; margin-top: 14px; padding-top: 14px; border-top: 1px dashed var(--line); }
.recipe.on { display: block; }
.recipe ul { margin: 0 0 12px; padding-left: 18px; }
.recipe ul li { font-size: 15px; margin-bottom: 3px; }
.recipe ol { margin: 0; padding-left: 18px; }
.recipe ol li { font-size: 15px; margin-bottom: 6px; }
.recipe h5 { margin: 0 0 6px; font-size: 13px; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-soft); }
.meal-note { font-size: 14px; color: var(--warm); background: var(--warm-soft); border-radius: 8px; padding: 8px 11px; margin-top: 10px; }

/* Список покупок */
.section-sum { font-size: 14px; color: var(--ink-soft); }
.buy-section { margin-bottom: 22px; }
.buy-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 8px; }
.buy-head h3 { margin: 0; font-size: 17px; letter-spacing: -.01em; }
.buy-list { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.buy-item {
  display: flex; align-items: center; gap: 12px; padding: 12px 16px;
  border-bottom: 1px solid var(--line); cursor: pointer; transition: background .12s ease;
}
.buy-item:last-child { border-bottom: 0; }
.buy-item:hover { background: #FCFBF8; }
.buy-item input { width: 19px; height: 19px; accent-color: var(--accent); cursor: pointer; flex: none; }
.buy-item .name { flex: 1; font-size: 15px; }
.buy-item .amount { font-size: 14px; color: var(--ink-soft); white-space: nowrap; }
.buy-item .cost { font-size: 15px; font-weight: 600; white-space: nowrap; min-width: 62px; text-align: right; }
.buy-item.done .name, .buy-item.done .amount { text-decoration: line-through; opacity: .45; }
.buy-item .leftover { display: block; font-size: 12px; color: var(--warm); }

/* КБЖУ */
.kbju-person { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; margin-bottom: 14px; }
.kbju-person h3 { margin: 0 0 4px; font-size: 17px; }
.kbju-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-top: 12px; }
.kbju-cell { background: var(--bg); border-radius: 10px; padding: 10px 12px; }
.kbju-cell b { display: block; font-size: 19px; letter-spacing: -.02em; }
.kbju-cell span { font-size: 12px; color: var(--ink-soft); }
.bar { height: 5px; background: var(--line); border-radius: 4px; margin-top: 8px; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--accent); border-radius: 4px; }
.bar i.over { background: var(--warm); }

.notice {
  background: var(--warm-soft); border: 1px solid #F0DACB; border-radius: var(--radius);
  padding: 14px 16px; font-size: 15px; margin-bottom: 16px;
}
.notice b { display: block; margin-bottom: 3px; }

.saved-hint {
  background: var(--accent-soft); color: var(--accent); border-radius: 10px;
  padding: 10px 14px; font-size: 14px; margin-top: 20px; display: inline-block;
}
.linkbtn {
  border: 0; background: transparent; color: var(--accent); font: inherit; font-size: 14px;
  text-decoration: underline; cursor: pointer; padding: 0;
}
.foot { padding: 30px 0 60px; color: var(--ink-soft); font-size: 14px; text-align: center; }
.foot a { color: var(--accent); }

@media print {
  .tabs, .nav, .topbar, .meal-toggle, .btn { display: none !important; }
  .pane { display: block !important; }
  body { background: #fff; }
  .card, .meal, .buy-list { box-shadow: none; break-inside: avoid; }
  .recipe { display: block !important; }
}
