/* ── Fridge page ─────────────────────────────────────────────────────────── */
.fridge-page {
  padding: 0;
  display: flex;
  flex-direction: column;
  height: calc(100vh - 56px);
  overflow: hidden;
}

/* ── Top bar ─────────────────────────────────────────────────────────────── */
.fridge-toprow {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 20px;
  flex-shrink: 0;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}
.fridge-title {
  font-family: 'Unbounded', sans-serif;
  font-size: 14px; font-weight: 700;
  color: var(--text); margin: 0; flex-shrink: 0;
}
.fridge-toolbar { display: flex; gap: 8px; align-items: center; flex: 1; margin-left: 32px; }
.fridge-search {
  flex: 1; max-width: 380px; height: 32px;
  background: var(--bg); border: 1px solid var(--border);
  border-radius: var(--rs); padding: 0 12px;
  font-size: 13px; font-family: 'Onest',sans-serif; color: var(--text);
  outline: none; transition: border-color .2s;
}
.fridge-search-wrap { max-width: 380px; }
.fridge-search-wrap .fridge-search { max-width: none; padding-right: 30px; }
.fr-clear-btn { display:none; position:absolute; right:8px; top:50%; transform:translateY(-50%); border:none; background:none; cursor:pointer; font-size:17px; line-height:1; color:var(--text-3); padding:2px 5px; z-index:2; border-radius:4px; }
.fr-clear-btn:hover { color:var(--text); background:var(--bg-2,#eee); }
#df-variant-clear { top:auto; bottom:0; transform:none; height:35px; display:flex; align-items:center; right:6px; font-size:16px; }
.fridge-search:focus { border-color: #059669; }
.fridge-search::placeholder { color: var(--text-3); }
.fridge-select {
  height: 32px; background: var(--bg); border: 1px solid var(--border);
  border-radius: var(--rs); padding: 0 10px;
  font-size: 12px; font-family: 'Onest',sans-serif; color: var(--text);
  cursor: pointer; outline: none;
}
.fridge-select:focus { border-color: #059669; }
.btn-add-product {
  height: 32px; padding: 0 14px; flex-shrink: 0;
  background: linear-gradient(135deg,#059669 0%,#047857 100%);
  color: #fff; border: none; border-radius: var(--rs);
  font-size: 13px; font-weight: 600; font-family: 'Onest',sans-serif;
  cursor: pointer; white-space: nowrap; transition: opacity .15s;
}
.btn-add-product:hover { opacity: .9; }

/* ── Main layout (1 col) ─────────────────────────────────────────────────── */
.fridge-main {
  display: grid;
  grid-template-columns: 1fr;
  flex: 1; min-height: 0; overflow: hidden;
}

/* ── Shopping panel drawer ───────────────────────────────────────────────── */
.sl-panel-overlay {
  display: none; position: fixed; inset: 0; background: rgba(0,0,0,.3); z-index: 200;
}
.sl-panel-overlay.open { display: block; }
.sl-panel-drawer {
  position: fixed; top: 0; right: -520px; width: 480px; max-width: 96vw;
  height: 100vh; background: var(--surface); border-left: 1px solid var(--border);
  box-shadow: -4px 0 24px rgba(15,23,42,.1); z-index: 201;
  transition: right .24s cubic-bezier(.4,0,.2,1);
  display: flex; flex-direction: column; padding-bottom: 16px;
}
.sl-panel-drawer.open { right: 0; }
.sl-panel-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 20px 12px; border-bottom: 1px solid var(--border); flex-shrink: 0;
}
.sl-panel-title {
  font-family: 'Unbounded',sans-serif; font-size: 14px; font-weight: 700; color: var(--text);
}

/* ── Кнопка списка покупок в топбаре ─────────────────────────────────────── */
.btn-shopping-panel {
  height: 32px; padding: 0 14px; flex-shrink: 0;
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border-strong); border-radius: var(--rs);
  font-size: 13px; font-weight: 600; font-family: 'Onest',sans-serif;
  cursor: pointer; white-space: nowrap; transition: background .15s;
}
.btn-shopping-panel:hover { background: var(--bg); }

/* ══ строка счётчик + кнопка Сроки ════════════════════════════════════════ */
.fridge-count-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 16px 6px; flex-shrink: 0;
}
.fridge-count { padding: 0; font-size: 11px; color: var(--text-3); }
.btn-exp-panel {
  height: 28px; padding: 0 12px; flex-shrink: 0;
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border-strong); border-radius: var(--rs);
  font-size: 12px; font-weight: 600; font-family: 'Onest',sans-serif;
  cursor: pointer; white-space: nowrap; transition: background .15s;
}
.btn-exp-panel:hover { background: var(--bg); }

/* ══ Exp panel drawer (слева) ══════════════════════════════════════════════ */
.exp-panel-overlay {
  display: none; position: fixed; inset: 0; background: rgba(0,0,0,.3); z-index: 200;
}
.exp-panel-overlay.open { display: block; }
.exp-panel-drawer {
  position: fixed; top: 0; left: -540px; width: 500px; max-width: 96vw;
  height: 100vh; background: var(--surface); border-right: 1px solid var(--border);
  box-shadow: 4px 0 24px rgba(15,23,42,.1); z-index: 201;
  transition: left .24s cubic-bezier(.4,0,.2,1);
  display: flex; flex-direction: column;
}
.exp-panel-drawer.open { left: 0; }
.exp-panel-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 20px 12px; border-bottom: 1px solid var(--border); flex-shrink: 0;
}
.exp-panel-title {
  font-family: 'Unbounded',sans-serif; font-size: 15px; font-weight: 700; color: var(--text);
}

