/* src/frontend/styles/page-shell/kitchen.css */

#page-kitchen {
  padding: 8px 20px 32px;
}

#page-kitchen .page-header { display: none; }

.kitchen-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}

.kitchen-toolbar .kitchen-catalog-toggle { margin-bottom: 0; flex: 0 0 auto; }
.kitchen-toolbar .kitchen-section-title { margin: 0; flex: 0 0 auto; }
.kitchen-toolbar .kitchen-weather { flex: 0 0 auto; margin-left: 0; }

.kitchen-list-header {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin: 8px 0 6px;
}

.kitchen-list-header .kitchen-section-title { margin: 0; flex: 0 0 auto; }
.kitchen-list-header .kitchen-weather { margin-left: auto; }

.kitchen-toolbar-when-open {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1 1 auto;
  min-width: 0;
  flex-wrap: wrap;
}

/* Push the rightmost cluster (Current List + weather) to the far end. */
.kitchen-toolbar > .kitchen-section-title {
  margin-left: auto;
}

/* Collapsed catalog hides chip-bar + search and the body. */
.kitchen-catalog.collapsed .kitchen-toolbar-when-open { display: none; }
.kitchen-catalog.collapsed > .kitchen-catalog-body { display: none; }

/* Search magnifier — collapsed by default, expands inline with input
   and reveals a popover with store filter when opened. */
.kitchen-search-wrap {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  background: var(--color-surface-2);
  border: 1px solid var(--color-border);
  border-radius: 999px;
  padding: 0;
  height: 28px;
  position: relative;
  transition: width 0.18s ease, padding 0.18s ease;
  width: 28px;
  /* Clip the input + popover-bg edges when wrap is collapsed.
     Popover lives outside this clip via its own position:absolute layer. */
}

.kitchen-search-wrap:focus-within,
.kitchen-search-wrap.has-query,
.kitchen-search-wrap.popover-open {
  width: 220px;
  padding: 0 10px 0 4px;
}

.kitchen-search-wrap.has-store-filter {
  border-color: var(--color-brand);
  background: var(--color-brand-soft);
}

.kitchen-search-popover {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  left: auto;
  width: 360px;
  max-width: 92vw;
  max-height: 70vh;
  overflow: hidden;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 10px;
  padding: 12px 14px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.45);
  z-index: 50;
  display: none;
  flex-direction: column;
}

.kitchen-search-wrap.popover-open .kitchen-search-popover { display: flex; }

.kitchen-search-popover-label {
  font-size: 10px;
  font-weight: 700;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--color-border);
}

.kitchen-search-popover-stores {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  max-height: 50vh;
  overflow-y: auto;
  padding-right: 4px;
}

.kitchen-search-popover .kitchen-store-filter-chip {
  width: 100%;
  text-align: center;
  font-size: 12px;
  padding: 6px 8px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

@media (max-width: 600px) {
  /* Mobile: slide-up bottom sheet with dim backdrop. */
  .kitchen-search-popover {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    top: auto;
    width: auto;
    max-width: none;
    max-height: 70vh;
    border-radius: 16px 16px 0 0;
    padding: 14px 16px env(safe-area-inset-bottom, 16px);
    box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.6);
    animation: kitchen-popover-slide-up 0.18s ease-out;
  }

  @keyframes kitchen-popover-slide-up {
    from { transform: translateY(100%); }
    to   { transform: translateY(0); }
  }

  /* Backdrop behind the sheet, only on mobile when open. */
  .kitchen-search-wrap.popover-open::before {
    content: "";
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    z-index: 49;
    animation: kitchen-popover-fade 0.18s ease-out;
  }

  @keyframes kitchen-popover-fade {
    from { opacity: 0; }
    to   { opacity: 1; }
  }

  .kitchen-search-popover-stores { grid-template-columns: repeat(2, 1fr); }
  .kitchen-search-popover-label { font-size: 12px; }
}

.kitchen-search-popover-empty {
  font-size: 12px;
  color: var(--color-text-muted);
  font-style: italic;
}

