/* ────────────────────────────────────────────────────────────────────────────
   Pitanie — основной CSS
   Палитра и настроение взяты из исходного React-прототипа:
   тёмно-зелёный #2d4a3e, кремовый #f7f3ee, акценты для типов приёмов пищи.
   ──────────────────────────────────────────────────────────────────────────── */

/* ── 1. Токены и сброс ────────────────────────────────────────────────────── */
:root {
  --bg-app: #f7f3ee;
  --bg-card: #ffffff;
  --bg-elev: #faf7f2;
  --bg-strip: #f5f0e8;

  --text-100: #2a2a2a;
  --text-200: #666;
  --text-300: #a09080;
  --text-400: #b0a090;
  --text-mut: #aaa;

  --brand-100: #2d4a3e;
  --brand-200: #1a3028;
  --brand-300: #4a6a5a;
  --brand-on:  #f0e8d8;
  --brand-soft: #e0ebe4;

  --line-100: #f0ebe4;
  --line-200: #d8d0c4;
  --line-300: #e8c080;

  --meal-breakfast: #e8a838;
  --meal-lunch:     #4a9e6a;
  --meal-dinner:    #6a7fc4;

  --warn:    #c0856a;
  --danger:  #c05050;
  --info:    #4a6abf;

  --radius-sm: 8px;
  --radius:    12px;
  --radius-lg: 16px;

  --shadow-soft: 0 2px 12px rgba(0, 0, 0, 0.06);
  --shadow-pop:  0 12px 40px rgba(0, 0, 0, 0.18);

  --font-serif: Georgia, "Times New Roman", serif;
  --font-ui:    -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
                "Helvetica Neue", Arial, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font-serif);
  color: var(--text-100);
  background: var(--bg-app);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  font-size: 15px;
  line-height: 1.5;
}
a { color: var(--brand-100); text-decoration: none; }
a:hover { text-decoration: underline; }
code { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 0.9em;
       background: rgba(0,0,0,0.05); padding: 1px 5px; border-radius: 4px; }
button { font: inherit; cursor: pointer; }
input, select, textarea { font: inherit; }

/* ── 2. Layout (залогинен) ────────────────────────────────────────────────── */
.app-shell { min-height: 100vh; display: flex; flex-direction: column; }
.app-main { flex: 1; padding: 14px; max-width: 1280px; width: 100%; margin: 0 auto; }

/* ── 3. Header / табы ────────────────────────────────────────────────────── */
.app-header {
  background: linear-gradient(135deg, var(--brand-100) 0%, var(--brand-200) 100%);
  color: var(--brand-on);
  padding: 14px 0 0;
  position: sticky; top: 0; z-index: 50;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.18);
}
.app-header__inner { margin: 0 auto; max-width: 1280px; padding: 0 18px; }
.app-header__top { display: flex; align-items: center; justify-content: space-between;
                   gap: 12px; flex-wrap: wrap; }
.app-header__brand { display: flex; align-items: center; gap: 12px; }
.app-header__brand-icon { font-size: 26px; }
.app-header__eyebrow   { font-size: 10px; letter-spacing: 3px; opacity: 0.55;
                         text-transform: uppercase; }
.app-header__title     { font-size: 20px; font-weight: bold; margin-top: 2px; }
.app-header__user { display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
                    font-size: 12px; opacity: 0.9; }
