:root {
  --bg: #eaf8f0;
  --bg-soft: #f5fbf8;
  --surface: #ffffff;
  --surface-soft: #f0f8f4;
  --line: #d2e8dd;
  --text: #1c2a23;
  --muted: #60756a;
  --primary: #2ebd82;
  --primary-strong: #1f9e6a;
  --danger: #c7524c;
  --shadow: 0 18px 42px rgba(36, 77, 61, 0.16);
  --shadow-sm: 0 8px 22px rgba(22, 62, 45, 0.1);
  --radius-xl: 30px;
  --radius-lg: 20px;
  --radius-md: 14px;
  --radius-sm: 10px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --app-height: 100dvh;
}

@view-transition {
  navigation: auto;
}

::view-transition-old(root) {
  animation: vt-fade-out 110ms ease both;
}

::view-transition-new(root) {
  animation: vt-fade-in 130ms ease both;
}

@keyframes vt-fade-in {
  from {
    opacity: 0;
    transform: translateY(6px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes vt-fade-out {
  from {
    opacity: 1;
    transform: translateY(0);
  }

  to {
    opacity: 0;
    transform: translateY(-4px);
  }
}

* {
  box-sizing: border-box;
  -webkit-user-drag: none;
  user-select: none;
  -webkit-user-select: none;
}

html,
body {
  height: var(--app-height);
  min-height: var(--app-height);
  width: 100%;
  overflow: hidden;
  overflow-x: hidden;
  overscroll-behavior: none;
}

body {
  margin: 0;
  font-family: "Avenir Next", "SF Pro Text", "Segoe UI", "Helvetica Neue", sans-serif;
  color: var(--text);
  background:
    radial-gradient(130% 70% at 6% -10%, #d5f2df 0%, transparent 55%),
    radial-gradient(70% 55% at 95% 0, #d8f3e2 0%, transparent 62%),
    linear-gradient(180deg, #e8f7ef, #f5fbf8 62%, #eef8f3);
  display: grid;
  place-items: center;
  height: var(--app-height);
  min-height: var(--app-height);
  padding: 12px;
  overscroll-behavior-y: none;
  touch-action: manipulation;
  -webkit-text-size-adjust: 100%;
}

html {
  background:
    radial-gradient(130% 70% at 6% -10%, #d5f2df 0%, transparent 55%),
    radial-gradient(70% 55% at 95% 0, #d8f3e2 0%, transparent 62%),
    linear-gradient(180deg, #e8f7ef, #f5fbf8 62%, #eef8f3);
}

h1,
h2,
h3,
p {
  margin: 0;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
select {
  font: inherit;
}

input,
textarea,
select,
[contenteditable="true"] {
  user-select: text;
  -webkit-user-select: text;
}

img {
  -webkit-user-drag: none;
}

button,
input,
select,
a {
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

a,
button {
  -webkit-touch-callout: none;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
a:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.hidden {
  display: none !important;
}

.page-shell {
  width: min(100%, 460px);
  height: max(320px, calc(var(--app-height) - 24px));
  max-height: calc(var(--app-height) - 24px);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.94), #f4faf7 36%, #edf8f2 100%);
  border: 1px solid rgba(174, 216, 197, 0.56);
  border-radius: min(38px, 2vw);
  box-shadow: var(--shadow);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow-x: hidden;
}

.hero-banner {
  padding:
    calc(16px + var(--safe-top)) calc(18px + var(--safe-right)) 18px calc(18px + var(--safe-left));
  background:
    radial-gradient(80% 80% at 100% 0, rgba(83, 212, 156, 0.34), transparent 66%),
    linear-gradient(165deg, #f4fff9 0%, #dff5ea 100%);
  border-bottom: 1px solid #cfe8dc;
  flex: none;
}

.hero-brand {
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--primary-strong);
}

.hero-banner h1 {
  margin-top: 10px;
  font-size: clamp(1.78rem, 6vw, 2.3rem);
  line-height: 1.08;
}

.hero-highlight {
  color: var(--primary-strong);
}

.hero-banner p {
  margin-top: 10px;
  color: #4f665c;
  line-height: 1.38;
}

.topbar {
  position: relative;
  z-index: 10;
  flex: none;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 10px;
  padding:
    calc(10px + var(--safe-top)) calc(14px + var(--safe-right)) 10px calc(14px + var(--safe-left));
  background: linear-gradient(180deg, rgba(243, 251, 247, 0.98), rgba(242, 250, 246, 0.96));
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid #d8ebe1;
}

.topbar.solid {
  background: linear-gradient(180deg, #f4fbf8, #f2f9f6);
}

.top-title {
  text-align: center;
  font-size: 1.15rem;
}

.topbar-spacer {
  width: 44px;
  height: 44px;
}

.icon-btn {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  border: 1px solid #d4e8de;
  background: #f4fbf7;
  color: #27463a;
  display: grid;
  place-items: center;
}

.icon-btn svg {
  width: 20px;
  height: 20px;
}

.store-chip {
  justify-self: center;
  min-height: 44px;
  border-radius: 999px;
  border: 1px solid #d4e8de;
  background: #eef8f3;
  color: #2c4d40;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  font-size: 0.92rem;
  font-weight: 600;
}

.store-chip.store-switch {
  cursor: pointer;
}

.store-chip.store-switch:active {
  transform: translateY(1px);
}

.store-switch-menu {
  position: absolute;
  top: calc(58px + var(--safe-top));
  left: calc(100px + var(--safe-left));
  right: calc(100px + var(--safe-right));
  min-width: 200px;
  z-index: 22;
  border: 1px solid #d6e9df;
  border-radius: 14px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.store-switch-item {
  width: 100%;
  border: 0;
  border-bottom: 1px solid #e6f1eb;
  background: transparent;
  color: #244337;
  text-align: left;
  min-height: 44px;
  padding: 10px 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.store-switch-item:last-child {
  border-bottom: 0;
}

.store-switch-item.current {
  background: #eef8f3;
  color: #2d5d49;
}

.store-switch-current {
  border-radius: 999px;
  border: 1px solid #cde5da;
  background: #e8f7ef;
  color: #2a8058;
  padding: 2px 8px;
  font-size: 0.72rem;
  font-weight: 700;
}

.store-chip svg {
  width: 17px;
  height: 17px;
}

.store-chip.inline {
  justify-self: flex-start;
  margin-bottom: 2px;
}

.page-content {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-y: contain;
  scrollbar-gutter: stable both-edges;
  padding:
    16px calc(16px + var(--safe-right)) calc(20px + var(--safe-bottom)) calc(16px + var(--safe-left));
}

.list-page {
  padding: 0;
}

.stores-page {
  padding-inline: 0;
}

.credit-footer {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  border-top: 1px solid #d9ece2;
  background: rgba(244, 251, 247, 0.9);
  padding:
    8px calc(14px + var(--safe-right)) calc(12px + var(--safe-bottom)) calc(14px + var(--safe-left));
  color: #5b7468;
  font-size: 0.76rem;
  letter-spacing: 0.02em;
}

.stores-page .page-row {
  padding-inline: 16px
}

.page-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.page-row h2 {
  font-size: 1.28rem;
}

.page-row.compact {
  margin-bottom: 10px;
}

.store-list,
.stack-list,
.category-list {
  display: grid;
  gap: 3px;
}

.store-tile {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  border: 1px solid #d1e7dc;
  background: #ffffff;
  padding: 14px;
  box-shadow: var(--shadow-sm);
  transition: transform 160ms ease;
}

.store-tile:active {
  transform: translateY(1px);
}

.store-tile:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.tile-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.tile-heading h2 {
  font-size: 1.05rem;
}

.store-tile-main p {
  margin-top: 8px;
  color: var(--muted);
  font-size: 0.9rem;
}

.status-dot {
  border-radius: 999px;
  border: 1px solid #d8e9e1;
  background: #f3faf6;
  color: #577066;
  font-size: 0.74rem;
  padding: 3px 8px;
}

.status-dot.active {
  border-color: #b8e5d0;
  color: #1c8a5a;
  background: #def6eb;
}

.tile-edit-link {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  border: 1px solid #d7e8df;
  background: #f4fbf8;
  display: grid;
  place-items: center;
  color: #2f5346;
}

.tile-edit-link svg {
  width: 18px;
  height: 18px;
}

.search-block {
  flex: none;
  padding:
    12px calc(14px + var(--safe-right)) 10px calc(14px + var(--safe-left));
  background: linear-gradient(180deg, #f4fbf8, #f2faf6);
  border-bottom: 1px solid #d9ece2;
}

.search-row {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 8px;
}

.search-row input {
  height: 48px;
  border-radius: 14px;
  border: 1px solid #d1e7dc;
  background: #fff;
  padding: 0 14px;
  font-size: 1rem;
}

.list-block {
  border-top: 1px solid #d4e8de;
  background: #fff;
  padding: 25px 18px;
  box-shadow: var(--shadow-sm);
}

.list-block.purchased {
  min-height: 300px;
  margin-top: 12px;
  padding-bottom: 28px;
  background: linear-gradient(180deg, #ffffff, #f4faf7);
}

.count-chip {
  border-radius: 999px;
  border: 1px solid #d8e9e1;
  background: #f2f9f6;
  color: #4f6a5e;
  font-size: 0.84rem;
  padding: 4px 10px;
}

.inline-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.text-btn {
  border: 1px solid #d6e8df;
  background: #f4fbf8;
  border-radius: 10px;
  min-height: 36px;
  padding: 0 10px;
  color: #39584c;
}

.aisle-section {
  border: 1px solid #dbece4;
  border-radius: 13px;
  overflow: hidden;
  background: #fff;
}

.aisle-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #ecf7f2;
  color: #305447;
  padding: 10px 12px;
  font-weight: 700;
  font-size: 0.9rem;
}

.item-row {
  display: grid;
  grid-template-columns: 44px 1fr;
  gap: 0px;
  align-items: start;
  border-top: 1px solid #e8f3ed;
  padding: 10px 12px;
}

.item-row:first-of-type {
  border-top: 0;
}

.check-wrap {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  margin: -8px 0 -8px -6px;
  min-height: 42px;
  border-radius: 10px;
}

.item-check {
  width: 22px;
  height: 22px;
  margin: 0;
  accent-color: var(--primary);
}

.item-content {
  border: 0;
  background: transparent;
  text-align: left;
  padding: 0;
  color: inherit;
}

.item-title {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 0.98rem;
}

.item-title-text {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.qty-pill {
  border-radius: 999px;
  background: #d9f2e6;
  color: #214e3b;
  padding: 2px 8px;
  font-size: 0.75rem;
  font-weight: 700;
}

.item-aisle-inline {
  flex: none;
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  border: 1px solid #dcece5;
  background: #eef8f3;
  color: #46675b;
  font-size: 0.72rem;
  padding: 2px 8px;
  line-height: 1.2;
  white-space: nowrap;
}

.item-note {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.86rem;
}

.item-aisle {
  margin-top: 5px;
  display: inline-flex;
  border-radius: 999px;
  border: 1px solid #dcece5;
  background: #eef8f3;
  color: #46675b;
  font-size: 0.72rem;
  padding: 2px 8px;
}

.item-row.item-check-pending .item-check {
  animation: check-pop 180ms ease;
}

.item-row.item-check-pending .check-wrap,
.item-row.item-check-pending .item-content {
  pointer-events: none;
}

.keyboard-open {
  --safe-bottom: 0px;
}

.keyboard-open .page-content {
  padding-bottom: 12px !important;
  overscroll-behavior-y: none;
}

.keyboard-open .page-footer {
  padding-bottom: 10px !important;
}

.keyboard-open .credit-footer {
  padding-bottom: 8px !important;
}

.keyboard-open .list-block.purchased {
  padding-bottom: 10px;
}

@keyframes check-pop {
  0% {
    transform: scale(1);
  }

  45% {
    transform: scale(1.18);
  }

  100% {
    transform: scale(1);
  }
}

.empty-block {
  border-radius: 12px;
  border: 1px dashed #d8eae2;
  background: #f4faf7;
  text-align: center;
  color: var(--muted);
  font-size: 0.9rem;
  padding: 16px 10px;
}

.primary-btn,
.secondary-btn,
.danger-btn {
  min-height: 44px;
  border-radius: 12px;
  padding: 0 14px;
  border: 1px solid transparent;
}

.primary-btn {
  background: linear-gradient(170deg, #39cb8d, #21ab72);
  border-color: #1f9f6c;
  color: #fff;
}

.primary-btn.icon-only {
  width: 44px;
  min-width: 44px;
  padding: 0;
  display: grid;
  place-items: center;
}

.primary-btn.icon-only svg {
  width: 18px;
  height: 18px;
}

.secondary-btn {
  background: #f3faf6;
  border-color: #d6e9df;
  color: #2f4e42;
}

.danger-btn {
  background: #fef0ef;
  border-color: #f3caca;
  color: #923834;
}

.editor-page {
  display: grid;
  gap: 14px;
  align-content: start;
}

.field-block {
  display: grid;
  gap: 6px;
  color: #415f53;
  font-size: 0.88rem;
}

.field-block input,
.field-block select {
  min-height: 42px;
  border-radius: 12px;
  border: 1px solid #d4e8de;
  background: #fff;
  padding: 0 12px;
}

.qty-control {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: stretch;
  min-height: 42px;
  border-radius: 12px;
  border: 1px solid #d4e8de;
  background: #fff;
  overflow: hidden;
}

.qty-control input {
  border: 0;
  width: 100%;
  min-height: 42px;
  border-radius: 0;
  padding: 0 10px;
}

.qty-control input::-webkit-outer-spin-button,
.qty-control input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.qty-control input[type="number"] {
  -moz-appearance: textfield;
}

.qty-arrows {
  width: 32px;
  border-left: 1px solid #d9eae2;
  display: grid;
  grid-template-rows: 1fr 1fr;
}

.qty-arrow {
  border: 0;
  margin: 0;
  padding: 0;
  background: #f4fbf8;
  color: #365d4d;
  font-size: 0.7rem;
  line-height: 1;
}

.qty-arrow+.qty-arrow {
  border-top: 1px solid #d9eae2;
}

.editor-title-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.editor-title-row h2 {
  font-size: 1.12rem;
}

.editor-title-row p {
  color: var(--muted);
  font-size: 0.86rem;
}

.category-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 8px;
  border-radius: 12px;
  border: 1px solid #d8e9e1;
  background: #fff;
  padding: 8px;
  box-shadow: 0 4px 12px rgba(40, 84, 66, 0.08);
}

.category-row.dragging {
  opacity: 0.9;
  transform: scale(1.015);
  border-color: #79d9af;
  background: #ecfaf3;
  box-shadow: 0 14px 28px rgba(28, 73, 56, 0.2);
}

.category-row.drop-target {
  border-color: #82dcb4;
}

.category-row.drop-before {
  box-shadow: 0 -3px 0 #39c78b, 0 4px 12px rgba(40, 84, 66, 0.08);
}

.category-row.drop-after {
  box-shadow: 0 3px 0 #39c78b, 0 4px 12px rgba(40, 84, 66, 0.08);
}

.drag-handle,
.remove-handle {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  border: 1px solid #d9e9e2;
  background: #f4faf7;
  color: #406458;
  display: grid;
  place-items: center;
  touch-action: none;
}

.drag-handle svg,
.remove-handle svg {
  width: 18px;
  height: 18px;
}

.category-row input {
  min-height: 40px;
  border-radius: 10px;
  border: 1px solid #d7e9e1;
  padding: 0 10px;
}

.category-add-row {
  display: flex;
  align-items: end;
  gap: 8px;
}

.category-add-row .grow {
  flex: 1;
}

.field-grid.two {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.page-footer {
  flex: none;
  position: relative;
  z-index: 8;
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding:
    12px calc(16px + var(--safe-right)) calc(14px + var(--safe-bottom)) calc(16px + var(--safe-left));
  border-top: 1px solid #d8ebe1;
  background: rgba(245, 251, 248, 0.97);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.triple-footer {
  flex-direction: column;
}

.page-footer>* {
  flex: 1;
}

.footer-row {
  display: flex;
  flex-grow: 2;
  gap: 8px;
}

.footer-row>* {
  flex: 1;
}

.search-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(21, 36, 29, 0.16);
  backdrop-filter: blur(1.5px);
  -webkit-backdrop-filter: blur(1.5px);
  z-index: 40;
  touch-action: none;
}

.search-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 42;
}

.search-results {
  border-radius: 14px;
  border: 1px solid #d2e7dc;
  overflow: hidden;
  background: #fff;
  box-shadow: 0 16px 34px rgba(25, 58, 45, 0.22);
  max-height: min(calc(var(--app-height) - 170px), 440px);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.search-result,
.search-custom {
  width: 100%;
  border: 0;
  border-bottom: 1px solid #e7f2ec;
  background: #fff;
  color: inherit;
  text-align: left;
  padding: 12px;
}

.search-result {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 10px;
}

.search-result:last-of-type,
.search-custom:last-child {
  border-bottom: 0;
}

.result-name {
  font-size: 0.95rem;
}

.result-meta {
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.8rem;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.result-add {
  width: 36px;
  height: 36px;
  border-radius: 9px;
  border: 1px solid #d8e9e1;
  background: #f4fbf8;
  color: #2e5447;
  display: grid;
  place-items: center;
}

.result-add svg {
  width: 18px;
  height: 18px;
}

.search-custom {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  color: #255746;
}

.search-custom svg {
  width: 18px;
  height: 18px;
  color: #2f6d56;
}

.meal-result .result-add {
  color: #27624c;
}

.tag-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border-radius: 999px;
  border: 1px solid #d4e8de;
  background: #f1faf6;
  color: #32614e;
  padding: 2px 8px;
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1.2;
}

.tag-chip.meal {
  border-color: #bfe8d5;
  color: #1f7f58;
  background: #def5ea;
}

.tag-chip svg {
  width: 14px;
  height: 14px;
}

.make-meal {
  color: #235f49;
}

.item-row.item-highlight-add {
  animation: item-flash-add 1200ms ease;
}

.item-row.item-highlight-edit {
  animation: item-flash-edit 820ms ease;
}

@keyframes item-flash-add {
  0% {
    background: rgba(68, 206, 140, 0.5);
  }

  100% {
    background: transparent;
  }
}

@keyframes item-flash-edit {
  0% {
    background: rgba(68, 206, 140, 0.28);
  }

  100% {
    background: transparent;
  }
}

.app-toast {
  position: fixed;
  left: 50%;
  top: calc(14px + var(--safe-top));
  transform: translateX(-50%);
  z-index: 130;
  background: rgba(21, 34, 28, 0.95);
  color: #fff;
  border-radius: 14px;
  width: min(94vw, 520px);
  min-width: 240px;
  text-align: center;
  padding: 14px 18px;
  line-height: 1.35;
  opacity: 0;
  pointer-events: none;
}

.app-toast.show {
  animation: toast-in 180ms ease forwards;
}

.app-toast.fade-out {
  animation: toast-out 240ms ease forwards;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translate(-50%, -6px);
  }

  to {
    opacity: 1;
    transform: translate(-50%, 0);
  }
}

@keyframes toast-out {
  from {
    opacity: 1;
    transform: translate(-50%, 0);
  }

  to {
    opacity: 0;
    transform: translate(-50%, -6px);
  }
}

.confirm-backdrop {
  position: fixed;
  inset: 0;
  z-index: 160;
  display: grid;
  place-items: center;
  background: rgba(16, 30, 24, 0.28);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}

.confirm-backdrop.closing {
  opacity: 0;
  transition: opacity 150ms ease;
}

.confirm-dialog {
  width: min(92vw, 430px);
  border-radius: 16px;
  border: 1px solid #d8e9e1;
  background: #fff;
  box-shadow: 0 18px 30px rgba(17, 42, 31, 0.26);
  padding: 16px;
}

.confirm-dialog h3 {
  font-size: 1.03rem;
}

.confirm-dialog p {
  margin-top: 8px;
  color: #4f6a5f;
  line-height: 1.38;
}

.confirm-actions {
  margin-top: 14px;
  display: flex;
  justify-content: end;
  gap: 8px;
}

.confirm-select-wrap {
  margin-top: 12px;
}

.confirm-select {
  width: 100%;
  min-height: 42px;
  border-radius: 10px;
  border: 1px solid #d5e8de;
  background: #fff;
  padding: 0 10px;
}

.meal-backdrop {
  z-index: 98;
}

.meal-item-backdrop {
  z-index: 120;
}

.meal-dialog {
  width: min(94vw, 460px);
  border-radius: 18px;
  padding: 14px;
}

.meal-item-dialog {
  width: min(92vw, 430px);
}

.meal-item-popup-body {
  margin-top: 10px;
  display: grid;
  gap: 10px;
}

.meal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.meal-title-wrap {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.meal-head h3 {
  margin: 0;
  font-size: 1.06rem;
}

.meal-head p {
  margin-top: 6px;
  color: #587065;
  font-size: 0.86rem;
}

.meal-close-btn {
  width: 38px;
  height: 38px;
  border-radius: 10px;
}

.meal-body {
  margin-top: 12px;
  border-radius: 12px;
  border: 1px solid #dcece4;
  background: #f9fdfb;
  padding: 10px;
  max-height: min(calc(var(--app-height) - 280px), 430px);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.meal-body-edit {
  display: grid;
  gap: 10px;
}

.meal-item-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
}

.meal-item-row,
.meal-edit-row {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 8px;
  border: 1px solid #ddece5;
  border-radius: 12px;
  background: #fff;
  padding: 8px;
}

.meal-edit-row-active {
  border-color: #8adcb9;
  background: #f2fbf6;
}

.meal-edit-open {
  width: 100%;
  border: 0;
  background: transparent;
  text-align: left;
  color: inherit;
  padding: 0;
}

.meal-item-name {
  color: #1f332a;
  font-size: 0.93rem;
}

.meal-item-meta {
  margin-top: 3px;
  color: #60776c;
  font-size: 0.78rem;
}

.meal-item-action {
  min-width: 72px;
  min-height: 36px;
  border-radius: 10px;
}

.meal-item-action:disabled {
  opacity: 0.78;
}

.meal-footer {
  margin-top: 12px;
  display: flex;
  gap: 8px;
}

.meal-footer>* {
  flex: 1;
}

.meal-footer-3>* {
  flex: 1 1 33.333%;
}

.meal-suggest-list {
  border-radius: 12px;
  border: 1px solid #dbece4;
  background: #fff;
  max-height: 190px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.meal-suggest-row {
  width: 100%;
  border: 0;
  border-bottom: 1px solid #e8f2ed;
  background: #fff;
  color: inherit;
  text-align: left;
  padding: 9px 10px;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 8px;
}

.meal-suggest-row:last-child {
  border-bottom: 0;
}

.meal-suggest-custom .meal-suggest-main {
  font-weight: 700;
  color: #295f49;
}

.meal-suggest-row:disabled {
  opacity: 0.65;
}

.meal-suggest-main {
  display: block;
  font-size: 0.92rem;
}

.meal-suggest-meta {
  display: block;
  margin-top: 2px;
  color: #678075;
  font-size: 0.78rem;
}

.meal-item-editor {
  margin-top: 10px;
  border-radius: 12px;
  border: 1px solid #d9ebe3;
  background: #fff;
  padding: 10px;
}

.meal-item-editor-actions {
  margin-top: 10px;
  display: flex;
  gap: 8px;
}

.meal-item-editor-actions>* {
  flex: 1;
}

.install-gate {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 20px;
  background:
    radial-gradient(40% 34% at 90% 0, rgba(137, 225, 183, 0.42), transparent 100%),
    radial-gradient(36% 24% at 10% 100%, rgba(155, 219, 187, 0.46), transparent 100%),
    linear-gradient(180deg, #dcf5e7, #effaf5);
}

.install-panel {
  width: min(100%, 460px);
  border-radius: 26px;
  border: 1px solid #cde8d9;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: var(--shadow);
  padding: 20px;
  position: relative;
}

.install-pill {
  display: inline-flex;
  border-radius: 999px;
  border: 1px solid #cce8d8;
  background: #eefaf4;
  color: #1f9d68;
  font-size: 0.82rem;
  font-weight: 700;
  padding: 6px 12px;
}

.install-panel h1 {
  margin-top: 12px;
  font-size: clamp(1.48rem, 6vw, 2rem);
  line-height: 1.14;
}

.install-panel p {
  margin-top: 10px;
  color: #4a6559;
  line-height: 1.38;
}

.install-guide {
  margin-top: 16px;
  display: grid;
  gap: 10px;
}

.guide-step {
  display: flex;
  align-items: center;
  gap: 10px;
  border-radius: 12px;
  border: 1px solid #d7e9e0;
  background: #f4fbf8;
  padding: 10px;
  font-size: 0.88rem;
  color: #3f5f52;
}

.step-index {
  flex: none;
  border-radius: 999px;
  border: 1px solid #cde6da;
  background: #e9f7f0;
  color: #268657;
  font-size: 0.76rem;
  font-weight: 700;
  padding: 3px 8px;
}

.share-icon {
  margin-left: auto;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  border: 1px solid #cfe6db;
  background: #ecf8f2;
  display: grid;
  place-items: center;
}

.share-icon svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
}

.arrow-indicator {
  position: fixed;
  right: calc(18px + var(--safe-right));
  width: 56px;
  height: 56px;
  border-right: 6px solid #2ebd82;
  opacity: 0.9;
}

.arrow-top {
  top: calc(22px + var(--safe-top));
  border-top: 6px solid #2ebd82;
}

.arrow-bottom {
  bottom: calc(22px + var(--safe-bottom));
  border-bottom: 6px solid #2ebd82;
}

.drag-active,
.drag-active * {
  user-select: none;
}

@media (max-width: 620px) {

  html,
  body {
    position: fixed;
    inset: 0;
    height: var(--app-height);
  }

  body {
    padding: 0;
    place-items: stretch;
    min-height: var(--app-height);
  }

  .page-shell {
    width: 100%;
    height: var(--app-height);
    max-height: var(--app-height);
    border-radius: 0;
    border: 0;
    box-shadow: none;
  }

  .search-overlay {
    width: 100%;
    top: 0;
  }
}

@media (max-width: 420px) {
  .field-grid.two {
    grid-template-columns: 1fr;
  }

  .category-add-row {
    flex-direction: column;
    align-items: stretch;
  }
}