.kitchen-search-icon {
  width: 28px;
  flex: 0 0 28px;
  text-align: center;
  font-size: 13px;
  color: var(--color-text-muted);
  cursor: pointer;
  line-height: 28px;
  user-select: none;
}

.kitchen-search-input {
  flex: 1 1 auto;
  width: 0;
  min-width: 0;
  background: transparent;
  border: none;
  color: var(--color-text);
  font-size: 12px;
  font-weight: 500;
  outline: none;
  padding: 0;
  visibility: hidden;
}

.kitchen-search-wrap:focus-within .kitchen-search-input,
.kitchen-search-wrap.has-query .kitchen-search-input,
.kitchen-search-wrap.popover-open .kitchen-search-input {
  visibility: visible;
}

.kitchen-search-input::placeholder {
  color: var(--color-text-muted);
}

.kitchen-search-input::-webkit-search-cancel-button {
  cursor: pointer;
}

.kitchen-chip-bar {
  flex: 0 1 auto;
}

/* Store filter chips — used inside the search magnifier popover. */
.kitchen-store-filter-chip {
  appearance: none;
  background: var(--color-surface-2);
  border: 1px solid var(--color-border);
  color: var(--color-text);
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  line-height: 1.3;
}

.kitchen-store-filter-chip:hover { filter: brightness(1.1); }

.kitchen-store-filter-chip.active {
  background: var(--color-brand-soft);
  border-color: var(--color-brand);
  font-weight: 700;
}

.kitchen-empty {
  padding: 40px 20px;
  text-align: center;
  background: var(--color-surface-2);
  border-radius: 14px;
}

.kitchen-chip-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 4px 0 8px;
  border-bottom: 1px solid var(--color-border);
  margin-bottom: 10px;
}

.kitchen-chip-bar {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
  flex: 1 1 auto;
}

.kitchen-weather {
  flex: 0 0 auto;
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--color-text);
  padding: 4px 10px;
  background: var(--color-surface-2);
  border: 1px solid var(--color-border);
  border-radius: 999px;
  white-space: nowrap;
}

.kitchen-weather:empty { display: none; }
.kitchen-weather .ico { font-size: 16px; line-height: 1; }
.kitchen-weather .temp { font-size: 13px; }
.kitchen-weather .desc {
  font-size: 11px;
  color: var(--color-text-muted);
  font-weight: 500;
}

.kitchen-chip {
  appearance: none;
  border: 1px solid var(--color-border);
  background: var(--color-surface-2);
  color: var(--color-text);
  padding: 5px 11px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  line-height: 1.2;
}

.kitchen-chip:hover { filter: brightness(1.07); }

.kitchen-chip.active {
  background: var(--color-brand-soft);
  border-color: var(--color-brand);
  color: var(--color-text);
}

.kitchen-chip .ico { font-size: 14px; line-height: 1; }

/* Carousel wrapper — positions side arrows over the grid edges. */
.kitchen-grid-wrap {
  position: relative;
}

.kitchen-grid-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 4;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text);
  font-size: 22px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(0,0,0,0.25);
  opacity: 0.85;
}

.kitchen-grid-arrow:hover { opacity: 1; }
.kitchen-grid-arrow--prev { left: -10px; }
.kitchen-grid-arrow--next { right: -10px; }

/* Hide by default — JS adds .can-scroll-prev / .can-scroll-next on the
   wrapper based on actual scrollLeft + scrollWidth. */
.kitchen-grid-arrow { display: none; }
.kitchen-grid-wrap.can-scroll-prev .kitchen-grid-arrow--prev { display: flex; }
.kitchen-grid-wrap.can-scroll-next .kitchen-grid-arrow--next { display: flex; }

/* On touch devices the swipe gesture is enough — hide arrows always. */
@media (hover: none) and (pointer: coarse) {
  .kitchen-grid-arrow { display: none !important; }
}

/* Catalog grid — 2-row horizontal swipe carousel.
   Tile width fixed; users swipe left/right through products. */
.kitchen-grid {
  display: grid;
  grid-template-rows: repeat(2, minmax(0, 1fr));
  grid-auto-flow: column;
  grid-auto-columns: 120px;
  gap: 10px;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  scroll-snap-type: x proximity;
  padding-bottom: 8px;
  margin-bottom: 16px;
}

