/* --- Overlays / Modals ----------------------------------------------------- */

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(13,16,28,.45);
  -webkit-backdrop-filter: blur(7px);
  backdrop-filter: blur(7px);
  z-index: 60;
  display: none;
  align-items: flex-start;
  justify-content: center;
  overflow-y: auto;
  padding: 28px 16px;
}

.overlay.open { display: flex; }

.sheet {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  max-width: 860px;
  width: 100%;
  overflow: hidden;
  position: relative;
  box-shadow: var(--shadow-pop);
  animation: rise 0.22s cubic-bezier(0.2, 0.7, 0.3, 1) both;
}

@keyframes rise {
  from { opacity: 0; transform: translateY(14px) scale(0.985); }
  to   { opacity: 1; transform: none; }
}

@keyframes pop {
  from { transform: translateY(14px); opacity: 0; }
  to   { transform: none; opacity: 1; }
}

.x {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 32px;
  height: 32px;
  border-radius: 9px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 14px;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.x:hover { background: var(--surface-3); color: var(--text); }

/* Full-page sections (pantry, planner) */
.page {
  position: fixed;
  inset: 0;
  background: var(--bg);
  z-index: 55;
  display: none;
  overflow-y: auto;
}

.page.open { display: block; }

.page-inner { max-width: 960px; margin: 0 auto; padding: 24px 24px 80px; }

.page-head {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 6px;
}

.page-head h2 {
  font-size: 22px;
  font-weight: 750;
  letter-spacing: -0.02em;
  color: var(--text);
}

.page-head .back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  font-weight: 600;
  font-size: 13px;
  color: var(--text-soft);
  cursor: pointer;
  transition: background-color 0.15s ease;
}

.page-head .back:hover { background: var(--surface-3); }
.page-sub { color: var(--text-muted); font-size: 13.5px; margin-bottom: 18px; }

