/* ============================================================
   FreshEye AI — application shell & shared components
   ============================================================ */

.app-shell {
  position: relative;
  width: 100%;
  max-width: var(--shell);
  min-height: 100dvh;
  margin: 0 auto;
  background: var(--surface);
  box-shadow: 0 0 0 1px rgba(11, 28, 48, 0.03), 0 30px 80px rgba(15, 23, 42, 0.13);
  overflow-x: clip;
}

/* ---------------------------------------------------------- */
/* Top bar                                                     */
/* ---------------------------------------------------------- */

.topbar {
  position: fixed;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: var(--shell);
  z-index: 60;
  padding-top: var(--safe-top);
  background: rgba(248, 249, 255, 0.86);
  border-bottom: 1px solid rgba(11, 28, 48, 0.045);
  backdrop-filter: blur(20px) saturate(1.25);
  -webkit-backdrop-filter: blur(20px) saturate(1.25);
}

.topbar__inner {
  height: var(--header-h);
  padding: 0 var(--gutter);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.brand__logo {
  position: relative;
  width: 36px;
  height: 36px;
  flex: 0 0 auto;
  border-radius: 12px;
  background: linear-gradient(145deg, #0f9d76 0%, #006c49 58%, #054e38 100%);
  color: #d7ffef;
  display: grid;
  place-items: center;
  box-shadow: 0 4px 12px rgba(0, 108, 73, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.35);
}
.brand__logo::after {
  content: "";
  position: absolute;
  inset: 1px;
  border-radius: 11px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  pointer-events: none;
}
.brand__logo svg {
  width: 21px;
  height: 21px;
}

.brand__text {
  display: flex;
  flex-direction: column;
  min-width: 0;
  gap: 1px;
}

.brand__name {
  display: flex;
  align-items: baseline;
  gap: 6px;
  min-width: 0;
}
.brand__name strong {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 20px;
  white-space: nowrap;
}
.brand__name span {
  font-size: 10px;
  color: var(--on-surface-variant);
  white-space: nowrap;
}

.brand__status {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--primary);
  line-height: 14px;
}
.brand__status .dot {
  width: 5px;
  height: 5px;
}

.topbar__actions {
  display: flex;
  align-items: center;
  gap: 2px;
  flex: 0 0 auto;
}

.icon-btn {
  position: relative;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  color: var(--secondary);
  transition: background 0.18s, color 0.18s, transform 0.15s;
}
.icon-btn:hover {
  background: rgba(11, 28, 48, 0.045);
  color: var(--on-surface);
}
.icon-btn:active {
  transform: scale(0.94);
}
.icon-btn .icon {
  width: 21px;
  height: 21px;
}
.icon-btn__badge {
  position: absolute;
  top: 7px;
  right: 8px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--error);
  box-shadow: 0 0 0 2px var(--surface);
}

.avatar {
  width: 32px;
  height: 32px;
  margin-left: 4px;
  border-radius: 50%;
  background: linear-gradient(140deg, var(--primary-container), #047857);
  color: #fff;
  display: grid;
  place-items: center;
  box-shadow: 0 2px 8px rgba(0, 108, 73, 0.22);
}
.avatar .icon {
  width: 17px;
  height: 17px;
}

/* ---------------------------------------------------------- */
/* Bottom navigation                                           */
/* ---------------------------------------------------------- */

.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: var(--shell);
  z-index: 60;
  padding-bottom: var(--safe-bottom);
  background: rgba(248, 249, 255, 0.92);
  border-top: 1px solid rgba(11, 28, 48, 0.04);
  box-shadow: 0 -1px 12px rgba(0, 0, 0, 0.035);
  backdrop-filter: blur(20px) saturate(1.2);
  -webkit-backdrop-filter: blur(20px) saturate(1.2);
}

.bottom-nav__inner {
  height: var(--nav-h);
  display: flex;
  align-items: center;
  justify-content: space-around;
  padding: 0 10px;
}