/* Empty state in the catalog should stay compact, not stretch to fill
   the 2-row carousel template. */
.kitchen-grid:has(> .kitchen-empty) {
  display: block;
  grid-template-rows: auto;
  padding-bottom: 0;
  margin-bottom: 8px;
}

.kitchen-grid > .kitchen-empty {
  padding: 14px 18px;
  font-size: 13px;
  color: var(--color-text-muted);
  text-align: left;
  background: transparent;
  border-radius: 0;
}

.kitchen-grid .kitchen-tile {
  scroll-snap-align: start;
  width: 120px;
  height: 120px;
}

/* Custom scrollbar so the swipe affordance is visible. */
.kitchen-grid::-webkit-scrollbar { height: 6px; }
.kitchen-grid::-webkit-scrollbar-thumb {
  background: var(--color-border);
  border-radius: 999px;
}

/* Current List grid stays a normal multi-row grid (not swipe). */
.kitchen-grid--list {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  grid-auto-flow: row;
  grid-auto-columns: auto;
  gap: 10px;
  overflow: visible;
  padding-bottom: 0;
}

.kitchen-grid--list .kitchen-tile {
  aspect-ratio: 1;
  width: auto;
  height: auto;
  scroll-snap-align: none;
}

/* Current-list tile: name top-left chip, price+qty bottom strip,
   image fills in between. */
.kitchen-grid--list .kitchen-tile-foot {
  position: absolute;
  inset: 0;
  display: block;
  padding: 0;
  background: none;
  pointer-events: none;
}

.kitchen-grid--list .kitchen-tile-name {
  position: absolute;
  top: 4px;
  left: 4px;
  max-width: calc(100% - 8px);
  background: rgba(0, 0, 0, 0.32);
  -webkit-backdrop-filter: blur(2px);
  backdrop-filter: blur(2px);
  color: #fff;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 11px !important;
  font-weight: 700;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.85);
  line-height: 1.2;
  -webkit-line-clamp: 2;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.kitchen-grid--list .kitchen-tile-meta {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 4px 6px;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.85) 60%, transparent);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
}

@media (max-width: 1400px) {
  .kitchen-grid--list { grid-template-columns: repeat(6, 1fr); }
}

@media (max-width: 1100px) {
  .kitchen-grid { grid-auto-columns: 110px; }
  .kitchen-grid .kitchen-tile { width: 110px; height: 110px; }
  .kitchen-grid--list { grid-template-columns: repeat(5, 1fr); }
}

@media (max-width: 720px) {
  .kitchen-grid { grid-auto-columns: 100px; }
  .kitchen-grid .kitchen-tile { width: 100px; height: 100px; }
  .kitchen-grid--list { grid-template-columns: repeat(4, 1fr); }

  /* Stack name above meta on narrow tiles so name has full width. */
  .kitchen-tile-foot {
    flex-direction: column;
    align-items: stretch;
    gap: 2px;
    padding: 4px 6px 5px;
  }
  .kitchen-tile-meta {
    width: 100%;
    justify-content: space-between;
    gap: 4px;
  }
  .kitchen-tile-name {
    -webkit-line-clamp: 1;
    word-break: normal;
    overflow-wrap: anywhere;
  }

  /* Compact toolbar — drop the "Browse products" label, keep just icon. */
  .kitchen-catalog-toggle .kitchen-catalog-toggle-label {
    font-size: 0;
  }
  .kitchen-catalog-toggle .kitchen-catalog-toggle-label::before {
    content: "🛒";
    font-size: 14px;
  }

  /* Smaller weather pill — drop the description word, keep emoji + temp. */
  .kitchen-weather .desc { display: none; }

  /* Section title smaller on mobile. */
  .kitchen-section-title { font-size: 14px; }
  .kitchen-list-total { font-size: 12px; }
}

.kitchen-tile-name { font-size: 12px !important; }
.kitchen-tile-price { font-size: 12px !important; }
.kitchen-tile-badge { font-size: 11px !important; padding: 1px 7px !important; }