/* ══ Табы внутри панели ════════════════════════════════════════════════════ */
.exp-tab-bar {
  display: flex; gap: 4px; padding: 10px 20px 0; flex-shrink: 0;
  border-bottom: 1px solid var(--border);
}
.exp-tab-btn {
  height: 34px; padding: 0 14px; border: none; border-bottom: 2px solid transparent;
  background: none; font-size: 12px; font-weight: 600; font-family: 'Onest',sans-serif;
  color: var(--text-3); cursor: pointer; transition: color .15s, border-color .15s;
  border-radius: 0; margin-bottom: -1px;
}
.exp-tab-btn:hover { color: var(--text); }
.exp-tab-btn.active { color: #059669; border-bottom-color: #059669; }

/* ══ Секции сроков ═════════════════════════════════════════════════════════ */
.exp-section { margin-bottom: 16px; }
.exp-section:first-child { margin-top: 16px; }
.exp-section-title {
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .07em; margin-bottom: 8px;
  display: flex; align-items: center; gap: 6px;
}
.exp-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--rs);
  margin-bottom: 5px; cursor: pointer; transition: border-color .12s;
}
.exp-item:hover { border-color: #059669; }
.exp-item-info { flex: 1; min-width: 0; }
.exp-item-name { font-size: 13px; font-weight: 600; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.exp-item-meta { font-size: 11px; color: var(--text-3); margin-top: 2px; }

/* ══ группировка одинаковых ════════════════════════════════════════════════ */
.fr-group-badge {
  display: inline-flex; align-items: center; gap: 2px;
  font-size: 10px; font-weight: 700; color: #059669;
  background: rgba(5,150,105,.1); border: 1px solid rgba(5,150,105,.2);
  border-radius: 10px; padding: 1px 6px; cursor: pointer;
  transition: background .1s; flex-shrink: 0;
}
.fr-group-badge:hover { background: rgba(5,150,105,.2); }
.fr-row-child td { background: rgba(5,150,105,.02) !important; }
.fr-row-child td:first-child { padding-left: 20px !important; border-left: 3px solid rgba(5,150,105,.2); }

/* ── Кнопка "Съел" в таблице ─────────────────────────────────────────────── */
.ft-consume { width: 32px; text-align: center; padding: 0 4px !important; }
.fr-consume-btn {
  width: 22px; height: 22px; border-radius: 50%;
  border: 1.5px solid var(--border-strong); background: transparent;
  color: var(--text-3); font-size: 11px; font-weight: 700;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: all .12s; flex-shrink: 0; margin: 0 auto;
}

/* ══ MOBILE ════════════════════════════════════════════════════════════════ */
@media (max-width: 820px) {
  /* Топбар — в колонку, всё тянется на всю ширину */
  .fridge-page {
    height: auto;
    min-height: calc(100vh - 56px);
    overflow: visible;
  }
  .fridge-main {
    overflow: visible;
    min-height: 0;
  }
  .fridge-toprow {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    padding: 10px 14px;
  }
  .fridge-title {
    font-size: 13px;
  }
  .fridge-toolbar {
    flex-direction: column;
    margin-left: 0;
    gap: 6px;
  }
  .fridge-search {
    max-width: 100%;
    width: 100%;
    box-sizing: border-box;
  }
  .fridge-select {
    width: 100%;
    box-sizing: border-box;
  }
  /* Группа кнопок — 2 в ряд */
  .fridge-toprow > div[style*="display:flex"] {
    display: grid !important;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
  }
  .btn-shopping-panel,
  .btn-add-product {
    width: 100%;
    box-sizing: border-box;
    font-size: 12px;
    padding: 0 8px;
  }
}

/* ══ FAB — плавающая кнопка скана ЧЗ (моб.) ════════════════════════════════ */
.fr-fab-cz {
  display: none;
  position: fixed;
  right: 16px;
  bottom: 72px; /* над .mobile-nav */
  width: 56px; height: 56px;
  border-radius: 50%;
  border: none;
  background: linear-gradient(135deg,#059669 0%,#047857 100%);
  color: #fff;
  font-size: 24px;
  box-shadow: 0 4px 16px rgba(5,150,105,.4);
  cursor: pointer;
  z-index: 150;
  align-items: center;
  justify-content: center;
  transition: transform .12s, box-shadow .12s;
}
.fr-fab-cz:active { transform: scale(.92); }
@media (max-width: 820px) {
  .fr-fab-cz { display: flex; }
}