.nav-item {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-width: 58px;
  height: 50px;
  border-radius: 12px;
  color: var(--secondary);
  font-size: 10px;
  font-weight: 500;
  line-height: 14px;
  transition: color 0.2s, transform 0.15s;
}
.nav-item .icon {
  width: 22px;
  height: 22px;
}
.nav-item:active {
  transform: scale(0.94);
}
.nav-item.is-active {
  color: var(--primary);
  font-weight: 700;
}
.nav-item.is-active::before {
  content: "";
  position: absolute;
  top: 0;
  width: 18px;
  height: 3px;
  border-radius: 0 0 4px 4px;
  background: var(--primary);
}
.nav-item__icon {
  position: relative;
  display: grid;
  place-items: center;
}
.nav-badge {
  position: absolute;
  top: -4px;
  right: -9px;
  min-width: 14px;
  height: 14px;
  padding: 0 3px;
  border-radius: 999px;
  background: var(--error);
  color: var(--on-error);
  font-size: 9px;
  font-weight: 700;
  line-height: 14px;
  text-align: center;
  box-shadow: 0 0 0 2px rgba(248, 249, 255, 0.9);
}

/* ---------------------------------------------------------- */
/* Page frame                                                  */
/* ---------------------------------------------------------- */

.page {
  min-height: 100dvh;
  padding: calc(var(--header-h) + var(--safe-top) + 16px) var(--gutter)
    calc(var(--nav-h) + var(--safe-bottom) + 28px);
  display: flex;
  flex-direction: column;
  gap: 24px;
  animation: page-in 0.32s var(--ease-spring);
}
.page--with-dock {
  padding-bottom: calc(var(--nav-h) + var(--safe-bottom) + 88px);
}
.page--with-checkout {
  padding-bottom: calc(var(--nav-h) + var(--safe-bottom) + 116px);
}
.page[data-route="recipes"] {
  gap: 16px;
}

.section {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
}
.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
}
.section-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 600;
  line-height: 22px;
  letter-spacing: -0.01em;
  min-width: 0;
}
.section-title .icon {
  color: var(--primary);
  width: 19px;
  height: 19px;
}
.section-title--sm {
  font-size: 13px;
}
.section-link {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  flex: 0 0 auto;
  font-size: 10px;
  font-weight: 600;
  color: var(--primary);
}
.section-link:hover {
  text-decoration: underline;
}
.section-kicker {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--primary);
}

/* ---------------------------------------------------------- */
/* Cards, buttons, badges                                      */
/* ---------------------------------------------------------- */