.kitchen-tile {
  position: relative;
  background: var(--color-surface-2);
  border: 1px solid var(--color-border);
  border-radius: 5px;
  overflow: hidden;
  aspect-ratio: 1;
  cursor: pointer;
  display: block;
}

.kitchen-tile-img {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 44px;
  background: var(--color-surface-3, var(--color-surface-2));
  background-image: linear-gradient(135deg, rgba(255,200,100,0.15), rgba(255,150,80,0.05));
}

.kitchen-tile-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.kitchen-tile-foot {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 6px 8px;
  background: linear-gradient(to top, rgba(0,0,0,0.85) 50%, rgba(0,0,0,0));
  color: #fff;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 6px;
  z-index: 2;
  pointer-events: none;
}

.kitchen-tile-name {
  flex: 1 1 auto;
  font-size: 11px !important;
  font-weight: 600;
  color: #fff;
  text-shadow: 0 1px 2px rgba(0,0,0,0.6);
  line-height: 1.2;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  word-break: break-word;
}

.kitchen-tile-meta {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: 0 0 auto;
}

.kitchen-tile-price {
  font-size: 11px !important;
  font-weight: 700;
  color: #fff;
  text-shadow: 0 1px 2px rgba(0,0,0,0.6);
}

.kitchen-tile-price--placeholder {
  color: rgba(255,255,255,0.55);
}

.kitchen-tile-badge {
  background: var(--color-brand);
  color: #fff;
  border-radius: 999px;
  padding: 1px 7px !important;
  font-size: 10px !important;
  font-weight: 700;
  flex-shrink: 0;
}

.kitchen-tile.on-list::before {
  content: "";
  position: absolute;
  left: 4px;
  top: 4px;
  z-index: 3;
  width: 30px;
  height: 30px;
  pointer-events: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' stroke='%23172029' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'><path d='M2.5 4 H5 L5.6 7 H21 L19 15 H7 Z' fill='%2310b981'/><path d='M5.6 7 L7 15' fill='none'/><path d='M12 8.6 V12.6 M10 10.6 L12 12.6 L14 10.6' fill='none'/><circle cx='9' cy='19' r='1.6' fill='%2310b981'/><circle cx='17' cy='19' r='1.6' fill='%2310b981'/></svg>");
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;
  filter: drop-shadow(0 1px 2px rgba(0,0,0,0.45));
  transform-origin: center;
  animation: kitchen-cart-beat 2s ease-in-out infinite;
}

@keyframes kitchen-cart-beat {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.12); }
}

.kitchen-tile.skipped .kitchen-tile-img { filter: brightness(0.45); }
.kitchen-tile.skipped::before {
  content: "skipped";
  position: absolute;
  top: 8px; left: 8px;
  background: rgba(0,0,0,0.55);
  color: #fff;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 700;
  z-index: 1;
}

.kitchen-section-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--color-text);
  margin: 8px 0 6px;
  display: flex;
  align-items: baseline;
  gap: 12px;
}

.kitchen-list-total {
  font-size: 13px;
  font-weight: 700;
  color: #10b981;
}

.kitchen-names-toggle {
  appearance: none;
  background: transparent;
  border: 1px solid var(--color-border);
  color: var(--color-text-muted);
  width: 26px;
  height: 26px;
  border-radius: 50%;
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  opacity: 0.7;
}

.kitchen-names-toggle:hover { opacity: 1; }

.kitchen-names-toggle.active {
  background: var(--color-brand-soft);
  border-color: var(--color-brand);
  opacity: 1;
}

/* Names hidden on current-list tiles by default. Toggle on body
   reveals them. */
.kitchen-grid--list .kitchen-tile-name { display: none; }
body.kitchen-show-names .kitchen-grid--list .kitchen-tile-name { display: -webkit-box; }

.kitchen-sheet {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: flex-end;
}

.kitchen-sheet-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.55);
}

.kitchen-sheet-card {
  position: relative;
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 18px 18px 0 0;
  padding: 18px 20px 24px;
  color: var(--color-text);
  box-shadow: 0 -8px 30px rgba(0,0,0,0.4);
}

