:root {
  --bg: #eef1f7;
  --card: rgba(255,255,255,.92);
  --border: #e5e9f2;
  --text: #141a2b;
  --muted: #7a839b;
  --brand: #3b6ef5;
  --brand-2: #6a3bf5;
  --green: #20a464;
  --red: #e5484d;
  --violet: #7c3aed;
  --radius: 18px;
  --shadow: 0 10px 40px rgba(20, 40, 90, .10);
  --glass: rgba(255,255,255,.65);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: "Manrope", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  background:
    radial-gradient(1000px 500px at 90% -5%, rgba(107, 90, 245, .16), transparent 60%),
    radial-gradient(900px 500px at 0% 10%, rgba(59, 110, 245, .14), transparent 55%),
    var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
}

/* ============ HERO ============ */
.hero {
  position: relative;
  min-height: 420px;
  display: flex;
  align-items: flex-start;   /* фиксируем верх: бейдж не «плавает» при разной высоте контента */
  justify-content: center;
  overflow: hidden;
  color: #fff;
}
.hero-bg {
  position: absolute; inset: 0;
  background-size: cover;
  background-position: center;
  transform: scale(1.05);
  animation: kenburns 18s ease-in-out infinite alternate;
}
@keyframes kenburns { from { transform: scale(1) translateY(0);} to { transform: scale(1.12) translateY(-8px);} }
.hero-overlay {
  position: absolute; inset: 0;
  background: linear-gradient(120deg, rgba(16,24,50,.82) 0%, rgba(16,24,50,.55) 45%, rgba(16,24,50,.25) 100%);
}
.hero-inner {
  position: relative; z-index: 2;
  width: 100%;
  max-width: 1080px; margin: 0 auto; padding: 70px 24px 100px;
}
.hero-badge {
  display: inline-block; padding: 7px 16px; border-radius: 999px;
  background: rgba(255,255,255,.16); border: 1px solid rgba(255,255,255,.28);
  backdrop-filter: blur(6px); font-size: 14px; font-weight: 600; margin-bottom: 18px;
  letter-spacing: .3px;
}
.hero h1 { margin: 0; font-size: clamp(34px, 6vw, 58px); font-weight: 800; letter-spacing: -1px; line-height: 1.05; }
.hero h1 em { font-style: normal; background: linear-gradient(90deg, #ffd76a, #ff9d5c); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero p { margin: 16px 0 0; font-size: 17px; color: rgba(255,255,255,.88); max-width: 560px; }
.hero-stats { display: flex; gap: 24px; flex-wrap: wrap; margin-top: 28px; }
.hs { display: flex; align-items: center; gap: 9px; font-size: 14px; color: rgba(255,255,255,.92); }
.hs b { font-size: 20px; }

/* ============ LAYOUT ============ */
main {
  max-width: 1080px; margin: -60px auto 20px; padding: 0 20px 20px; position: relative; z-index: 3;
}
footer { text-align: center; margin: 30px 0 10px; color: var(--muted); font-size: 13px; }

/* ============ CARDS ============ */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 26px;
  margin-bottom: 22px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
}
.card-title { display: flex; align-items: center; gap: 10px; margin-bottom: 18px; }
.card-title h2 { margin: 0; font-size: 22px; letter-spacing: -.4px; }
.card h2 { margin: 0 0 18px; font-size: 22px; letter-spacing: -.4px; }
.form-card { 
  background: var(--glass);
  border: 1px solid rgba(255,255,255,.7);
  box-shadow: 0 20px 60px rgba(20, 40, 90, .18);
}
.form-head { display: flex; align-items: center; gap: 10px; margin-bottom: 18px; }
.form-head h2 { margin: 0; font-size: 22px; letter-spacing: -.4px; }
.f-emoji { font-size: 22px; }
h3 { margin: 18px 0 10px; }
.opt { font-weight: 500; color: var(--muted); font-size: 12px; }
.field-note { margin-top: 8px; padding: 8px 12px; border-radius: 10px; font-size: 13px; font-weight: 600; }
.field-note.error { background: linear-gradient(135deg, #ffe9e9, #ffdfdf); color: #b42318; border: 1px solid #f3c3c3; }

/* ============ EXCLUSIONS ============ */
.exclude-block { margin-top: 18px; }
.exclude-title { font-size: 14px; font-weight: 700; margin-bottom: 10px; }
.chip-list { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid #d5dbe8;
  background: #fff;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all .15s;
}
.chip:hover { border-color: var(--brand); background: #f3f7ff; }
.chip.active {
  background: linear-gradient(135deg, var(--red), #ff7a6b);
  color: #fff;
  border-color: transparent;
  box-shadow: 0 6px 16px rgba(229, 72, 77, .3);
}
.ghost-chip { background: #fff; border: 1px dashed #c0c7d6; color: var(--text); }
.ghost-chip:hover { border-color: var(--brand); color: var(--brand); background: #f6f9ff; }
.exclude-custom { margin-top: 12px; padding: 12px; border: 1px solid var(--border); border-radius: 12px; background: #fafbfd; }
.fit-row { display: flex; gap: 8px; align-items: center; }
.checkbox-row { flex-wrap: wrap; gap: 12px; row-gap: 10px; }
.macro-check {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 16px; border: 1px solid var(--border); border-radius: 999px;
  background: #fff; cursor: pointer; font-weight: 700; font-size: 14px;
  transition: border-color .15s, background .15s;
}
.macro-check:hover { border-color: var(--brand); }
.macro-check:has(input:checked) { border-color: var(--brand); background: linear-gradient(135deg, #eef3ff, #f6f0ff); }
.macro-check input { width: auto; accent-color: var(--brand); }
.fit-row input { flex: 1; }
.exclude-custom .chip-list { margin-top: 10px; }

/* summary top row */
.summary-top { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.summary-top .card-title { margin-bottom: 0; }

/* ============ FORM ============ */
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; align-items: start; }
/* вариант .grid: колонки одинаковой ширины, поля и подписи выровнены по нижнему краю */
.fit-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; align-items: end; margin-top: 18px; }
label { font-size: 14px; color: var(--text); display: flex; flex-direction: column; gap: 7px; font-weight: 600; }
label.checkbox { flex-direction: row; align-items: center; gap: 9px; font-weight: 600; }
label.checkbox input { width: auto; accent-color: var(--brand); }
input, select {
  padding: 12px 14px;
  border: 1px solid #d5dbe8;
  border-radius: 12px;
  font-size: 15px;
  font-family: inherit;
  background: #fff;
  transition: border-color .15s, box-shadow .15s, transform .1s;
  color: var(--text);
}
input:focus, select:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 4px rgba(59, 110, 245, .15);
}

/* ============ BUTTONS ============ */
.actions { margin-top: 20px; display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
button {
  padding: 12px 22px;
  border-radius: 12px;
  border: 1px solid transparent;
  font-size: 15px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  transition: transform .1s, box-shadow .2s, background .2s, filter .2s;
}
button:active { transform: translateY(1px) scale(.99); }
.primary {
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  color: #fff;
  box-shadow: 0 10px 24px rgba(59, 110, 245, .35);
}
.primary:hover { filter: brightness(1.06); box-shadow: 0 14px 30px rgba(59, 110, 245, .4); transform: translateY(-1px); }
.primary:disabled { opacity: .6; box-shadow: none; transform: none; cursor: not-allowed; }
.ghost { background: #fff; border-color: #d5dbe8; color: var(--text); }
.ghost:hover { border-color: var(--brand); color: var(--brand); background: #f6f9ff; }

/* ============ STORES ============ */
.store-list { display: flex; flex-direction: column; gap: 10px; margin-top: 6px; }
.store-item {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 16px 18px; border: 1px solid var(--border); border-radius: 14px;
  cursor: pointer; background: #fff; transition: border-color .15s, transform .1s, box-shadow .2s;
}
.store-item:hover { border-color: var(--brand); transform: translateX(3px); box-shadow: var(--shadow); }
.store-item.selected { border-color: var(--brand); background: linear-gradient(135deg, #eef3ff, #f6f0ff); box-shadow: inset 0 0 0 1.5px var(--brand); }
.store-name { font-weight: 800; font-size: 16px; }
.store-meta { color: var(--muted); font-size: 13px; }
.store-item input[type="checkbox"] {
  flex: 0 0 auto; width: 20px; height: 20px; accent-color: var(--brand); cursor: pointer;
}
.store-item > div { display: flex; flex-direction: column; gap: 2px; text-align: left; }

/* ============ FEEDBACK ============ */
.error {
  background: linear-gradient(135deg, #ffe9e9, #ffdfdf);
  color: #b42318; padding: 14px 16px; border-radius: 12px; margin-top: 16px;
  border: 1px solid #f3c3c3; font-weight: 500;
}
.loading { color: var(--brand); margin-top: 16px; display: flex; align-items: center; gap: 10px; font-weight: 600; }
.loading::before {
  content: ""; width: 18px; height: 18px; border-radius: 50%;
  border: 3px solid var(--border); border-top-color: var(--brand);
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.hidden { display: none !important; }

/* ============ SUMMARY ============ */
.summary { background: linear-gradient(135deg, rgba(255,255,255,.95), rgba(245,248,255,.9)); }
.summary-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; }
.summary-cell {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 14px; padding: 16px;
  box-shadow: 0 4px 14px rgba(20,40,90,.06);
}
.summary-cell .label { font-size: 13px; color: var(--muted); font-weight: 600; }
.summary-cell .value { font-size: 24px; font-weight: 800; margin-top: 5px; letter-spacing: -.5px; }

/* ============ MENU ============ */
.menu-day { margin-bottom: 16px; animation: up .35s ease both; }
@keyframes up { from { opacity: 0; transform: translateY(12px);} to { opacity: 1; transform: none;} }
.day-head {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 17px 20px; background: linear-gradient(135deg, #fff, #f7f9ff);
  border: 1px solid var(--border); border-radius: 14px; cursor: pointer; font-weight: 800;
  box-shadow: var(--shadow); transition: border-color .15s, transform .1s;
}
.day-head:hover { border-color: var(--brand); transform: translateX(2px); }
.day-title { font-size: 17px; }
.day-kcal { font-size: 13px; color: var(--muted); font-weight: 700; }
.day-legend { font-size: 12px; color: var(--muted); margin-left: auto; }
.chev { color: var(--muted); font-size: 14px; transition: transform .2s; margin-left: 4px; }
.day-body { padding: 16px 2px 0; }
.day-body.open, .meal-body.open { animation: fade .25s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(-4px);} to { opacity: 1; transform: none;} }

.person-block { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 14px; }
.meal-row-label {
  font-weight: 800; font-size: 13px; text-transform: uppercase; letter-spacing: .5px;
  color: var(--muted); margin: 16px 0 10px; padding-top: 4px;
}
.meal-row-label:first-child { margin-top: 0; }
@media (max-width: 640px) { .person-block { grid-template-columns: 1fr; } }

/* meal card */
.meal {
  border: 1px solid var(--border); border-radius: 14px; background: #fff;
  overflow: hidden; box-shadow: 0 4px 16px rgba(20,40,90,.06);
  transition: box-shadow .2s, transform .1s;
}
.meal:hover { box-shadow: 0 8px 24px rgba(20,40,90,.1); }
.meal-head { display: flex; align-items: center; gap: 8px; padding: 14px 16px; cursor: pointer; }
.meal-head:hover { background: #f8faff; }
.meal-t { font-weight: 700; font-size: 14px; flex: 1; }
.meal-kcal {
  font-size: 13px; font-weight: 800; white-space: nowrap; color: var(--brand);
  background: #eaf0ff; padding: 3px 10px; border-radius: 999px;
}
.meal-body { padding: 0 16px 14px; color: var(--text); }
.meal .sub { font-size: 13px; color: var(--violet); margin: 4px 0 8px; font-weight: 700; }
.meal .kbju { font-size: 13px; color: var(--muted); margin: 8px 0; }
.meal .ing { font-size: 13px; line-height: 1.6; }
.meal .ing b { color: var(--text); }
.meal .recipe { font-size: 13px; line-height: 1.6; border-top: 1px dashed var(--border); padding: 10px 0 2px; margin-top: 6px; }
.meal .recipe b { color: var(--text); }
.day-body, .meal-body { display: none; }
.day-body.open, .meal-body.open { display: block; }

/* ============ TABLE ============ */
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 13px 10px; border-bottom: 1px solid var(--border); font-size: 14px; }
th { color: var(--muted); font-weight: 700; font-size: 13px; }
tr:hover td { background: #f8faff; }
.num { text-align: right; }
tfoot td { font-weight: 800; border-top: 2px solid var(--border); font-size: 17px; background: #f7f9ff; }

@media (max-width: 560px) {
  .hero { min-height: 320px; }
  .card { padding: 20px; }
}
/* meal icon (эмодзи блюда) */
.meal-icon { margin-right: 4px; }

/* корзина-чек */
.card-title { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.card-actions { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.count-badge {
  font-size: 13px; font-weight: 800; color: var(--green);
  background: #e8f8ef; padding: 5px 12px; border-radius: 999px; white-space: nowrap;
}
button.ghost.small { padding: 7px 12px; font-size: 13px; }
#basketOut td > input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--green); cursor: pointer; }
#basketOut tr.cat-head td {
  background: #f3f6ff; font-weight: 800; color: var(--text);
  padding: 10px 10px 8px; border-bottom: 1px solid var(--border); font-size: 14px;
}
#basketOut .cat-sub { color: var(--muted); font-weight: 700; font-size: 13px; }
#basketOut tr.cat-head:hover td { background: #f3f6ff; }
#basketOut tbody tr td:first-child { width: 34px; }

/* ============ FIND PAGE ============ */
.suggest-row { margin-top: 18px; }
.recipe-title { margin: 0 0 6px; font-size: 24px; font-weight: 800; }
.recipe-reason { color: var(--muted); margin: 0 0 12px; font-style: italic; }
.recipe-ing, .recipe-steps { margin-top: 14px; line-height: 1.6; }
.recipe-ing ul { margin: 8px 0 0; padding-left: 20px; }
.kbju-note { color: var(--muted); font-size: 12px; margin-top: 4px; }
#fResult .kbju { font-weight: 800; color: var(--brand); margin-top: 4px; }

/* ссылка-кнопка (главные кнопки grid) */
.link-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 12px 22px; border-radius: 12px;
  font-weight: 700; text-decoration: none; font-size: 15px;
  background: linear-gradient(135deg, var(--red), #ff8a6b);
  color: #fff; box-shadow: 0 10px 24px rgba(229, 72, 77, .3);
  transition: filter .2s, transform .1s;
}
.link-btn:hover { filter: brightness(1.06); transform: translateY(-1px); }

/* ============ TOP NAV (вкладки) ============ */
.topnav {
  position: sticky; top: 0; z-index: 50;
  background: rgba(255,255,255,.82);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.topnav-inner { max-width: 1080px; margin: 0 auto; padding: 12px 20px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.brand { font-weight: 800; font-size: 18px; text-decoration: none; color: var(--text); white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; flex-shrink: 0; }
.tabs { display: flex; gap: 4px; flex-wrap: wrap; margin-left: 6px; align-items: center; }
.tab {
  padding: 7px 11px; border-radius: 999px;
  font-size: 13px; font-weight: 700; text-decoration: none;
  color: var(--text); border: 1px solid transparent;
  transition: all .15s; background: transparent; white-space: nowrap;
}
.tab:hover { background: #f1f5ff; color: var(--brand); }
.tab.active {
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  color: #fff; box-shadow: 0 6px 16px rgba(59,110,245,.3);
}

/* ============ SUMMARY BTNS ============ */
.summary-btns { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }

/* ============ SUB RESULT CARDS (добор/остаток/замена) ============ */
.sub-results { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.sub-card {
  background: #fff; border: 1px solid var(--border); border-radius: 14px;
  padding: 16px; box-shadow: 0 4px 14px rgba(20,40,90,.06);
}
.sub-card-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.sub-name { font-weight: 800; font-size: 16px; }
.sub-amt { font-size: 13px; font-weight: 800; color: var(--brand); background: #eaf0ff; padding: 3px 10px; border-radius: 999px; white-space: nowrap; }
.sub-reason { font-size: 13px; color: var(--muted); font-style: italic; }
.sub-meta { margin-top: 8px; font-size: 13px; color: var(--muted); }

/* ============ КНИГА РЕЦЕПТОВ ============ */
.filter-fieldset { border: 1px solid var(--border); border-radius: 12px; padding: 12px; margin: 0; }
.filter-fieldset legend { font-weight: 700; font-size: 13px; padding: 0 6px; color: var(--text); }
.recipe-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; margin-top: 16px; }
.recipe-card { padding: 18px; display: flex; flex-direction: column; gap: 12px; transition: transform .12s, box-shadow .12s; }
.recipe-card:hover { transform: translateY(-2px); box-shadow: 0 10px 24px rgba(20,40,90,.12); }
.recipe-head { display: flex; align-items: center; gap: 12px; }
.recipe-icon { font-size: 34px; line-height: 1; }
.recipe-title h3 { margin: 0; font-size: 17px; letter-spacing: -.3px; line-height: 1.25; }
.recipe-meta { color: var(--muted); font-size: 12.5px; margin-top: 3px; line-height: 1.45; }
.recipe-body h4 { margin: 0 0 8px; font-size: 13px; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); }
.recipe-ing { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 5px; }
.recipe-ing li { display: flex; justify-content: space-between; gap: 8px; font-size: 13.5px; border-bottom: 1px dashed var(--border); padding-bottom: 4px; }
.recipe-ing b { color: var(--brand); font-weight: 700; white-space: nowrap; }
.cook-toggle {
  margin-top: 6px; padding: 8px 14px; border-radius: 10px; border: 1px solid var(--border);
  background: #f7f9ff; font-family: inherit; font-size: 13px; font-weight: 700; cursor: pointer; color: var(--text);
  transition: all .15s;
}
.cook-toggle:hover { border-color: var(--brand); color: var(--brand); background: #f1f5ff; }
.cook-text { display: none; margin-top: 10px; padding: 12px; border-radius: 10px; background: #f7f9ff; border: 1px solid var(--border); font-size: 13.5px; line-height: 1.6; color: var(--text); }
.cook-text.open { display: block; }
.chip-chip-active, .chip.chip-active {
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  color: #fff !important; border-color: transparent;
  box-shadow: 0 6px 16px rgba(59,110,245,.3);
}
.muted { color: var(--muted); }
.muted.small { font-size: 13px; margin-top: 10px; }

/* ============ АДАПТИВНАЯ ШАПКА ============ */