.card {
  background: var(--surface-container-lowest);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
}
.card--panel {
  box-shadow: var(--shadow-panel);
}
.card--hero {
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lift);
}
.card--flush {
  overflow: hidden;
}
.card__body {
  padding: 16px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 36px;
  padding: 0 13px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.01em;
  white-space: nowrap;
  transition: background 0.18s, color 0.18s, transform 0.15s, box-shadow 0.18s;
}
.btn:active {
  transform: scale(0.96);
}
.btn:disabled {
  opacity: 0.55;
  pointer-events: none;
}
.btn .icon {
  width: 16px;
  height: 16px;
}
.btn--primary {
  background: var(--primary);
  color: var(--on-primary);
  box-shadow: 0 2px 6px rgba(0, 108, 73, 0.13);
}
.btn--primary:hover {
  background: #07583d;
}
.btn--soft {
  background: var(--surface-container);
  color: var(--on-surface-variant);
}
.btn--soft:hover {
  background: var(--surface-container-high);
}
.btn--ghost {
  background: transparent;
  color: var(--primary);
}
.btn--ink {
  background: var(--inverse-surface);
  color: var(--inverse-on-surface);
}
.btn--amber {
  background: var(--tertiary-fixed);
  color: var(--on-tertiary-fixed);
}
.btn--block {
  width: 100%;
}
.btn--lg {
  height: 44px;
  border-radius: 12px;
  font-size: 13px;
}
.btn--sm {
  height: 28px;
  padding: 0 10px;
  font-size: 10px;
  border-radius: 6px;
}
.btn--icon {
  width: 36px;
  padding: 0;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border-radius: var(--radius-sm);
  padding: 2px 6px;
  font-size: 9px;
  font-weight: 600;
  line-height: 14px;
  white-space: nowrap;
}
.badge--amber {
  background: var(--tertiary-fixed);
  color: var(--on-tertiary-fixed);
}
.badge--green {
  background: var(--primary-fixed);
  color: var(--on-primary-fixed-variant, #005236);
}
.badge--error {
  background: var(--error-container);
  color: var(--on-error-container);
}
.badge--slate {
  background: var(--secondary-container);
  color: var(--on-secondary-container);
}
.badge--ink {
  background: rgba(33, 49, 69, 0.82);
  color: var(--inverse-on-surface);
}

/* ---------------------------------------------------------- */
/* Artwork (offline ingredient visuals)                        */
/* ---------------------------------------------------------- */

.art {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  display: grid;
  place-items: center;
  background:
    radial-gradient(90% 80% at 28% 8%, rgba(255, 255, 255, 0.92), rgba(255, 255, 255, 0) 58%),
    linear-gradient(145deg, var(--art-a, #e7f4ef), var(--art-b, #c9e5db));
  isolation: isolate;
}
.art::before {
  content: "";
  position: absolute;
  left: 14%;
  right: 14%;
  bottom: 15%;
  height: 7%;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.46);
  filter: blur(2px);
}
.art::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.24), transparent 36%, rgba(10, 30, 50, 0.07)),
    radial-gradient(120% 90% at 50% 110%, rgba(11, 28, 48, 0.1), transparent 55%);
  pointer-events: none;
}
.art__emoji {
  position: relative;
  z-index: 1;
  font-family: "Segoe UI Emoji", "Apple Color Emoji", "Noto Color Emoji", sans-serif;
  font-size: var(--art-size, 44px);
  line-height: 1;
  transform: translateY(-1px);
  filter: drop-shadow(0 9px 12px rgba(11, 28, 48, 0.2));
  user-select: none;
}
.art__shine {
  position: absolute;
  top: 8%;
  left: 12%;
  width: 30%;
  height: 18%;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.45);
  filter: blur(6px);
  z-index: 1;
  pointer-events: none;
}

.thumb {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius-md);
  background: var(--surface-container);
  flex: 0 0 auto;
}
.thumb--sm {
  width: 64px;
  height: 64px;
}
.thumb--md {
  width: 76px;
  height: 76px;
}
.thumb--lg {
  width: 96px;
  height: 96px;
}

/* ---------------------------------------------------------- */
/* Inventory hero: capture + telemetry                         */
/* ---------------------------------------------------------- */