.kitchen-sheet-header {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px;
  margin-bottom: 4px;
}

.kitchen-sheet-name {
  font-size: 22px;
  font-weight: 700;
}

.kitchen-sheet-close {
  appearance: none;
  background: transparent;
  border: none;
  color: var(--color-text-muted);
  font-size: 22px;
  cursor: pointer;
}

.kitchen-sheet-meta {
  font-size: 14px;
  color: var(--color-text-muted);
  margin-bottom: 16px;
}

.kitchen-sheet-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.kitchen-sheet-qty {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--color-surface-2);
  border: 1px solid var(--color-border);
  border-radius: 12px;
  padding: 6px 8px;
}

.kitchen-sheet-qty button {
  width: 44px; height: 44px;
  border-radius: 50%;
  border: none;
  background: var(--color-surface-3, var(--color-surface-2));
  color: var(--color-text);
  font-size: 22px;
  font-weight: 700;
  cursor: pointer;
}

.kitchen-sheet-qty span {
  min-width: 28px;
  text-align: center;
  font-size: 22px;
  font-weight: 700;
}

.kitchen-action {
  flex: 1 1 auto;
  min-width: 100px;
  padding: 12px 16px;
  border-radius: 10px;
  border: 1px solid var(--color-border);
  background: var(--color-surface-2);
  color: var(--color-text);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
}