.app-header__user-name { font-weight: bold; }
.app-header__family code { background: rgba(255,255,255,0.12); color: #fff; }
.app-header__logout button { background: transparent; border: none; color: rgba(240,232,216,0.7);
                              font-size: 18px; padding: 0 6px; }
.app-header__logout button:hover { color: #fff; }

.app-tabs { display: flex; gap: 4px; margin-top: 14px; }
.app-tab {
  padding: 8px 16px; border: none; background: transparent; cursor: pointer;
  color: rgba(240, 232, 216, 0.7); font-family: var(--font-serif); font-size: 13px;
  border-radius: 10px 10px 0 0; transition: all 0.2s; text-decoration: none;
}
.app-tab:hover { color: #fff; text-decoration: none; }
.app-tab--active { background: var(--bg-app); color: var(--brand-100); font-weight: bold; }

/* ── 4. Кнопки ────────────────────────────────────────────────────────────── */
.btn-primary, .btn-ghost {
  display: inline-block; padding: 9px 14px; border-radius: 10px;
  font-family: var(--font-serif); font-size: 13px; line-height: 1; cursor: pointer;
  border: 1.5px solid transparent; transition: all 0.15s; text-decoration: none;
  text-align: center;
}
.btn-primary { background: var(--brand-100); color: var(--brand-on); border-color: var(--brand-100); }
.btn-primary:hover { background: var(--brand-200); }
.btn-primary--block { display: block; width: 100%; padding: 12px; }
.btn-primary--danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-primary--danger:hover { background: #a04040; }

.btn-ghost { background: transparent; color: var(--brand-100); border-color: var(--brand-100); }
.btn-ghost:hover { background: var(--brand-soft); }
.btn-ghost--sm { padding: 5px 10px; font-size: 12px; }
.btn-ghost--danger { color: var(--danger); border-color: #e8c4b4; }
.btn-ghost--danger:hover { background: #fdecea; }

.inline-form { display: inline; margin: 0; }

/* ── 5. Auth-страницы ─────────────────────────────────────────────────────── */
.auth-shell { min-height: 100vh; display: flex; align-items: center; justify-content: center;
              padding: 30px 14px; background: linear-gradient(160deg, var(--brand-soft), var(--bg-app)); }
.auth-card { background: #fff; border-radius: var(--radius-lg); padding: 32px;
             box-shadow: var(--shadow-pop); width: 100%; max-width: 420px; }
.auth-card__brand { font-size: 28px; text-align: center; margin-bottom: 4px; }
.auth-card__title { font-size: 24px; margin: 0 0 18px; text-align: center; color: var(--brand-100); }
.auth-card__hint  { text-align: center; margin-top: 16px; font-size: 13px; color: var(--text-200); }
.auth-card__hint--muted { color: var(--text-300); }

.alert { padding: 10px 14px; border-radius: var(--radius-sm); margin-bottom: 14px; font-size: 13px; }
.alert--error { background: #fdecea; color: var(--danger); border-left: 3px solid var(--danger); }

/* ── 6. Формы ─────────────────────────────────────────────────────────────── */
.form { display: flex; flex-direction: column; gap: 6px; }
.form--auth { gap: 10px; }
.form--two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 16px; }
.form--two-col .form__label--full,
.form--two-col .form__input--full,
.form--two-col .form__row--full,
.form--two-col .form__fieldset--full,
.form--two-col .form__actions--full { grid-column: 1 / -1; }
.form__label { font-size: 11px; letter-spacing: 2px; text-transform: uppercase;
               color: var(--text-300); margin-top: 6px; }
.form__input { width: 100%; padding: 10px 12px; border: 1.5px solid var(--line-200);
               border-radius: 10px; background: #fff; color: var(--text-100);
               font-family: var(--font-serif); font-size: 14px; transition: border 0.15s; }
.form__input:focus { outline: none; border-color: var(--brand-100); }
.form__input--textarea { font-family: var(--font-serif); line-height: 1.6; resize: vertical; }
.form__hint  { font-size: 12px; color: var(--text-300); margin: 4px 0 0; }
.form__check { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; }
.form__inline { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; }
.form__row { display: flex; gap: 16px; flex-wrap: wrap; align-items: center; }
.form__fieldset { border: 1px solid var(--line-100); border-radius: 10px;
                  padding: 10px 14px; display: flex; flex-wrap: wrap; gap: 12px; }
.form__fieldset legend { font-size: 11px; letter-spacing: 2px; text-transform: uppercase;
                         color: var(--text-300); padding: 0 6px; }
.form__fieldset label { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-200); }
.form__fieldset input { width: 80px; }
.form__actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 14px; }

/* ── 7. Меню (menu.html) ──────────────────────────────────────────────────── */
.menu-toolbar { display: flex; align-items: center; justify-content: space-between;
                flex-wrap: wrap; gap: 12px; margin-bottom: 14px; }
.menu-toolbar__actions { display: flex; gap: 8px; flex-wrap: wrap; }
.menu-toolbar__hint { font-size: 12px; color: var(--text-300); max-width: 460px; text-align: right; }

.menu-grid {
  display: grid; grid-template-columns: repeat(7, 1fr); gap: 10px;
  background: transparent;
}
@media (max-width: 1100px) { .menu-grid { grid-template-columns: repeat(7, minmax(180px, 1fr)); overflow-x: auto; } }
/* Переключение недель */
.week-nav { display: flex; align-items: center; gap: 8px; margin-bottom: 14px; }
.week-nav__title { flex: 1; text-align: center; font-size: 16px; font-weight: bold; color: var(--brand-100); }
.week-nav__arrow { width: 36px; height: 36px; border-radius: 50%; border: 1.5px solid var(--brand-100);
                   background: #fff; color: var(--brand-100); font-size: 18px; cursor: pointer;
                   display: flex; align-items: center; justify-content: center; transition: all 0.15s; }
.week-nav__arrow:hover { background: var(--brand-soft); }
.week-nav__arrow[disabled] { opacity: 0.3; cursor: default; pointer-events: none; }
.week-nav__label { font-size: 11px; color: var(--text-300); }
/* Вид по дню: день расширяется на всю ширину grid */
.menu-day--expanded { grid-column: 1 / -1; display: grid !important; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.menu-day--expanded .menu-slot { min-height: 200px; }
.menu-day--expanded .menu-day__head { grid-column: 1 / -1; margin-bottom: 4px; }
.menu-day__head { cursor: pointer; user-select: none; transition: opacity 0.15s; }
.menu-day__head:hover { opacity: 0.7; }
.menu-day-back { display: none; margin-bottom: 12px; }
.menu-day-back--visible { display: flex; }
@media (max-width: 720px) {
  .menu-day--expanded { grid-template-columns: 1fr; }
}

.menu-day { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.menu-day__head { text-align: center; padding: 4px 0; font-weight: bold; color: var(--brand-100); }

.menu-slot {
  background: #fff; border-radius: var(--radius); padding: 8px;
  box-shadow: var(--shadow-soft); border-top: 3px solid var(--meal-color);
  display: flex; flex-direction: column; gap: 6px; min-height: 110px;
}
.menu-slot__head { display: flex; align-items: center; gap: 4px; font-size: 11px; color: var(--text-200); }
.menu-slot__emoji { font-size: 14px; }
.menu-slot__type { flex: 1; font-weight: bold; color: var(--meal-color); }
.menu-slot__add {
  width: 22px; height: 22px; border-radius: 50%; border: 1.5px dashed var(--line-200);
  background: transparent; color: var(--text-300); font-size: 14px; line-height: 0;
  display: flex; align-items: center; justify-content: center; padding: 0;
}
.menu-slot__add:hover { border-color: var(--brand-100); color: var(--brand-100); }

.meal-card {
  background: var(--bg-elev); border-radius: 10px; padding: 8px;
  border: 1.5px solid transparent; transition: all 0.2s; cursor: pointer;
  position: relative;
}
.meal-card:hover { border-color: var(--line-200); }
.meal-card--cooked { background: #d4edda; border-left: 4px solid #28a745; box-shadow: 0 0 0 1px #28a745; }
.meal-card--empty { background: transparent; border: 1.5px dashed var(--line-100); text-align: center;
                    padding: 18px 4px; color: var(--text-300); font-size: 11px; cursor: default; }
.meal-card__empty-text { font-style: italic; }
.meal-card__head { display: flex; align-items: center; gap: 6px; }
.meal-card__icon { font-size: 18px; }
.meal-card__title { flex: 1; font-size: 13px; line-height: 1.3; color: var(--text-100); }
.meal-card__chevron { color: var(--line-200); font-size: 16px; transition: transform 0.2s; }
.meal-card--open .meal-card__chevron { transform: rotate(180deg); }
.meal-card__body { margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--line-100);
                   font-size: 12px; cursor: default; }
.meal-card__kbju { display: flex; gap: 4px; padding: 8px 0; border-bottom: 1px solid var(--line-100); }
.meal-card__section { padding: 8px 0; border-bottom: 1px solid var(--line-100); }
.meal-card__section:last-of-type { border-bottom: none; }
.meal-card__section-label { font-size: 10px; letter-spacing: 2px; text-transform: uppercase;
                            color: var(--text-300); margin-bottom: 4px; }
.meal-card__ing { display: flex; justify-content: space-between; padding: 3px 0;
                  border-bottom: 1px dashed var(--line-100); }
.meal-card__ing:last-child { border-bottom: none; }
.meal-card__ing-amount { color: var(--text-300); }
.meal-card__recipe { white-space: pre-line; line-height: 1.7; color: var(--text-100); }
.meal-card__note { margin-top: 8px; background: var(--bg-strip); border-radius: 8px;
                   padding: 6px 10px; font-size: 12px; color: #8a7060;
                   border-left: 3px solid var(--line-300); }
.meal-card__actions { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; }

.kbju-cell { flex: 1; text-align: center; background: #fff; border-radius: 8px; padding: 5px 2px; }
.kbju-cell__v { font-size: 12px; font-weight: bold; color: var(--c, var(--text-100)); }
.kbju-cell__v small { font-size: 9px; font-weight: normal; }
.kbju-cell__l { font-size: 8px; color: var(--text-300); text-transform: uppercase; letter-spacing: 1px; }

/* ── 8. Покупки (shopping.html) ────────────────────────────────────────────── */
.shop-progress { background: #fff; border-radius: var(--radius-lg); padding: 14px;
                 box-shadow: var(--shadow-soft); margin-bottom: 14px; }
.shop-progress__top { display: flex; justify-content: space-between; margin-bottom: 6px; }
.shop-progress__top strong { color: var(--brand-100); }
.shop-progress__bar { height: 7px; background: var(--line-100); border-radius: 4px; overflow: hidden; }
.shop-progress__fill { height: 100%; background: var(--brand-100); border-radius: 4px;
                       transition: width 0.4s ease; }
.shop-progress__hint { font-size: 11px; color: var(--text-400); margin: 6px 0 0; }

.shop-toolbar { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.shop-cat { margin-bottom: 16px; }
.shop-cat__title { font-size: 11px; letter-spacing: 2px; text-transform: uppercase;
                   color: var(--text-300); margin: 0 0 8px; display: flex;
                   align-items: center; gap: 6px; }
.shop-cat__emoji { font-size: 14px; }
.shop-list { list-style: none; padding: 0; margin: 0;
             background: #fff; border-radius: var(--radius-lg);
             box-shadow: var(--shadow-soft); overflow: hidden; }
.shop-item { display: flex; align-items: flex-start; gap: 12px; padding: 12px 16px;
             border-bottom: 1px solid var(--line-100); transition: background 0.15s; }
.shop-item:last-child { border-bottom: none; }
.shop-item--checked { background: #f6faf6; }
.shop-item--checked .shop-item__name { color: var(--text-mut); text-decoration: line-through; }
.shop-item__check-btn { width: 22px; height: 22px; border-radius: 7px; flex-shrink: 0;
                         border: 2px solid var(--line-200); background: transparent;
                         display: flex; align-items: center; justify-content: center;
                         padding: 0; transition: all 0.2s; margin-top: 2px; }
.shop-item--checked .shop-item__check-btn { background: var(--brand-100); border-color: var(--brand-100); }
.shop-item__body { flex: 1; min-width: 0; }
.shop-item__name { font-size: 14px; color: var(--text-100); }
.shop-item__note { font-size: 11px; color: var(--text-400); margin-top: 2px; }
.shop-item__more { background: transparent; border: none; color: var(--text-300);
                   font-size: 14px; padding: 0 4px; cursor: pointer; }
.shop-item__more:hover { color: var(--brand-100); }
.shop-item__more--danger:hover { color: var(--danger); }
.shop-empty { text-align: center; color: var(--text-300); padding: 30px; font-style: italic; }

/* ── 9. Рецепты (recipes.html) ────────────────────────────────────────────── */
.recipes-toolbar { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.recipes-toolbar__hint { font-size: 12px; color: var(--text-300); margin: 0; }
.recipes-filter { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; margin-bottom: 14px; }
.filter-chip { padding: 6px 12px; border-radius: 20px; border: 1.5px solid var(--line-200);
               background: #fff; color: var(--text-200); font-size: 11px; cursor: pointer;
               font-family: var(--font-serif); white-space: nowrap; flex-shrink: 0; }
.filter-chip:hover { border-color: var(--brand-100); }
.filter-chip--active { background: var(--brand-100); border-color: var(--brand-100); color: #fff; }

.recipes-list { display: flex; flex-direction: column; gap: 10px; }
.recipe-card { background: #fff; border-radius: var(--radius-lg); box-shadow: var(--shadow-soft);
               overflow: hidden; border: 1.5px solid transparent; transition: border 0.2s;
               scroll-margin-top: 80px; }
.recipe-card:hover { border-color: var(--line-200); }
.recipe-card__head { display: flex; align-items: center; gap: 12px; padding: 13px 14px;
                     cursor: pointer; }
.recipe-card__icon { font-size: 26px; flex-shrink: 0; }
.recipe-card__main { flex: 1; min-width: 0; }
.recipe-card__cat { font-size: 10px; letter-spacing: 1.5px; text-transform: uppercase;
                    color: var(--text-300); margin-bottom: 2px; }
.recipe-card__name { font-size: 14px; color: var(--text-100); font-weight: bold;
                     white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.recipe-card__tags { display: flex; gap: 5px; margin-top: 5px; flex-wrap: wrap; }
.recipe-card__chevron { color: var(--line-200); font-size: 16px; transition: transform 0.2s; }
.recipe-card__head[aria-expanded="true"] .recipe-card__chevron { transform: rotate(180deg); }
.recipe-card__body { padding: 0 14px 14px; border-top: 1px solid var(--line-100); }
.recipe-card__kbju { display: flex; gap: 6px; padding: 10px 0 12px;
                     border-bottom: 1px solid var(--line-100); }
.recipe-card__badges { display: flex; gap: 6px; flex-wrap: wrap; padding: 8px 0; }
.recipe-card__section { padding: 8px 0; border-bottom: 1px solid var(--line-100); }
.recipe-card__section:last-of-type { border-bottom: none; }
.recipe-card__section-label { font-size: 10px; letter-spacing: 2px; text-transform: uppercase;
                               color: var(--text-300); margin: 0 0 6px; }
.recipe-card__recipe { white-space: pre-line; line-height: 1.8; font-size: 14px; color: var(--text-100); }
.recipe-card__ing { display: flex; justify-content: space-between; padding: 5px 0;
                    border-bottom: 1px dashed var(--line-100); }
.recipe-card__ing:last-child { border-bottom: none; }
.recipe-card__ing-amount { color: var(--text-300); }
.recipe-card__note { margin-top: 12px; background: var(--bg-strip); border-radius: 8px;
                     padding: 8px 12px; font-size: 13px; color: #8a7060;
                     border-left: 3px solid var(--line-300); }
.recipe-card__actions { display: flex; gap: 6px; margin-top: 12px; flex-wrap: wrap; }
.recipe-card__author { font-size: 12px; color: var(--text-300); font-style: italic; }
.recipes-empty { text-align: center; color: var(--text-300); padding: 30px; font-style: italic; }

.tag { font-size: 10px; padding: 2px 7px; border-radius: 10px; display: inline-block; }
.tag--green  { background: #f0f7f0; color: #4a8a5a; }
.tag--blue   { background: #e8f0ff; color: #4a6abf; }
.tag--orange { background: #fff0e8; color: #c07040; }

/* ── 10. Модалки ───────────────────────────────────────────────────────────── */
.modal { position: fixed; inset: 0; z-index: 100; display: flex;
         align-items: center; justify-content: center; padding: 16px; }
.modal[hidden] { display: none; }
.modal__backdrop { position: absolute; inset: 0; background: rgba(0, 0, 0, 0.5); }
.modal__panel { position: relative; background: #fff; border-radius: var(--radius-lg);
                box-shadow: var(--shadow-pop); max-width: 480px; width: 100%;
                max-height: calc(100vh - 32px); overflow-y: auto; padding: 24px; }
.modal--wide .modal__panel { max-width: 720px; }
.modal__panel--narrow { max-width: 380px; }
.modal__title { font-size: 20px; margin: 0 0 4px; color: var(--brand-100); }
.modal__subtitle { font-size: 12px; color: var(--text-300); margin-bottom: 12px; }
.modal__body { font-size: 14px; color: var(--text-200); margin: 12px 0 20px; }
.modal__close { position: absolute; top: 8px; right: 12px; background: transparent;
                border: none; font-size: 26px; color: var(--text-300); padding: 0;
                line-height: 1; }
.modal__close:hover { color: var(--text-100); }

/* ── 11. Drag-and-drop ─────────────────────────────────────────────────────── */
.meal-card--dragging { opacity: 0.4; }
.menu-slot--dragover { outline: 2px dashed var(--brand-100); outline-offset: -4px;
                       background: var(--brand-soft); }

/* ── 12. Адаптив ───────────────────────────────────────────────────────────── */
@media (max-width: 720px) {
  .app-header__top { flex-direction: column; align-items: flex-start; }
  .app-header__title { font-size: 18px; }
  .menu-grid { grid-template-columns: 1fr 1fr; }
  .menu-toolbar__hint { text-align: left; }
  .form--two-col { grid-template-columns: 1fr; }
  .modal__panel { padding: 18px; }
}
@media (max-width: 480px) {
  .menu-grid { grid-template-columns: 1fr; }
  .app-tabs { overflow-x: auto; flex-wrap: nowrap; }
  .app-tab { white-space: nowrap; }
}

/* ── 14. Покупки: сетка 2 колонки, сворачивание, meta ───────────────────── */
.shop-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  align-items: start;
}

.shop-cat__count {
  font-size: 11px;
  color: var(--text-400);
  background: var(--line-100);
  border-radius: 10px;
  padding: 1px 7px;
  margin-left: auto;
}

.shop-cat__chevron {
  font-size: 12px;
  color: var(--text-300);
  margin-left: 2px;
  transition: transform 0.2s;
}

.shop-cat__title {
  cursor: pointer;
  user-select: none;
}
.shop-cat__title:hover { color: var(--brand-100); }
.shop-cat__title:hover .shop-cat__chevron { color: var(--brand-100); }

.shop-list {
  transition: max-height 0.35s ease;
  overflow: hidden;
}
.shop-list--collapsed {
  max-height: 0 !important;
}

.shop-toolbar__copied {
  font-size: 12px;
  color: var(--brand-100);
  font-weight: bold;
  padding: 4px 0;
}

.shop-item__meta {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-top: 4px;
  font-size: 11px;
  color: var(--text-300);
}

.shop-item__recipe-link {
  color: var(--brand-100);
  text-decoration: none;
  font-style: italic;
}
.shop-item__recipe-link:hover { text-decoration: underline; }

.shop-item__adder {
  color: var(--text-400);
  font-size: 11px;
  white-space: nowrap;
  flex-shrink: 0;
}

@media (max-width: 720px) {
  .shop-grid {
    grid-template-columns: 1fr;
  }
}

/* ── 15. Ингредиенты: список строк с autocomplete ──────────────────────── */
.ing-list { display: flex; flex-direction: column; gap: 6px; margin: 4px 0 8px; }
.ing-row {
  display: grid;
  grid-template-columns: minmax(160px, 1fr) 130px auto auto;
  gap: 6px;
  align-items: center;
  background: var(--bg-elev);
  border: 1.5px solid var(--line-100);
  border-radius: 10px;
  padding: 6px 8px;
  position: relative;
  transition: border-color 0.15s;
}
.ing-row:focus-within { border-color: var(--brand-100); }
.ing-row__name-wrap { position: relative; min-width: 0; }
.shop-add-autocomplete { position: relative; }
.ing-row__name { width: 100%; padding: 6px 8px; border: 1px solid var(--line-200);
                 border-radius: 8px; background: #fff; font-size: 13px; }
.ing-row__dropdown {
  position: absolute; top: 100%; left: 0; right: 0; z-index: 200;
  background: #fff; border: 1.5px solid var(--brand-100);
  border-radius: 10px; box-shadow: var(--shadow-pop);
  max-height: 240px; overflow-y: auto; margin-top: 2px;
}
.ing-row__opt { display: flex; align-items: center; gap: 8px;
                padding: 8px 10px; cursor: pointer; font-size: 13px;
                border-bottom: 1px solid var(--line-100); }
.ing-row__opt:last-child { border-bottom: none; }
.ing-row__opt:hover { background: var(--brand-soft); }
.ing-row__opt-emoji { font-size: 16px; }
.ing-row__opt-name { flex: 1; }
.ing-row__opt-cat { font-size: 10px; color: var(--text-300);
                    text-transform: uppercase; letter-spacing: 1px; }
.ing-row__opt--empty { font-style: italic; color: var(--text-300); cursor: default; }
.ing-row__opt--empty:hover { background: transparent; }
.ing-row__amount { width: 130px; padding: 6px 8px; border: 1px solid var(--line-200);
                   border-radius: 8px; background: #fff; font-size: 13px; }
.ing-row__quick { display: flex; gap: 3px; }
.ing-row__quick-btn { padding: 3px 6px; font-size: 10px; border-radius: 6px; }
.ing-row__remove { width: 26px; height: 26px; border-radius: 50%;
                   border: 1.5px solid var(--line-200); background: transparent;
                   color: var(--text-300); font-size: 14px; line-height: 0;
                   display: flex; align-items: center; justify-content: center; padding: 0; }
.ing-row__remove:hover { color: var(--danger); border-color: var(--danger); }
.ing-list__add { margin-top: 4px; }
.ing-legacy-details { margin-top: 4px; font-size: 12px; color: var(--text-300); }
.ing-legacy-details summary { cursor: pointer; user-select: none; }
.ing-legacy-details textarea { margin-top: 4px; }

@media (max-width: 720px) {
  .ing-row { grid-template-columns: 1fr 90px auto; }
  .ing-row__quick { display: none; }
}

/* ── 16. Доп. адаптив для покупок и мелочи ─────────────────────────────── */
@media (max-width: 720px) {
  .shop-grid { grid-template-columns: 1fr; }
  .app-header__user { font-size: 11px; }
}
@media (max-width: 480px) {
  .shop-item { padding: 10px 12px; gap: 8px; }
  .shop-item__adder { display: none; }
  .shop-progress__top { font-size: 12px; }
  .app-tab { padding: 6px 10px; font-size: 12px; }
}

/* ── 17. Поиск по покупкам ─────────────────────────────────────────────── */
.shop-search { margin-bottom: 12px; position: relative; }
.shop-search input { width: 100%; padding: 10px 14px 10px 38px; border: 1.5px solid var(--line-200);
                     border-radius: 12px; background: #fff; font-size: 14px;
                     background-image: url("data:image/svg+xml;charset=UTF-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16' fill='none' stroke='%23a09080' stroke-width='1.5' stroke-linecap='round'%3E%3Ccircle cx='7' cy='7' r='5'/%3E%3Cpath d='M11 11l3 3'/%3E%3C/svg%3E");
                     background-repeat: no-repeat;
                     background-position: 12px center; }
.shop-search input:focus { outline: none; border-color: var(--brand-100); }
.shop-empty--filtered { text-align: center; color: var(--text-300);
                         padding: 30px; font-style: italic; }

/* ── 18. Источники ингредиентов в покупках ──────────────────────────── */
.shop-item__sources {
  margin-top: 6px;
  padding: 6px 8px;
  background: var(--bg-strip);
  border-radius: 8px;
  font-size: 11px;
  color: var(--text-200);
}
.shop-item__source {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 2px 0;
  border-bottom: 1px dashed var(--line-100);
}
.shop-item__source:last-of-type {
  border-bottom: none;
}
.shop-item__total {
  margin-top: 6px;
  padding-top: 4px;
  border-top: 1px solid var(--line-200);
  font-weight: bold;
  color: var(--brand-100);
  font-size: 12px;
}

/* ────────────────────────────────────────────────────────────────────────────
   M8: @media print — подготовка к печати списка покупок и меню.
   ──────────────────────────────────────────────────────────────────────────── */
@media print {
  /* Скрываем всю навигацию, хедер, кнопки, модалки */
  .app-header, .app-tabs, .week-nav, .menu-toolbar,
  .recipes-toolbar, .recipes-filter,
  .shop-toolbar, .shop-search, .shop-progress,
  .modal, .modal__backdrop,
  .btn-ghost, .btn-primary, .btn-ghost--sm, .btn-ghost--danger,
  .meal-card__actions, .meal-card__chevron,
  .recipe-card__actions, .recipe-card__chevron,
  .shop-item__check, .shop-item__more,
  .menu-day-back, .menu-day-back--visible,
  .shop-cat__chevron,
  form, button, .filter-chip, .tag,
  [data-modal-close], [data-open-modal],
  [data-shop-toggle-cat],
  .shop-item__adder {
    display: none !important;
  }

  /* Убираем тени, фон, скругления */
  * { box-shadow: none !important; }
  body { background: #fff !important; font-size: 11pt; color: #000; }
  .app-shell { max-width: 100%; }
  .app-main { padding: 0; }

  /* Карточки — без фона, с рамкой */
  .meal-card, .recipe-card, .shop-item {
    border: 1px solid #ccc;
    box-shadow: none;
    background: #fff;
    page-break-inside: avoid;
  }

  /* Раскрываем все скрытые тела */
  .meal-card__body, .recipe-card__body { display: block !important; }

  /* Полноширинный грид */
  .menu-grid { display: block; }
  .menu-day { display: block; margin-bottom: 12px; page-break-inside: avoid; }
  .menu-slot { display: block; margin-bottom: 8px; }

  /* Список покупок — одна колонка */
  .shop-grid { grid-template-columns: 1fr !important; }

  /* Убираем цвета по day — всё ч/б */
  .menu-slot { border-left: 3px solid #999 !important; }
  .shop-cat__title { background: #eee; border-bottom: 2px solid #999; }

  /* Сохраняем ссылки видимыми */
  a { color: #000; text-decoration: underline; }
}