.capture-card {
  padding: 16px;
  border-radius: 20px;
  background: var(--surface-container-lowest);
  box-shadow: var(--shadow-panel);
}
.capture-row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.capture-thumb {
  position: relative;
  width: 48px;
  height: 48px;
  border-radius: 12px;
  overflow: hidden;
  flex: 0 0 auto;
  background: linear-gradient(150deg, #dcecf8, #b9d7e9);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.55);
}
.capture-thumb svg {
  width: 100%;
  height: 100%;
}
.capture-thumb__live {
  position: absolute;
  right: 3px;
  bottom: 3px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--primary-container);
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.9);
}
.capture-copy {
  min-width: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.capture-kicker {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 9px;
  line-height: 13px;
  color: var(--secondary);
  white-space: nowrap;
  overflow: hidden;
}
.capture-kicker b {
  color: var(--primary);
  font-weight: 700;
  letter-spacing: 0.06em;
}
.capture-title {
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 600;
  line-height: 18px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.capture-btn {
  height: 34px;
  padding: 0 10px;
  border-radius: 9px;
  font-size: 10px;
  background: var(--surface-container);
  color: var(--on-surface);
}
.capture-btn:hover {
  background: var(--primary);
  color: #fff;
}
.capture-history-btn {
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  border-radius: 9px;
  display: grid;
  place-items: center;
  background: var(--surface-container-low);
  color: var(--secondary);
  transition: background 0.18s, color 0.18s;
}
.capture-history-btn:hover {
  background: var(--surface-container-high);
  color: var(--primary);
}
.capture-history-btn .icon {
  width: 17px;
  height: 17px;
}

.telemetry {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 4px;
  margin-top: 12px;
  padding: 8px 6px;
  border-radius: 12px;
  background: rgba(239, 244, 255, 0.72);
  text-align: center;
}
.telemetry__item {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}
.telemetry__item + .telemetry__item {
  border-left: 1px solid rgba(11, 28, 48, 0.055);
}
.telemetry__label {
  font-size: 9px;
  line-height: 13px;
  color: var(--secondary);
}
.telemetry__value {
  font-size: 14px;
  font-weight: 700;
  line-height: 18px;
  letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums;
}
.telemetry__value--accent {
  color: var(--primary);
}

/* ---------------------------------------------------------- */
/* Health card                                                 */
/* ---------------------------------------------------------- */

.health-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 16px;
  border-radius: 20px;
  background:
    radial-gradient(120% 120% at 100% 0%, rgba(16, 185, 129, 0.08), transparent 46%),
    linear-gradient(135deg, #ffffff 0%, #eff4ff 100%);
  box-shadow: var(--shadow-lift);
}
.health-main {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}
.ring {
  position: relative;
  width: 64px;
  height: 64px;
  flex: 0 0 auto;
}
.ring svg {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}
.ring__center {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.ring__value {
  font-size: 23px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.04em;
  font-variant-numeric: tabular-nums;
}
.ring__unit {
  font-size: 9px;
  color: var(--secondary);
  line-height: 12px;
}
.health-copy {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.health-title {
  display: flex;
  align-items: center;
  gap: 5px;
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 600;
  line-height: 18px;
  white-space: nowrap;
}
.health-title .pill {
  padding: 0 5px;
  font-size: 9px;
  line-height: 15px;
}
.health-sub {
  max-width: 148px;
  font-size: 10px;
  line-height: 14px;
  color: var(--secondary);
}
.health-stats {
  display: flex;
  align-items: center;
  gap: 9px;
  flex: 0 0 auto;
  padding-left: 9px;
  border-left: 1px solid rgba(11, 28, 48, 0.07);
}
.health-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
  min-width: 24px;
}
.health-stat b {
  font-size: 14px;
  line-height: 18px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.health-stat span {
  font-size: 9px;
  line-height: 12px;
  color: var(--secondary);
  white-space: nowrap;
}
.health-stat--tertiary b,
.health-stat--tertiary span {
  color: var(--tertiary);
}
.health-stat--error b,
.health-stat--error span {
  color: var(--error);
}

/* ---------------------------------------------------------- */
/* Expiry carousel                                             */
/* ---------------------------------------------------------- */

.expiry-head {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.expiry-head .section-title {
  font-size: 14px;
}
.expiry-head .pill {
  font-size: 9px;
  padding: 1px 6px;
}
.expiry-head .section-link {
  margin-left: auto;
}
.expiry-scroll {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  margin: 0 -16px;
  padding: 3px 16px 8px;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  scroll-padding-left: 16px;
}
.expiry-scroll::-webkit-scrollbar {
  display: none;
}
.expiry-card {
  flex: 0 0 240px;
  min-width: 240px;
  padding: 8px;
  border-radius: 16px;
  background: var(--surface-container-lowest);
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 10px;
  scroll-snap-align: start;
}
.expiry-top {
  display: flex;
  gap: 8px;
  min-width: 0;
}
.expiry-info {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.expiry-name {
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 700;
  line-height: 18px;
  margin-top: 1px;
}
.expiry-detail {
  font-size: 10px;
  line-height: 14px;
  color: var(--secondary);
}
.expiry-suggest {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding: 6px 8px;
  border-radius: 8px;
  background: var(--surface-container-low);
  color: var(--tertiary);
  font-size: 10px;
  line-height: 14px;
  font-weight: 500;
}
.expiry-suggest .icon {
  width: 14px;
  height: 14px;
}

/* ---------------------------------------------------------- */
/* Inventory tabs & grid                                       */
/* ---------------------------------------------------------- */

.inv-tools {
  display: flex;
  align-items: center;
  gap: 4px;
}
.tool-btn {
  width: 28px;
  height: 28px;
  border-radius: 7px;
  display: grid;
  place-items: center;
  background: var(--surface-container-lowest);
  color: var(--secondary);
  box-shadow: var(--shadow-xs);
  transition: color 0.18s, background 0.18s;
}
.tool-btn .icon {
  width: 17px;
  height: 17px;
}
.tool-btn.is-active {
  color: var(--primary);
  background: var(--surface-container-lowest);
}
.zone-tabs {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  margin: 0 -16px;
  padding: 2px 16px 4px;
  scrollbar-width: none;
}
.zone-tabs::-webkit-scrollbar {
  display: none;
}
.zone-tab {
  flex: 0 0 auto;
  padding: 5px 11px;
  border-radius: 999px;
  background: var(--surface-container);
  color: var(--on-surface-variant);
  font-size: 11px;
  font-weight: 500;
  line-height: 16px;
  transition: background 0.18s, color 0.18s, transform 0.15s;
}
.zone-tab:active {
  transform: scale(0.96);
}
.zone-tab.is-active {
  background: var(--primary);
  color: var(--on-primary);
  font-weight: 600;
  box-shadow: 0 3px 8px rgba(0, 108, 73, 0.2);
}

.inv-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.inv-card {
  position: relative;
  display: flex;
  flex-direction: column;
  padding: 8px;
  border-radius: 16px;
  background: var(--surface-container-lowest);
  box-shadow: var(--shadow-card);
  transition: transform 0.15s var(--ease-spring), box-shadow 0.2s;
  min-width: 0;
}
.inv-card:active {
  transform: scale(0.988);
}
.inv-thumb {
  position: relative;
  width: 100%;
  aspect-ratio: 1;
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 7px;
  background: var(--surface-container-low);
}
.confidence {
  position: absolute;
  top: 6px;
  left: 6px;
  z-index: 2;
  padding: 1px 5px;
  border-radius: 4px;
  background: rgba(33, 49, 69, 0.78);
  color: var(--inverse-on-surface);
  font-size: 9px;
  font-weight: 500;
  line-height: 14px;
  letter-spacing: 0.01em;
  backdrop-filter: blur(6px);
}
.days-chip {
  position: absolute;
  right: 6px;
  bottom: 6px;
  z-index: 2;
  padding: 1px 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.92);
  color: var(--on-surface);
  font-size: 9px;
  font-weight: 500;
  line-height: 14px;
  backdrop-filter: blur(6px);
  box-shadow: 0 1px 3px rgba(11, 28, 48, 0.08);
}
.inv-body {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
  flex: 1;
}
.inv-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  font-size: 9px;
  line-height: 13px;
  color: var(--secondary);
  min-height: 13px;
}
.inv-meta .badge {
  font-size: 8px;
  padding: 0 4px;
  line-height: 12px;
}
.inv-name {
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 600;
  line-height: 18px;
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 1px;
}
.inv-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  font-size: 10px;
  line-height: 14px;
  color: var(--secondary);
  margin-top: 2px;
}
.inv-line b {
  font-weight: 600;
}
.inv-line .tone-tertiary {
  color: var(--tertiary);
}
.inv-line .tone-error {
  color: var(--error);
}
.inv-line .tone-primary {
  color: var(--primary);
}
.inv-card .bar {
  margin-top: 7px;
  height: 5px;
}

/* list view */
.inv-grid.is-list {
  grid-template-columns: 1fr;
  gap: 8px;
}
.inv-grid.is-list .inv-card {
  flex-direction: row;
  align-items: center;
  gap: 10px;
  padding: 8px;
}
.inv-grid.is-list .inv-thumb {
  width: 78px;
  height: 78px;
  flex: 0 0 auto;
  margin: 0;
  aspect-ratio: auto;
}
.inv-grid.is-list .confidence,
.inv-grid.is-list .days-chip {
  font-size: 8px;
}
.inv-grid.is-list .inv-body {
  gap: 2px;
}
.inv-grid.is-list .inv-name {
  font-size: 14px;
}
.inv-grid.is-list .bar {
  margin-top: 6px;
}

.inv-empty {
  grid-column: 1 / -1;
  padding: 32px 16px;
  text-align: center;
  color: var(--secondary);
  background: var(--surface-container-low);
  border-radius: 16px;
  font-size: 12px;
}

/* ---------------------------------------------------------- */
/* Floating utility dock                                       */
/* ---------------------------------------------------------- */

.utility-dock {
  position: fixed;
  bottom: calc(var(--nav-h) + var(--safe-bottom) + 12px);
  left: 50%;
  transform: translateX(-50%);
  width: calc(100% - 32px);
  max-width: calc(var(--shell) - 32px);
  z-index: 45;
  display: flex;
  align-items: stretch;
  gap: 8px;
  padding: 8px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.7);
  box-shadow: var(--shadow-dock);
  backdrop-filter: blur(22px) saturate(1.2);
  -webkit-backdrop-filter: blur(22px) saturate(1.2);
  animation: dock-in 0.4s var(--ease-spring);
}
@keyframes dock-in {
  from {
    opacity: 0;
    transform: translate(-50%, 14px);
  }
  to {
    opacity: 1;
    transform: translate(-50%, 0);
  }
}
.dock-btn {
  flex: 1;
  min-width: 0;
  height: 40px;
  border-radius: 11px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 600;
  transition: background 0.18s, transform 0.15s;
}
.dock-btn:active {
  transform: scale(0.97);
}
.dock-btn .icon {
  width: 17px;
  height: 17px;
}
.dock-btn--soft {
  background: var(--surface-container);
  color: var(--on-surface-variant);
}
.dock-btn--soft:hover {
  background: var(--surface-container-high);
}
.dock-btn--primary {
  background: var(--primary);
  color: var(--on-primary);
  box-shadow: 0 3px 10px rgba(0, 108, 73, 0.18);
}
.dock-btn--primary:hover {
  background: #07583d;
}

/* ---------------------------------------------------------- */
/* Toast                                                       */
/* ---------------------------------------------------------- */

.toast-root {
  position: fixed;
  top: calc(var(--header-h) + var(--safe-top) + 14px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 120;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: max-content;
  max-width: min(var(--shell) - 32px, calc(100vw - 32px));
  pointer-events: none;
}
.toast {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 14px;
  border-radius: 999px;
  background: rgba(33, 49, 69, 0.96);
  color: var(--inverse-on-surface);
  font-size: 11px;
  font-weight: 500;
  line-height: 16px;
  box-shadow: 0 12px 30px rgba(11, 28, 48, 0.24);
  backdrop-filter: blur(12px);
  animation: toast-in 0.3s var(--ease-spring);
  pointer-events: auto;
  max-width: 100%;
}
.toast .icon {
  width: 16px;
  height: 16px;
  color: var(--primary-fixed);
}
.toast--error .icon {
  color: #ffb4ab;
}
.toast--amber .icon {
  color: var(--tertiary-fixed-dim);
}
.toast.is-leaving {
  animation: toast-out 0.24s forwards;
}
@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(-10px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}
@keyframes toast-out {
  to {
    opacity: 0;
    transform: translateY(-8px) scale(0.97);
  }
}

/* ---------------------------------------------------------- */
/* Sheets                                                      */
/* ---------------------------------------------------------- */

.sheet-root {
  position: fixed;
  inset: 0;
  z-index: 110;
  pointer-events: none;
}
.sheet-root.is-open {
  pointer-events: auto;
}
.sheet-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(11, 28, 48, 0.44);
  backdrop-filter: blur(3px);
  opacity: 0;
  transition: opacity 0.25s;
}
.sheet-root.is-open .sheet-backdrop {
  opacity: 1;
}
.sheet {
  position: absolute;
  left: 50%;
  bottom: 0;
  transform: translate(-50%, 104%);
  width: 100%;
  max-width: var(--shell);
  max-height: 88dvh;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 8px 16px calc(22px + var(--safe-bottom));
  border-radius: 24px 24px 0 0;
  background: var(--surface);
  box-shadow: var(--shadow-overlay);
  transition: transform 0.36s var(--ease-spring);
}
.sheet-root.is-open .sheet {
  transform: translate(-50%, 0);
}
.sheet__grab {
  width: 36px;
  height: 4px;
  border-radius: 999px;
  background: var(--outline-variant);
  margin: 4px auto 16px;
}
.sheet__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}
.sheet__title {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 600;
  line-height: 24px;
  letter-spacing: -0.01em;
}
.sheet__sub {
  margin-top: 2px;
  font-size: 11px;
  line-height: 16px;
  color: var(--secondary);
}
.sheet__close {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--surface-container);
  color: var(--secondary);
  flex: 0 0 auto;
}
.sheet__close .icon {
  width: 16px;
  height: 16px;
}
.sheet__section {
  margin-top: 16px;
}
.sheet__section-title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--secondary);
  margin-bottom: 8px;
}
.sheet__actions {
  display: flex;
  gap: 8px;
  margin-top: 20px;
}
.sheet__actions .btn {
  flex: 1;
  height: 44px;
  border-radius: 12px;
}