.kitchen-action.bought   { background: #065f46; border-color: #047857; color: #fff; }
.kitchen-action.low      { background: #92400e; border-color: #b45309; color: #fff; }
.kitchen-action.skip     { background: var(--color-surface-3, var(--color-surface-2)); }
.kitchen-action.delete   { background: #7f1d1d; border-color: #991b1b; color: #fff; }
.kitchen-action.unskip   { background: var(--color-brand-soft); }

.kitchen-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.kitchen-preset {
  appearance: none;
  border: 1px solid var(--color-border);
  background: var(--color-surface-2);
  color: var(--color-text);
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
}

.kitchen-preset.active {
  background: var(--color-brand-soft);
  border-color: var(--color-brand);
}

.kitchen-tile-variants {
  background: rgba(255,255,255,0.18);
  color: #fff;
  border-radius: 4px;
  padding: 1px 6px;
  font-size: 10px;
  font-weight: 700;
  flex-shrink: 0;
}

.kitchen-variant-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 60vh;
  overflow-y: auto;
  padding: 8px 0;
}

.kitchen-variant-row {
  appearance: none;
  border: 1px solid var(--color-border);
  background: var(--color-surface-2);
  color: var(--color-text);
  padding: 10px 14px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  gap: 14px;
  cursor: pointer;
  text-align: left;
  font: inherit;
}

.kitchen-variant-row:hover { filter: brightness(1.1); }

.kitchen-variant-img {
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.kitchen-variant-name {
  flex: 1 1 auto;
  font-size: 15px;
  font-weight: 600;
  color: var(--color-text);
}

.kitchen-variant-meta {
  font-size: 13px;
  color: var(--color-text-muted);
  flex-shrink: 0;
}

/* Feature 1 — collapsible catalog */
.kitchen-catalog-toggle {
  appearance: none;
  background: var(--color-surface-2);
  border: 1px solid var(--color-border);
  color: var(--color-text);
  padding: 4px 10px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  width: auto;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  margin-bottom: 8px;
}

.kitchen-catalog-toggle:hover { filter: brightness(1.07); }

.kitchen-catalog-toggle-caret {
  font-size: 11px;
  color: var(--color-text-muted);
}

.kitchen-catalog.collapsed .kitchen-catalog-body {
  display: none;
}

.kitchen-catalog.collapsed {
  margin-bottom: 8px;
}

/* Feature 2 — Current List grouped by store */
/* Grouped current-list: a single grid where store headers span the
   full row and tiles flow continuously across stores — no trailing
   empty cells when a store has fewer than `cols` items. */
.kitchen-list-grid--grouped {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  grid-template-rows: auto;
  grid-auto-rows: auto;
  gap: 10px;
  align-items: start;
}

@media (max-width: 1400px) {
  .kitchen-list-grid--grouped { grid-template-columns: repeat(6, 1fr); }
}
@media (max-width: 1100px) {
  .kitchen-list-grid--grouped { grid-template-columns: repeat(5, 1fr); }
}
@media (max-width: 720px) {
  .kitchen-list-grid--grouped { grid-template-columns: repeat(4, 1fr); }
}

.kitchen-store-group { display: contents; }
.kitchen-store-group .kitchen-grid--list { display: contents; }

.kitchen-store-group-title {
  grid-column: 1 / -1;
  font-size: 16px;
  font-weight: 700;
  color: var(--color-text);
  margin: 8px 0 2px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.kitchen-store-group-title:first-child { margin-top: 0; }

.kitchen-store-group-count {
  font-size: 12px;
  font-weight: 500;
  color: var(--color-text-muted);
}

.kitchen-store-group-total {
  font-size: 12px;
  font-weight: 700;
  color: #10b981;
}

/* Feature 3 — Sheet store picker */
.kitchen-sheet-store {
  margin: 8px 0 14px;
}

.kitchen-sheet-store-btn {
  appearance: none;
  background: var(--color-surface-2);
  border: 1px solid var(--color-border);
  color: var(--color-text);
  padding: 10px 14px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
}

.kitchen-sheet-store-label { color: var(--color-text-muted); flex: 0 0 auto; }
.kitchen-sheet-store-value { flex: 1 1 auto; text-align: left; }
.kitchen-sheet-store-caret { color: var(--color-text-muted); font-size: 13px; }

.kitchen-sheet-store-picker {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 10px;
  padding: 10px 4px 4px;
  max-height: 50vh;
  overflow-y: auto;
}

.kitchen-store-section {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.kitchen-store-section-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-text-muted);
  padding: 0 2px;
}

.kitchen-store-section-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.kitchen-store-chip {
  appearance: none;
  background: var(--color-surface-2);
  border: 1px solid var(--color-border);
  color: var(--color-text);
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  line-height: 1.3;
}

.kitchen-store-chip:hover { filter: brightness(1.12); }

.kitchen-store-chip--active {
  background: var(--color-brand-soft);
  border-color: var(--color-brand);
  color: var(--color-text);
  font-weight: 700;
}

.kitchen-store-chip--clear {
  border-style: dashed;
  color: var(--color-text-muted);
  background: transparent;
}

/* ============================================================
   Long-press context menu (Apple-style) for Kitchen tiles
   ============================================================ */
.kitchen-ctx {
  position: fixed;
  inset: 0;
  z-index: 1100;
  display: flex;
}

.kitchen-ctx-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
}

.kitchen-ctx-card {
  position: fixed;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 12px;
  padding: 6px;
  min-width: 220px;
  max-width: 320px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  z-index: 1101;
  animation: kitchen-ctx-pop 0.16s ease-out;
}

@keyframes kitchen-ctx-pop {
  from { transform: scale(0.92); opacity: 0; }
  to   { transform: scale(1); opacity: 1; }
}

.kitchen-ctx-title {
  font-size: 11px;
  font-weight: 700;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 6px 10px 4px;
  border-bottom: 1px solid var(--color-border);
  margin-bottom: 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.kitchen-ctx-rows {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.kitchen-ctx-row {
  appearance: none;
  background: transparent;
  border: none;
  color: var(--color-text);
  text-align: left;
  padding: 8px 10px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 10px;
}

.kitchen-ctx-row:hover { background: var(--color-surface-2); }

.kitchen-ctx-row-icon {
  font-size: 16px;
  width: 22px;
  text-align: center;
  flex: 0 0 22px;
}

/* Suppress iOS long-press selection / callout on tiles. */
.kitchen-tile {
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}

/* --- Kitchen revamp: Running Low wall display --- */
.kitchen-low-header {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin: 4px 0 14px;
}
.kitchen-low-header .title { font-size: 20px; font-weight: 700; color: var(--text, #e6edf3); }
.kitchen-low-header .title .count { color: var(--color-brand, #f0883e); }
.kitchen-low-header .meta { display: flex; gap: 10px; align-items: center; color: var(--muted, #8b949e); font-size: 14px; }
.kitchen-low-header .onlist-chip,
.kitchen-essentials-header .onlist-chip {
  border: 1px solid var(--border, #3a3a3c); border-radius: 14px;
  padding: 4px 12px; cursor: pointer; color: var(--text, #e6edf3); font-size: 14px;
}
.kitchen-low-grid {
  display: grid; gap: 12px;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
}
.kitchen-low-tile {
  position: relative; background: var(--surface2, #161b22);
  border: 1px solid var(--border, #30363d); border-radius: 14px;
  padding: 10px; display: flex; flex-direction: column; gap: 6px;
  align-items: center; text-align: center; cursor: pointer;
  min-height: 150px; user-select: none;
}
.kitchen-low-tile:active { transform: scale(0.97); }
.kitchen-low-tile.urgent { border-color: var(--color-danger, #f85149); }
.kitchen-low-tile.on-list { opacity: 0.55; }
.kitchen-low-tile .thumb {
  width: 64px; height: 64px; border-radius: 10px; object-fit: cover;
  display: flex; align-items: center; justify-content: center; font-size: 34px;
  background: var(--surface3, #222831); border: 1px solid var(--border, #30363d);
}
.kitchen-low-tile .nm { font-size: 14px; font-weight: 600; color: var(--text, #e6edf3); line-height: 1.15; }
.kitchen-low-tile .lo { font-size: 12px; color: var(--color-brand, #f0883e); }
.kitchen-low-tile.urgent .lo { color: var(--color-danger, #f85149); }
.kitchen-low-tile .onlist-badge { font-size: 12px; color: var(--color-success, #3fb950); font-weight: 600; }
.kitchen-low-tile .gotit {
  position: absolute; top: 6px; right: 6px; font-size: 11px;
  border: 1px solid var(--border, #3a3a3c); border-radius: 10px;
  padding: 2px 8px; background: var(--surface, #0d1117); color: var(--muted, #8b949e);
}
.kitchen-low-empty { text-align: center; color: var(--muted, #8b949e); padding: 48px 12px; font-size: 18px; }
.kitchen-browse-bar { margin-top: 16px; }

.kitchen-essentials-header { display:flex; align-items:center; justify-content:space-between; margin:0 0 12px; }
.kitchen-essentials-header .title { font-weight:600; font-size:1.1rem; }
.kitchen-ess-grid { display:grid; grid-template-columns:repeat(auto-fill,minmax(96px,1fr)); gap:12px; }
.kitchen-ess-tile { position:relative; display:flex; flex-direction:column; align-items:center; gap:6px; padding:10px; border-radius:14px; background:var(--surface,#fff); box-shadow:0 1px 3px rgba(0,0,0,.08); cursor:pointer; }
.kitchen-ess-tile.on-list { outline:2px solid var(--accent,#2e7d32); }
.kitchen-ess-tile .thumb { width:56px; height:56px; display:flex; align-items:center; justify-content:center; font-size:2rem; border-radius:10px; object-fit:cover; }
.kitchen-ess-tile .nm { font-size:.8rem; text-align:center; line-height:1.1; }
.kitchen-ess-tile .onlist-badge { font-size:.7rem; color:var(--accent,#2e7d32); }
.kitchen-ess-tile .backup-dot { font-size:.7rem; }
.kitchen-ess-tile .add-ess { font-size:.72rem; color:var(--accent,#2e7d32); font-weight:600; }
.kitchen-ess-empty { text-align:center; color:var(--muted,#777); padding:24px 8px; }
.kitchen-suggest { margin-top:20px; text-align:left; }
.ksheet-title { font-weight:600; font-size:1.1rem; margin-bottom:12px; }
.ksheet-row { padding:8px 0; }
.ksheet-toggle { display:flex; align-items:center; gap:8px; cursor:pointer; }
.ksheet-add, .ksheet-remove { width:100%; margin-top:10px; }