/* List rows inside sheets */
.sheet-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border-radius: 12px;
  background: var(--surface-container-low);
}
.sheet-row + .sheet-row {
  margin-top: 8px;
}
.sheet-row__icon {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: var(--surface-container-lowest);
  display: grid;
  place-items: center;
  color: var(--primary);
  flex: 0 0 auto;
}
.sheet-row__copy {
  flex: 1;
  min-width: 0;
}
.sheet-row__copy b {
  display: block;
  font-size: 12px;
  font-weight: 600;
  line-height: 17px;
}
.sheet-row__copy span {
  display: block;
  font-size: 10px;
  line-height: 14px;
  color: var(--secondary);
}

/* ---------------------------------------------------------- */
/* Inputs & switches                                           */
/* ---------------------------------------------------------- */

.input {
  width: 100%;
  height: 44px;
  padding: 0 13px;
  border-radius: 12px;
  border: 1px solid transparent;
  background: var(--surface-container-low);
  color: var(--on-surface);
  font-size: 12px;
  transition: border-color 0.18s, box-shadow 0.18s, background 0.18s;
}
.input::placeholder {
  color: var(--outline);
}
.input:focus {
  outline: none;
  background: var(--surface-container-lowest);
  border-color: var(--primary-container);
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.12);
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.field label {
  font-size: 11px;
  font-weight: 600;
  color: var(--on-surface-variant);
}

.switch {
  position: relative;
  width: 44px;
  height: 24px;
  flex: 0 0 auto;
  border-radius: 999px;
  background: var(--surface-container-high);
  transition: background 0.22s;
}
.switch::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 4px rgba(11, 28, 48, 0.22);
  transition: transform 0.24s var(--ease-spring);
}
.switch[aria-checked="true"] {
  background: var(--primary);
}
.switch[aria-checked="true"]::after {
  transform: translateX(20px);
}

.choice-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  border-radius: 12px;
  background: var(--surface-container-low);
}
.choice-row + .choice-row {
  margin-top: 8px;
}
.choice-row__copy {
  flex: 1;
  min-width: 0;
}
.choice-row__copy b {
  font-size: 12px;
  font-weight: 600;
  line-height: 17px;
}
.choice-row__copy p {
  margin-top: 2px;
  font-size: 10px;
  line-height: 14px;
  color: var(--secondary);
}

/* ---------------------------------------------------------- */
/* Loading / error states                                      */
/* ---------------------------------------------------------- */

.page-loading {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding-top: 4px;
}
.page-loading .skeleton {
  border-radius: 20px;
}

.error-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 48px 20px;
  border-radius: 20px;
  background: var(--surface-container-low);
  text-align: center;
}
.error-state__icon {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--error-container);
  color: var(--error);
  display: grid;
  place-items: center;
}
.error-state h3 {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 600;
}
.error-state p {
  font-size: 11px;
  line-height: 16px;
  color: var(--secondary);
  max-width: 260px;
}

/* ---------------------------------------------------------- */
/* Desktop framing                                             */
/* ---------------------------------------------------------- */

@media (min-width: 560px) {
  body {
    padding: 28px 0;
  }
  .app-shell {
    min-height: calc(100dvh - 56px);
    border-radius: 28px;
    overflow: hidden;
    isolation: isolate;
  }
  .topbar {
    top: 28px;
    border-radius: 28px 28px 0 0;
  }
  .bottom-nav {
    bottom: 28px;
    border-radius: 0 0 28px 28px;
  }
  .sheet {
    bottom: 28px;
    border-radius: 24px;
    max-width: calc(var(--shell) - 24px);
  }
  .toast-root {
    top: calc(28px + var(--header-h) + var(--safe-top) + 14px);
  }
  .utility-dock {
    bottom: calc(28px + var(--nav-h) + var(--safe-bottom) + 12px);
  }
  .checkout-bar {
    bottom: calc(28px + var(--nav-h) + var(--safe-bottom));
  }
  .page {
    min-height: calc(100dvh - 56px);
    padding-bottom: calc(var(--nav-h) + 32px);
  }
  .page--with-dock {
    padding-bottom: calc(var(--nav-h) + 96px);
  }
  .page--with-checkout {
    padding-bottom: calc(var(--nav-h) + 124px);
  }
}

@media (max-width: 380px) {
  :root {
    --gutter: 14px;
  }
  .health-sub {
    max-width: 120px;
  }
  .health-stats {
    gap: 7px;
    padding-left: 7px;
  }
  .brand__name span {
    display: none;
  }
}

/* ---------------------------------------------------------- */
/* Ring metric details                                         */
/* ---------------------------------------------------------- */

.ring__track {
  stroke: var(--surface-container);
}
.ring__bar {
  stroke: var(--primary-container);
  stroke-linecap: round;
  transition: stroke-dasharray 0.7s var(--ease-spring);
}
.section-title--amber .icon {
  color: var(--tertiary-container);
}
.brand__status--offline {
  color: var(--error);
}
.min-w-0 {
  min-width: 0;
}
.ing-chip--missing {
  background: rgba(255, 218, 214, 0.6);
}
.ing-chip--missing small {
  color: var(--error);
}
.recipe-match .r-track {
  stroke: var(--surface-container-high);
}
.recipe-match .r-bar {
  stroke: var(--primary-container);
  stroke-linecap: round;
}

@media (hover: none) {
  .grocery-delete {
    opacity: 0.6;
  }
}
