/*!***************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************!*\
  !*** css ./node_modules/next/dist/build/webpack/loaders/css-loader/src/index.js??ruleSet[1].rules[14].oneOf[2].use[1]!./node_modules/next/dist/build/webpack/loaders/next-font-loader/index.js??ruleSet[1].rules[14].oneOf[2].use[2]!./node_modules/next/font/google/target.css?{"path":"src/app/layout.tsx","import":"Inter","arguments":[{"subsets":["latin"],"variable":"--font-inter","display":"swap"}],"variableName":"inter"} ***!
  \***************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************/
/* cyrillic-ext */
@font-face {
  font-family: '__Inter_f367f3';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url(/_next/static/media/ba9851c3c22cd980-s.woff2) format('woff2');
  unicode-range: U+0460-052F, U+1C80-1C8A, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F;
}
/* cyrillic */
@font-face {
  font-family: '__Inter_f367f3';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url(/_next/static/media/21350d82a1f187e9-s.woff2) format('woff2');
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
/* greek-ext */
@font-face {
  font-family: '__Inter_f367f3';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url(/_next/static/media/c5fe6dc8356a8c31-s.woff2) format('woff2');
  unicode-range: U+1F00-1FFF;
}
/* greek */
@font-face {
  font-family: '__Inter_f367f3';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url(/_next/static/media/19cfc7226ec3afaa-s.woff2) format('woff2');
  unicode-range: U+0370-0377, U+037A-037F, U+0384-038A, U+038C, U+038E-03A1, U+03A3-03FF;
}
/* vietnamese */
@font-face {
  font-family: '__Inter_f367f3';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url(/_next/static/media/df0a9ae256c0569c-s.woff2) format('woff2');
  unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB;
}
/* latin-ext */
@font-face {
  font-family: '__Inter_f367f3';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url(/_next/static/media/8e9860b6e62d6359-s.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
/* latin */
@font-face {
  font-family: '__Inter_f367f3';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url(/_next/static/media/e4af272ccee01ff0-s.p.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}@font-face {font-family: '__Inter_Fallback_f367f3';src: local("Arial");ascent-override: 90.49%;descent-override: 22.56%;line-gap-override: 0.00%;size-adjust: 107.06%
}.__className_f367f3 {font-family: '__Inter_f367f3', '__Inter_Fallback_f367f3';font-style: normal
}.__variable_f367f3 {--font-inter: '__Inter_f367f3', '__Inter_Fallback_f367f3'
}

/*!************************************************************************************************************************************************************************************************************************************************************!*\
  !*** css ./node_modules/next/dist/build/webpack/loaders/css-loader/src/index.js??ruleSet[1].rules[14].oneOf[12].use[2]!./node_modules/next/dist/build/webpack/loaders/postcss-loader/src/index.js??ruleSet[1].rules[14].oneOf[12].use[3]!./src/styles.css ***!
  \************************************************************************************************************************************************************************************************************************************************************/
/* ============================================================
   LACOMPRA — Pantry theme (clean & minimal)
   CSS variables on :root, dark mode via [data-dark="true"]
============================================================ */

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; font-family: var(--font-sans); }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; padding: 0; text-align: left; }
input { font: inherit; color: inherit; background: none; border: 0; outline: 0; }

/* ============================================================
   THEME TOKENS — Pantry light (single source of truth)
============================================================ */
:root {
  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-display: "Fraunces", "Iowan Old Style", Georgia, serif;
  --bg: #faf6ef;
  --fg: #1f1a14;
  --fg-mute: #837868;
  --card-bg: #fffbf3;
  --card-line: #ece2d0;
  --rule: #ede3d2;
  --track: #ede3d2;
  --cat-bg: #f0e7d4;
  --tabbar-bg: rgba(255, 251, 243, 0.92);
  --bezel-line: #ddd0b8;
  --accent: #b54a2c;
  --accent-fg: #fffbf3;
  --accent-soft: #fbe9df;
  --accent-shadow: rgba(181, 74, 44, 0.4);
  --accent-2: #6f7c3f;
  --positive: #5a7a3d;
  --insight-bg: #fff6e8;
  --insight-line: #ecd9b3;
  --radius-card: 18px;
  --ring-track: var(--track);
}

/* ============================================================
   DARK MODE
============================================================ */
[data-dark="true"] {
  --bg: #1a1612;
  --fg: #f5ede0;
  --fg-mute: #968a76;
  --card-bg: #221d18;
  --card-line: #2e2820;
  --rule: #2e2820;
  --track: #2e2820;
  --cat-bg: #2a241d;
  --tabbar-bg: rgba(34, 29, 24, 0.92);
  --bezel-line: #3a3127;
  --accent: #d77051;
  --accent-fg: #1a1612;
  --accent-soft: #3a2418;
  --accent-shadow: rgba(215, 112, 81, 0.4);
  --accent-2: #8fa455;
  --positive: #7a9e50;
  --insight-bg: #2a201a;
  --insight-line: #3a2820;
}

/* ============================================================
   APP SHELL — full viewport mobile layout
============================================================ */
.app {
  width: 100%;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.4;
  position: relative;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

.app__body {
  flex: 1 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding-bottom: calc(112px + env(safe-area-inset-bottom, 0px));
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.app__body::-webkit-scrollbar { display: none; }

/* Screen transitions */
@keyframes screenIn {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}
.screen { animation: screenIn 200ms ease-out; }

/* ============================================================
   TAB BAR — fixed bottom nav
============================================================ */
.tabbar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: calc(80px + env(safe-area-inset-bottom, 0px));
  max-width: 600px;
  margin: 0 auto;
  background: var(--tabbar-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-radius: 28px 28px 0 0;
  display: grid;
  grid-template-columns: 1fr 1fr 1.2fr 1fr 1fr;
  align-items: center;
  padding: 0 4px;
  padding-bottom: calc(8px + env(safe-area-inset-bottom, 0px));
  box-shadow: 0 -4px 20px -6px rgba(20, 14, 8, 0.12), 0 0 0 1px var(--card-line);
  z-index: 20;
  overflow: visible;
}
.tabbar__btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 8px 0;
  color: var(--fg-mute);
  transition: color 180ms ease, transform 180ms ease;
}
.tabbar__btn.is-active { color: var(--fg); }
.tabbar__btn .tabbar__icon svg { width: 22px; height: 22px; }
.tabbar__label { font-size: 10px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; }
.tabbar__fab-slot { position: relative; display: flex; align-items: center; justify-content: center; align-self: stretch; overflow: visible; }
.tabbar__fab {
  position: absolute;
  top: 0;
  left: 50%; transform: translate(-50%, -50%);
  width: 76px; height: 76px;
  background: var(--accent);
  color: var(--accent-fg);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 8px 28px -4px var(--accent-shadow);
  transition: transform 200ms cubic-bezier(.2, .9, .3, 1.4);
  z-index: 1;
}
.tabbar__fab:active { transform: translate(-50%, -50%) scale(0.92); }
.tabbar__fab .tabbar__icon svg { width: 34px; height: 34px; }

/* ============================================================
   COMMON COMPONENTS
============================================================ */
.screen {
  padding: 8px 20px 80px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-width: 600px;
  margin: 0 auto;
  width: 100%;
}
.screen__header {
  display: flex; align-items: center; justify-content: space-between;
  padding-top: 4px;
}
.screen__header h1 { font: 600 26px/1.15 var(--font-display); margin: 4px 0 0; letter-spacing: -0.02em; }
.screen__title { font: 600 16px/1 var(--font-sans); margin: 0; }
.detail__header { padding-top: 8px; }
.header__action { color: var(--accent); font-weight: 600; font-size: 15px; }

.eyebrow { font-size: 11px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--fg-mute); margin: 0; }

.iconbtn {
  width: 40px; height: 40px;
  border-radius: 50%;
  background: var(--card-bg);
  display: grid; place-items: center;
  color: var(--fg);
  transition: background 180ms ease, transform 180ms ease;
}
.iconbtn svg { width: 20px; height: 20px; }
.iconbtn:active { transform: scale(0.92); }
.iconbtn--lg { width: 52px; height: 52px; }
.iconbtn--lg svg { width: 24px; height: 24px; }

.muted { color: var(--fg-mute); }
.dot-sep { color: var(--fg-mute); margin: 0 6px; }
.small { font-size: 11px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 20px;
  border-radius: 14px;
  font: 600 15px/1 var(--font-sans);
  transition: transform 160ms ease, background 160ms ease;
}
.btn:active { transform: scale(0.97); }
.btn--primary { background: var(--accent); color: var(--accent-fg); }
.btn--ghost { background: var(--card-bg); color: var(--fg); }
.btn--big { width: 100%; padding: 18px 20px; font-size: 16px; border-radius: 18px; }
.btn--sm { padding: 8px 14px; font-size: 13px; border-radius: 10px; width: auto; }

.card {
  background: var(--card-bg);
  border-radius: var(--radius-card);
  padding: 18px;
  border: 1px solid var(--card-line);
}
.card__row { display: flex; align-items: center; justify-content: space-between; gap: 16px; }

.sechdr {
  display: flex; align-items: baseline; justify-content: space-between;
  margin: 12px 0 4px;
}
.sechdr__title {
  font: 600 13px/1 var(--font-sans);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--fg-mute);
  margin: 0;
  display: inline-flex; align-items: center; gap: 8px;
}
.sechdr__badge {
  background: var(--accent);
  color: var(--accent-fg);
  font-size: 10px;
  padding: 2px 7px;
  border-radius: 999px;
  font-weight: 700;
}
.sechdr__action { font-size: 13px; color: var(--accent); font-weight: 600; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; grid-gap: 12px; gap: 12px; }

/* ============================================================
   UNIVERSAL LIST ROW
============================================================ */
.listrow {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 16px;
  background: var(--card-bg);
  border-radius: var(--radius-card);
  border: 1px solid var(--card-line);
  transition: transform 160ms ease, background 160ms ease;
  width: 100%;
}
.listrow:active { transform: scale(0.98); }
.listrow__left { display: flex; align-items: center; gap: 12px; flex-shrink: 0; }
.listrow__main { flex: 1 1; min-width: 0; }
.listrow__title { font-weight: 600; font-size: 15px; margin: 0; }
.listrow__sub { font-size: 12px; color: var(--fg-mute); margin: 2px 0 0; line-height: 1.4; }
.listrow__right { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.listrow__chev { color: var(--fg-mute); display: grid; place-items: center; }
.listrow__chev svg { width: 16px; height: 16px; }
.listrow.is-checked { opacity: 0.55; }
.listrow.is-checked .listrow__title { text-decoration: line-through; -webkit-text-decoration-color: var(--fg-mute); text-decoration-color: var(--fg-mute); }

.listrow--settings { border-radius: 14px; }
.listrow--settings-add { color: var(--fg-mute); border-style: dashed; }
.listrow--col { flex-direction: column; align-items: flex-start; gap: 4px; }
.listrow--toggle { gap: 8px; }

.listrow--stock .listrow__title { font-weight: 500; font-size: 14px; }
.listrow--prep .listrow__title { font-weight: 600; font-size: 14px; }

/* Checkmark for shopping items */
.checkmark {
  width: 28px; height: 28px;
  border-radius: 10px;
  border: 2px solid var(--rule);
  display: grid; place-items: center;
  color: transparent;
  background: var(--bg);
  flex-shrink: 0;
  transition: all 200ms cubic-bezier(.2, .9, .3, 1.4);
}
.checkmark.is-on {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-fg);
}
.checkmark svg { width: 16px; height: 16px; }

/* ============================================================
   HOME
============================================================ */
.hero { display: flex; align-items: flex-start; justify-content: space-between; padding: 8px 0 4px; }
.hero h1 { font: 600 28px/1.1 var(--font-display); margin: 6px 0 0; letter-spacing: -0.02em; }
.hero__avatars { display: flex; gap: -4px; }

.avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  display: grid; place-items: center;
  font-weight: 600; font-size: 14px;
  color: white;
  border: 2px solid var(--bg);
  margin-left: -8px;
}
.avatar:first-child { margin-left: 0; }
.avatar--sm { width: 28px; height: 28px; font-size: 12px; }
.avatar--1 { background: var(--accent); }
.avatar--2 { background: var(--accent-2); }

.metric__label { font-size: 11px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--fg-mute); margin: 0 0 4px; }
.metric__value { font: 600 36px/1 var(--font-display); margin: 0; letter-spacing: -0.03em; font-feature-settings: "tnum"; }
.metric__value--sm { font-size: 28px; }
.metric__value .currency { font-size: 0.55em; vertical-align: 0.6em; margin-right: 2px; color: var(--fg-mute); }
.metric__value .cents { font-size: 0.55em; vertical-align: 0.6em; color: var(--fg-mute); }
.metric__value .pct { font-size: 0.5em; vertical-align: 0.4em; color: var(--fg-mute); margin-left: 2px; }
.metric__delta { font-size: 12px; margin: 4px 0 0; font-weight: 500; }
.delta--down { color: var(--positive); }
.metric__sub { font-size: 12px; color: var(--fg-mute); margin: 4px 0 0; }

.card--stat { display: block; text-align: left; position: relative; min-height: 96px; transition: transform 160ms ease; }
.card--stat:active { transform: scale(0.97); }
.card--stat .ring { position: absolute; top: 16px; right: 16px; }
.card--metric { padding: 18px 20px; }
.spark { display: block; }

.card--insight { background: var(--insight-bg); border: 1px solid var(--insight-line); }
.insight__tag {
  display: inline-block;
  font-size: 10px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 4px 8px;
  border-radius: 999px;
  margin-bottom: 10px;
}
.insight__body { margin: 0 0 14px; font-size: 14px; line-height: 1.5; }
.insight__actions { display: flex; gap: 8px; }
.insight__actions .btn { padding: 9px 16px; font-size: 13px; }

.lowlist { display: flex; flex-direction: column; gap: 8px; }

.cat-dot {
  width: 36px; height: 36px;
  background: var(--cat-bg);
  border-radius: 12px;
  display: grid; place-items: center;
  font-size: 16px;
  color: var(--fg);
  flex-shrink: 0;
}
.cat-dot--lg { width: 64px; height: 64px; border-radius: 20px; font-size: 28px; }

.stockbar {
  width: 60px; height: 6px;
  background: var(--track);
  border-radius: 999px;
  overflow: hidden;
}
.stockbar__fill {
  height: 100%;
  background: var(--accent);
  border-radius: 999px;
  transition: width 400ms cubic-bezier(.2, .9, .3, 1.1);
}

.activity { display: flex; flex-direction: column; gap: 4px; }
.activity__row {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 4px;
  border-bottom: 1px solid var(--rule);
}
.activity__row:last-child { border-bottom: 0; }
.activity__row--tap { cursor: pointer; background: none; border: none; }
.activity__row--tap:active { opacity: 0.7; }
.activity__item-link { background: none; border: none; padding: 0; font: inherit; font-weight: 600; color: var(--fg); cursor: pointer; }
.activity__item-link:active { opacity: 0.6; }
.activity__row--undone .activity__title,
.activity__row--undone .activity__price { text-decoration: line-through; color: var(--fg-mute); }
.activity__body { flex: 1 1; }
.activity__title { margin: 0; font-size: 14px; font-weight: 500; }
.activity__date { margin: 2px 0 0; font-size: 11px; color: var(--fg-mute); }
.activity__price { margin: 0; font-weight: 600; font-feature-settings: "tnum"; }

/* ============================================================
   STOCK
============================================================ */
.searchbox {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px;
  background: var(--card-bg);
  border: 1px solid var(--card-line);
  border-radius: 16px;
  color: var(--fg-mute);
}
.searchbox input { flex: 1 1; font-size: 15px; }
.searchbox svg { width: 18px; height: 18px; }

.chips {
  display: flex; gap: 6px;
  overflow-x: auto;
  padding: 0 4px 2px;
  margin: 0 -20px;
  padding-left: 20px; padding-right: 20px;
  scrollbar-width: none;
}
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex-shrink: 0;
  padding: 8px 14px;
  background: var(--card-bg);
  border: 1px solid var(--card-line);
  border-radius: 999px;
  font-size: 13px;
  font-weight: 500;
  color: var(--fg-mute);
  transition: background 180ms ease, color 180ms ease, border-color 180ms ease;
}
.chip.is-on { background: var(--fg); color: var(--bg); border-color: var(--fg); }

.stocklist { display: flex; flex-direction: column; gap: 6px; }

.stockrow__right { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.stockrow__days { font-size: 12px; font-weight: 600; color: var(--fg-mute); font-feature-settings: "tnum"; }

/* ============================================================
   ITEM DETAIL
============================================================ */
.detail__photo { border-radius: var(--radius-card); overflow: hidden; margin-bottom: 8px; aspect-ratio: 4/3; border: none; padding: 0; background: none; cursor: pointer; width: 100%; display: block; }
.detail__photo:active { opacity: 0.8; }
.detail__photo img { width: 100%; height: 100%; object-fit: cover; }
.detail__hero {
  display: flex; flex-direction: column; align-items: center;
  text-align: center;
  padding: 8px 0 16px;
}
.detail__name { font: 600 28px/1.15 var(--font-display); margin: 12px 0 4px; letter-spacing: -0.02em; }
.detail__variant { font: 400 15px/1.3 var(--font-sans); color: var(--fg-mute); margin: 0 0 2px; }
.detail__loc { color: var(--fg-mute); margin: 0; font-size: 13px; }

.detail__stockbox {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 20px;
  background: var(--card-bg);
  border: 1px solid var(--card-line);
  border-radius: var(--radius-card);
}
.bigstock { font: 600 40px/1 var(--font-display); margin: 4px 0 0; letter-spacing: -0.03em; font-feature-settings: "tnum"; }
.bigstock__sub { color: var(--fg-mute); font-size: 12px; margin: 6px 0 0; }
.detail__stocknum { flex: 1 1; min-width: 0; }
.detail__steppers { display: flex; gap: 8px; align-items: center; flex-shrink: 0; }
.stepper {
  width: 56px; height: 40px;
  display: flex; align-items: center; justify-content: center;
  background: var(--accent-soft);
  color: var(--accent);
  border: 1.5px solid var(--accent);
  border-radius: 12px;
  font-weight: 700;
  font-size: 14px;
  font-feature-settings: "tnum";
  transition: transform 160ms ease;
}
.stepper:active { transform: scale(0.92); }

.cons__legend { display: flex; justify-content: space-between; margin-top: 12px; font-size: 13px; }
.conschart { display: block; }

.target-card { display: flex; flex-direction: column; gap: 12px; }
.target-card__row { display: flex; align-items: center; justify-content: space-between; }
.target-num { font: 600 18px/1 var(--font-display); font-feature-settings: "tnum"; }
.target-num--input {
  background: none; border: none; outline: none; padding: 0;
  width: 3ch; text-align: right; color: inherit;
  -moz-appearance: textfield;
}
.target-num--input::-webkit-inner-spin-button,
.target-num--input::-webkit-outer-spin-button { -webkit-appearance: none; }

.slider { position: relative; height: 28px; }
.slider__track {
  position: absolute; top: 12px; left: 0; right: 0;
  height: 4px; background: var(--track); border-radius: 999px;
}
.slider__fill {
  position: absolute; top: 12px; left: 0;
  height: 4px; background: var(--accent); border-radius: 999px;
}
.slider__thumb {
  position: absolute; top: 4px;
  width: 20px; height: 20px;
  background: white;
  border-radius: 50%;
  box-shadow: 0 2px 6px rgba(20,14,8,0.18);
  border: 2px solid var(--accent);
}

.slider-input {
  width: 100%;
  height: 28px;
  -webkit-appearance: none;
  -moz-appearance: none;
       appearance: none;
  background: transparent;
  cursor: pointer;
}
.slider-input::-webkit-slider-track {
  height: 4px;
  background: var(--track);
  border-radius: 999px;
}
.slider-input::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 20px; height: 20px;
  background: white;
  border-radius: 50%;
  box-shadow: 0 2px 6px rgba(20,14,8,0.18);
  border: 2px solid var(--accent);
  margin-top: -8px;
}
.slider-input::-moz-range-track {
  height: 4px;
  background: var(--track);
  border-radius: 999px;
  border: none;
}
.slider-input::-moz-range-thumb {
  width: 20px; height: 20px;
  background: white;
  border-radius: 50%;
  box-shadow: 0 2px 6px rgba(20,14,8,0.18);
  border: 2px solid var(--accent);
}

.prep-tags { display: flex; flex-wrap: wrap; gap: 8px; }
.prep-tag {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 12px;
  background: var(--accent-soft);
  color: var(--accent);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}
.prep-tag svg { width: 14px; height: 14px; }

.lastbought p { margin: 0; }
.lastbought__price { font: 600 22px/1 var(--font-display); font-feature-settings: "tnum"; }
.lastbought__detail { margin-top: 6px; font-size: 13px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.lastbought-card { width: 100%; text-align: left; cursor: pointer; border: none; }
.lastbought-card:active { opacity: 0.7; }

.price-compare { display: flex; flex-direction: column; gap: 12px; padding: 18px; }
.price-compare > .sechdr { margin: 0; }
.price-bars { display: flex; flex-direction: column; gap: 10px; }
.price-bar {
  display: flex; flex-direction: column; gap: 6px;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid var(--card-line);
  background: var(--bg);
  transition: border-color 200ms ease;
}
.price-bar.is-cheap { border-color: var(--accent); background: var(--accent-soft); }
.price-bar__head { display: flex; align-items: center; gap: 10px; }
.price-bar__store { font: 600 14px/1 var(--font-sans); margin: 0; }
.price-bar__brand { font-size: 11px; color: var(--fg-mute); margin: 2px 0 0; }
.price-bar__head > div { flex: 1 1; }
.price-bar__price { margin: 0; font: 600 16px/1 var(--font-display); font-feature-settings: "tnum"; }
.price-bar__unit { font-size: 11px; color: var(--fg-mute); font-weight: 400; }
.price-bar__track { height: 4px; background: var(--track); border-radius: 999px; overflow: hidden; }
.price-bar__fill { height: 100%; background: var(--accent); border-radius: 999px; transition: width 500ms cubic-bezier(.2,.9,.3,1.1); }
.price-compare__note { font-size: 13px; margin: 4px 0 0; color: var(--fg-mute); }

/* ============================================================
   PREP
============================================================ */
.scenarios {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  grid-gap: 8px;
  gap: 8px;
}
.scenario {
  position: relative;
  background: var(--card-bg);
  border: 1px solid var(--card-line);
  border-radius: var(--radius-card);
  padding: 14px 12px;
  display: flex; flex-direction: column; align-items: flex-start; gap: 4px;
  transition: border-color 200ms ease, background 200ms ease, transform 160ms ease;
}
.scenario:active { transform: scale(0.97); }
.scenario.is-on { border-color: var(--accent); background: var(--accent-soft); }
.scenario__icon { font-size: 22px; }
.scenario__name { font: 600 13px/1.2 var(--font-sans); margin: 4px 0 0; }
.scenario__sub { font-size: 11px; color: var(--fg-mute); margin: 0; }
.scenario--add { color: var(--fg-mute); border-style: dashed; }
.scenario__edit {
  position: absolute; top: 8px; right: 8px;
  width: 28px; height: 28px;
  display: flex; align-items: center; justify-content: center;
  background: var(--card-bg); border-radius: 50%;
  color: var(--fg-mute); opacity: 0.7;
  border: 1px solid var(--card-line);
}

.readiness {
  background: var(--card-bg);
  border: 1px solid var(--card-line);
  border-radius: var(--radius-card);
  padding: 20px;
}
.readiness__top { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.readiness__title { font: 600 32px/1 var(--font-display); margin: 8px 0; letter-spacing: -0.02em; font-feature-settings: "tnum"; }
.ring__text { fill: var(--fg); font: 600 14px var(--font-sans); font-feature-settings: "tnum"; }

.prep-list { display: flex; flex-direction: column; gap: 8px; }
.preprow__missing {
  font: 700 14px/1 var(--font-display);
  color: var(--accent);
  font-feature-settings: "tnum";
}

.prep-explainer {
  padding: 16px;
  border: 1px dashed var(--card-line);
  border-radius: var(--radius-card);
}
.explainer__title { font: 600 13px/1 var(--font-sans); margin: 0 0 6px; }

/* ============================================================
   BOTTOM SHEET
============================================================ */
.sheet {
  position: fixed;
  inset: 0;
  background: rgba(20, 14, 8, 0);
  z-index: 30;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  pointer-events: none;
  transition: background 280ms ease;
}
.sheet.is-open { background: rgba(20, 14, 8, 0.4); pointer-events: auto; }
.sheet__panel {
  background: var(--bg);
  border-radius: 32px 32px 0 0;
  padding: 14px 20px 32px;
  padding-bottom: calc(32px + env(safe-area-inset-bottom, 0px));
  transform: translateY(100%);
  transition: transform 360ms cubic-bezier(.2, .9, .3, 1.1);
  box-shadow: 0 -10px 40px -10px rgba(20,14,8,0.2);
  max-width: 600px;
  margin: 0 auto;
  width: 100%;
  max-height: 85vh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.sheet.is-open .sheet__panel { transform: translateY(0); }
.sheet__handle {
  width: 40px; height: 4px;
  background: var(--rule);
  border-radius: 999px;
  margin: 0 auto 16px;
}
.sheet__title { font: 600 22px/1 var(--font-display); margin: 0 0 16px; letter-spacing: -0.02em; }

.bigopt {
  display: flex; align-items: center; gap: 14px;
  width: 100%;
  padding: 16px;
  background: var(--card-bg);
  border-radius: var(--radius-card);
  border: 1px solid var(--card-line);
  margin-bottom: 8px;
  transition: transform 160ms ease;
}
.bigopt:active { transform: scale(0.98); }
.bigopt__icon {
  width: 48px; height: 48px;
  background: var(--accent-soft);
  color: var(--accent);
  border-radius: 16px;
  display: grid; place-items: center;
  flex-shrink: 0;
}
.bigopt__icon svg { width: 22px; height: 22px; }
.bigopt > div { flex: 1 1; }
.bigopt__title { font: 600 15px/1.2 var(--font-sans); margin: 0; }
.bigopt__sub { font-size: 12px; color: var(--fg-mute); margin: 3px 0 0; }
.bigopt__chev svg { width: 18px; height: 18px; color: var(--fg-mute); }

/* ============================================================
   RECEIPT FLOW
============================================================ */
.overlay {
  position: fixed; inset: 0;
  background: var(--bg);
  z-index: 40;
  display: flex; flex-direction: column;
  overflow-y: auto;
  animation: slide-up 320ms cubic-bezier(.2, .9, .3, 1.1);
}
@keyframes slide-up { from { transform: translateY(40px); opacity: 0.5; } to { transform: translateY(0); opacity: 1; } }

.receipt-cap {
  position: fixed; inset: 0;
  background: #0c0a08;
  display: flex; flex-direction: column;
  color: #f5ede0;
  z-index: 41;
}
.receipt-cap__viewfinder {
  flex: 1 1;
  position: relative;
  margin: 60px 32px 24px;
  border-radius: 20px;
  overflow: hidden;
  display: flex; align-items: center; justify-content: center;
}
.receipt-cap__paper {
  position: relative;
  width: 70%;
  background: #faf2e2;
  padding: 24px 18px;
  display: flex; flex-direction: column; gap: 10px;
  transform: rotate(-2deg);
  box-shadow: 0 20px 50px -10px rgba(0,0,0,0.5);
}
.paper__line, .parse__line {
  height: 6px; background: #2b1d05; opacity: 0.55; border-radius: 1px;
}
.paper__line.t { height: 8px; opacity: 0.8; }
.w-40 { width: 40%; } .w-45 { width: 45%; } .w-50 { width: 50%; }
.w-55 { width: 55%; } .w-60 { width: 60%; } .w-65 { width: 65%; }
.w-70 { width: 70%; } .w-75 { width: 75%; } .w-80 { width: 80%; } .w-90 { width: 90%; }

.cap-corner {
  position: absolute;
  width: 28px; height: 28px;
  border: 3px solid var(--accent);
}
.cap-corner--tl { top: 12px; left: 12px; border-right: 0; border-bottom: 0; border-radius: 8px 0 0 0; }
.cap-corner--tr { top: 12px; right: 12px; border-left: 0; border-bottom: 0; border-radius: 0 8px 0 0; }
.cap-corner--bl { bottom: 12px; left: 12px; border-right: 0; border-top: 0; border-radius: 0 0 0 8px; }
.cap-corner--br { bottom: 12px; right: 12px; border-left: 0; border-top: 0; border-radius: 0 0 8px 0; }

.cap-scanline {
  position: absolute;
  left: 12px; right: 12px;
  height: 2px;
  background: var(--accent);
  box-shadow: 0 0 12px var(--accent);
  animation: scan 2.4s ease-in-out infinite;
}
@keyframes scan { 0%, 100% { top: 16%; } 50% { top: 84%; } }

.receipt-cap__caption { text-align: center; padding: 12px 0; }
.receipt-cap__caption .muted { color: rgba(255,255,255,0.6); font-size: 13px; }
.receipt-cap__bar {
  display: flex; align-items: center; justify-content: space-around;
  padding: 24px 32px calc(48px + env(safe-area-inset-bottom, 0px));
}
.receipt-cap__bar .iconbtn { background: rgba(255,255,255,0.12); color: #f5ede0; }
.capture-btn {
  width: 72px; height: 72px;
  border-radius: 50%;
  background: white;
  box-shadow: 0 0 0 4px rgba(255,255,255,0.3);
  transition: transform 160ms ease;
}
.capture-btn:active { transform: scale(0.92); }

.receipt-parse {
  flex: 1 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 18px; padding: 24px; text-align: center;
}
.parse__paper {
  width: 220px;
  background: var(--card-bg);
  border: 1px solid var(--card-line);
  padding: 20px 18px;
  display: flex; flex-direction: column; gap: 10px;
  border-radius: 12px;
  position: relative;
  overflow: hidden;
}
.parse__shimmer {
  position: absolute;
  width: 220px; height: 60px;
  background: linear-gradient(90deg, transparent, var(--accent-soft), transparent);
  animation: shim 1.6s ease-in-out infinite;
  pointer-events: none;
}
@keyframes shim { 0% { transform: translateY(-60px); } 100% { transform: translateY(220px); } }
.parse__title { font: 600 18px/1 var(--font-display); margin: 0; }

.receipt-summary {
  display: flex; align-items: flex-end; justify-content: space-between;
  padding: 16px 0;
  border-bottom: 1px solid var(--rule);
}
.receipt-total { font: 600 32px/1 var(--font-display); margin: 4px 0 0; letter-spacing: -0.03em; font-feature-settings: "tnum"; }

.receipt-lines { display: flex; flex-direction: column; gap: 8px; }
.rline {
  background: var(--card-bg);
  border: 1px solid var(--card-line);
  border-radius: var(--radius-card);
  padding: 14px 16px;
  display: flex; flex-direction: column; gap: 8px;
}
.rline.is-new { border-color: var(--accent); background: var(--accent-soft); }
.rline__top { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.rline__name { font-weight: 600; font-size: 15px; margin: 0; }
.rline__price { font-weight: 600; font-feature-settings: "tnum"; margin: 0; }
.rline__bottom { display: flex; align-items: center; justify-content: space-between; }
.rline__qty { display: flex; align-items: center; gap: 10px; }
.rline__step {
  width: 28px; height: 28px;
  border-radius: 8px;
  background: var(--bg);
  border: 1px solid var(--card-line);
  font-weight: 700;
  display: grid; place-items: center;
}
.rline__qty span { font-weight: 600; font-feature-settings: "tnum"; min-width: 60px; text-align: center; }
.rline__unit { font-size: 12px; color: var(--fg-mute); margin: 0; font-feature-settings: "tnum"; }
.rline__suggestion { display: flex; align-items: center; gap: 8px; }
.newpill {
  font-size: 10px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase;
  background: var(--accent); color: var(--accent-fg);
  padding: 3px 7px; border-radius: 999px;
}
.rline__match { font-size: 12px; color: var(--accent); font-weight: 600; }

.receipt-foot {
  position: -webkit-sticky;
  position: sticky; bottom: 0;
  display: flex; gap: 8px;
  padding: 12px 0 calc(12px + env(safe-area-inset-bottom, 0px));
  margin-top: 8px;
  background: linear-gradient(to top, var(--bg) 70%, transparent);
}
.receipt-foot .btn--ghost { flex: 0 0 auto; padding: 18px 16px; }
.receipt-foot .btn--big { width: auto; }
.receipt-foot .btn--primary { flex: 1 1; }

/* ============================================================
   ITEM PICKER
============================================================ */
.item-picker__trigger {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  width: 100%;
  padding: 14px 16px;
  background: var(--card-bg);
  border: 1px solid var(--card-line);
  border-radius: 14px;
  font-size: 15px;
  color: var(--fg);
  text-align: left;
  cursor: pointer;
}
.item-picker__trigger svg { color: var(--fg-mute); flex-shrink: 0; }
.item-picker__text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item-picker__placeholder { color: var(--fg-mute); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item-picker {
  position: relative;
  border: 1px solid var(--accent);
  border-radius: 14px;
  background: var(--card-bg);
  overflow: hidden;
}
.item-picker__search {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--card-line);
  color: var(--fg-mute);
}
.item-picker__search input {
  flex: 1 1; font-size: 15px; border: none; background: none;
  color: var(--fg); outline: none;
}
.item-picker__list {
  max-height: 200px; overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.item-picker__option {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  width: 100%;
  padding: 12px 14px;
  font-size: 14px;
  color: var(--fg);
  text-align: left;
  border: none; background: none;
  cursor: pointer;
}
.item-picker__option:active { background: var(--accent-bg); }
.item-picker__option--selected { background: var(--accent-bg); font-weight: 600; }
.item-picker__option--clear { color: var(--fg-mute); font-style: italic; border-bottom: 1px solid var(--card-line); }
.item-picker__name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item-picker__meta { font-size: 12px; color: var(--fg-mute); white-space: nowrap; flex-shrink: 0; }
.item-picker__empty { padding: 16px; text-align: center; color: var(--fg-mute); font-size: 14px; }
.item-picker__option--create { color: var(--accent); font-weight: 600; gap: 6px; }
.item-picker__option--create svg { width: 14px; height: 14px; }

/* ============================================================
   TOAST
============================================================ */
.toast {
  position: fixed;
  bottom: 110px;
  left: 50%;
  transform: translate(-50%, 20px);
  display: flex; align-items: center; gap: 10px;
  padding: 12px 18px;
  background: var(--fg);
  color: var(--bg);
  border-radius: 999px;
  font-weight: 600; font-size: 14px;
  opacity: 0;
  transition: transform 320ms cubic-bezier(.2, .9, .3, 1.1), opacity 220ms ease;
  pointer-events: none;
  box-shadow: 0 10px 30px -8px rgba(20,14,8,0.3);
  z-index: 50;
  white-space: nowrap;
}
.toast.is-on { opacity: 1; transform: translate(-50%, 0); }
.toast--error { background: #c0392b; color: #fff; }
.toast__icon { display: grid; place-items: center; }
.toast__icon svg { width: 16px; height: 16px; }

/* ============================================================
   STORE CHIPS
============================================================ */
.store-chip {
  display: inline-flex; align-items: center; justify-content: center;
  width: 26px; height: 26px;
  border-radius: 8px;
  font-weight: 700;
  font-size: 12px;
  color: white;
  flex-shrink: 0;
}
.store-chip--lg { width: 38px; height: 38px; border-radius: 12px; font-size: 16px; }
.store-chip--xs { width: 18px; height: 18px; border-radius: 6px; font-size: 10px; }
.store-chip--green  { background: #5b8a3d; }
.store-chip--blue   { background: #3a6fa8; }
.store-chip--yellow { background: #c79a2a; color: #2b1d05; }
.store-chip--red    { background: #b2493a; }
.store-chip--rose   { background: #a85066; }

/* ============================================================
   SEGMENTED CONTROL
============================================================ */
.seg {
  display: flex;
  background: var(--track);
  border-radius: 12px;
  padding: 3px;
  gap: 2px;
}
.seg__btn {
  flex: 1 1;
  padding: 8px 10px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  color: var(--fg-mute);
  transition: background 180ms ease, color 180ms ease;
}
.seg__btn.is-on { background: var(--card-bg); color: var(--fg); box-shadow: 0 1px 3px rgba(20,14,8,0.08); }

/* ============================================================
   PROGRESS
============================================================ */
.progressbar {
  flex: 1 1;
  height: 6px;
  background: var(--track);
  border-radius: 999px;
  overflow: hidden;
}
.progressbar__fill {
  height: 100%;
  background: var(--accent);
  border-radius: 999px;
  transition: width 400ms cubic-bezier(.2, .9, .3, 1.1);
}

/* ============================================================
   EXTRAS — Settings, Lists hub, AI, Product editor, Privacy
============================================================ */
.small-help { font-size: 12px; padding: 0 4px; margin: -4px 0 0; }

.ai-banner {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 16px;
  background: var(--accent-soft);
  border: 1px solid var(--accent);
  border-radius: var(--radius-card);
  width: 100%;
  text-align: left;
  transition: transform 160ms ease;
}
.ai-banner:active { transform: scale(0.98); }
.ai-banner__icon {
  width: 36px; height: 36px;
  display: grid; place-items: center;
  background: var(--accent);
  color: var(--accent-fg);
  border-radius: 12px;
  font-size: 18px;
}
.ai-banner__title { margin: 0; font: 600 14px/1 var(--font-sans); color: var(--accent); }
.ai-banner__sub { margin: 4px 0 0; font-size: 12px; color: var(--fg-mute); }

/* Lists hub */
.lists-active__btn {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 20px;
  background: var(--fg);
  color: var(--bg);
  border-radius: var(--radius-card);
  width: 100%;
  transition: transform 160ms ease;
}
.lists-active__btn:active { transform: scale(0.98); }
.lists-active__name { font: 600 22px/1.1 var(--font-display); margin: 6px 0 0; letter-spacing: -0.02em; }
.lists-active__sub { margin: 4px 0 0; font-size: 12px; opacity: 0.7; }
.lists-active__btn .eyebrow { color: var(--bg); opacity: 0.55; }
.lists-active__chev { opacity: 0.6; }
.lists-active__chev svg { width: 20px; height: 20px; }

.quickstart { display: grid; grid-template-columns: 1fr 1fr 1fr; grid-gap: 8px; gap: 8px; }
.quickstart__btn {
  display: flex; flex-direction: column; align-items: flex-start; gap: 6px;
  padding: 14px;
  background: var(--card-bg);
  border: 1px solid var(--card-line);
  border-radius: var(--radius-card);
  font-size: 12px; font-weight: 600;
  min-height: 78px;
  transition: transform 160ms ease;
}
.quickstart__btn:active { transform: scale(0.96); }
.quickstart__icon {
  width: 28px; height: 28px;
  display: grid; place-items: center;
  background: var(--accent-soft);
  color: var(--accent);
  border-radius: 8px;
  font-size: 14px;
}
.quickstart__icon svg { width: 14px; height: 14px; }

.templates { display: grid; grid-template-columns: 1fr 1fr; grid-gap: 10px; gap: 10px; }
.template {
  background: var(--card-bg);
  border: 1px solid var(--card-line);
  border-radius: var(--radius-card);
  padding: 14px;
  text-align: left;
  display: flex; flex-direction: column; gap: 4px;
  min-height: 130px;
  transition: transform 160ms ease;
}
.template:active { transform: scale(0.97); }
.template__top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 4px; }
.template__icon { font-size: 22px; }
.template__count { font-size: 10px; font-weight: 600; color: var(--fg-mute); letter-spacing: 0.06em; text-transform: uppercase; }
.template__name { font: 600 16px/1.1 var(--font-display); margin: 0; letter-spacing: -0.01em; }
.template__sub { font-size: 11px; color: var(--fg-mute); margin: 2px 0 4px; }
.template__sample { font-size: 11px; color: var(--fg-mute); margin: auto 0 0; line-height: 1.4; }

.historyrow {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 4px;
  border-bottom: 1px solid var(--rule);
}
.historyrow:last-child { border-bottom: 0; }
.historyrow__name { margin: 0; font-weight: 500; font-size: 14px; }
.historyrow__name--link { background: none; border: none; padding: 0; text-align: left; cursor: pointer; color: inherit; }
.historyrow__name--link:active { opacity: 0.6; }
.historyrow__sub { margin: 2px 0 0; font-size: 11px; color: var(--fg-mute); }
.historyrow__price { margin: 0; font-weight: 600; font-feature-settings: "tnum"; }

/* Settings */
.profile-card {
  display: flex; align-items: center; gap: 14px;
  padding: 16px;
  background: var(--card-bg);
  border: 1px solid var(--card-line);
  border-radius: var(--radius-card);
}
.profile-card__avatars { display: flex; }
.profile-card__avatars .avatar:first-child { margin-left: 0; }
.profile-card__name { font: 600 18px/1.1 var(--font-display); margin: 0; }

.settings-list { display: flex; flex-direction: column; gap: 4px; }
.settings-row__icon {
  width: 36px; height: 36px;
  display: grid; place-items: center;
  background: var(--accent-soft);
  color: var(--accent);
  border-radius: 10px;
  flex-shrink: 0;
}
.settings-row__icon svg { width: 18px; height: 18px; }
.settings-foot { text-align: center; font-size: 11px; padding: 16px 0; }
.settings-household-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; background: var(--card-bg); border-radius: 14px; }
.settings-household-row__info { display: flex; flex-direction: column; gap: 2px; }
.settings-household-row__name { font-size: 15px; font-weight: 500; color: var(--fg); }
/* Store detail */
.store-detail__hero { display: flex; align-items: center; gap: 14px; padding: 12px 16px 16px; }
.store-detail__name { font-size: 20px; font-weight: 700; }
.store-items { display: flex; flex-direction: column; gap: 4px; }
.store-item { background: var(--card-bg); border-radius: 14px; overflow: hidden; }
.store-item__row { width: 100%; display: flex; align-items: center; gap: 10px; padding: 12px 14px; text-align: left; }
.store-item__info { flex: 1 1; display: flex; flex-direction: column; gap: 1px; overflow: hidden; }
.store-item__name { font-size: 15px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.store-item__price { display: flex; align-items: baseline; gap: 2px; }
.store-item__price-val { font-size: 16px; font-weight: 600; color: var(--fg); }
.store-item__unit { font-size: 12px; }
.store-item__history { border-top: 1px solid var(--border); padding: 8px 14px 10px; display: flex; flex-direction: column; gap: 6px; }
.store-item__hist-row { display: flex; align-items: center; gap: 8px; }
.store-item__hist-row > :first-child { flex: 1 1; }
.store-item__hist-price { font-size: 13px; font-weight: 600; color: var(--accent); }
.hist-row--cancelled { opacity: 0.45; text-decoration: line-through; }

/* Item history rows */
.item-hist { display: flex; flex-direction: column; gap: 10px; border-top: 1px solid var(--rule); padding-top: 10px; }
.item-hist__row { display: flex; align-items: center; gap: 10px; }
.item-hist__icon { display: flex; align-items: center; justify-content: center; width: 26px; height: 26px; border-radius: 50%; flex-shrink: 0; }
.item-hist__icon--buy { background: color-mix(in srgb, var(--green, #38a169) 15%, transparent); color: var(--green, #38a169); }
.item-hist__icon--consume { background: color-mix(in srgb, var(--red, #e53e3e) 15%, transparent); color: var(--red, #e53e3e); }
.item-hist__main { flex: 1 1; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.item-hist__top { display: flex; align-items: center; gap: 6px; }
.item-hist__store { font-size: 13px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item-hist__by { font-size: 11px; color: var(--fg-mute); white-space: nowrap; }
.item-hist__date { font-size: 11px; color: var(--fg-mute); }
.item-hist__right { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; flex-shrink: 0; }
.item-hist__qty { font-size: 13px; font-weight: 600; font-feature-settings: "tnum"; }
.item-hist__qty--buy { color: var(--green, #38a169); }
.item-hist__qty--consume { color: var(--red, #e53e3e); }
.item-hist__price { font-size: 11px; color: var(--fg-mute); }

/* Quick consume inline row */
.consume-inline { display: flex; align-items: center; gap: 8px; padding: 8px 16px 12px; background: var(--card-bg); border-radius: 0 0 14px 14px; margin-top: -4px; }
.consume-inline__label { font-size: 13px; color: var(--fg-mute); white-space: nowrap; }
.consume-inline__input { width: 64px; padding: 6px 8px; border-radius: 8px; border: 1.5px solid var(--border); background: var(--bg); color: var(--fg); font-size: 15px; text-align: center; }
.consume-inline__unit { font-size: 13px; color: var(--fg-mute); }

/* Product editor */
.prodimg { display: flex; flex-direction: column; gap: 12px; }
.prodimg__frame {
  aspect-ratio: 4 / 3;
  background: var(--card-bg);
  border: 1px dashed var(--card-line);
  border-radius: var(--radius-card);
  display: grid; place-items: center;
  overflow: hidden;
  transition: border-style 200ms ease, background 200ms ease;
}
.prodimg__frame.has-img { border-style: solid; background: var(--accent-soft); }
.prodimg__frame--drag { border-color: var(--accent); border-style: solid; background: color-mix(in srgb, var(--accent) 10%, transparent); }
.prodimg__empty {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  color: var(--fg-mute);
  font-size: 13px; font-weight: 600;
}
.prodimg__empty svg { width: 32px; height: 32px; color: var(--accent); }
.prodimg__empty p { margin: 0; }
.prodimg__upload {
  display: flex; flex-direction: column; align-items: center; gap: 12px;
  font-size: 13px;
}
.upload-spinner {
  width: 36px; height: 36px;
  border: 3px solid var(--track);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 800ms linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Loading skeleton */
.loading-skeleton { padding: 20px 16px; display: flex; flex-direction: column; gap: 14px; }
.skel { border-radius: 10px; background: linear-gradient(90deg, var(--card-bg) 25%, color-mix(in srgb, var(--fg) 6%, var(--card-bg)) 50%, var(--card-bg) 75%); background-size: 200% 100%; animation: shimmer 1.5s infinite ease-in-out; }
.skel--header { height: 22px; width: 45%; border-radius: 6px; }
.skel--card { height: 80px; }
.skel--card.skel--sm { height: 48px; }
.skel--dot { width: 32px; height: 32px; border-radius: 50%; flex-shrink: 0; }
.skel--line { height: 14px; flex: 1 1; border-radius: 6px; }
.skel--short { height: 14px; width: 50px; border-radius: 6px; }
.skel-row { display: flex; align-items: center; gap: 12px; }
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }
.prodimg__photo { width: 100%; height: 100%; object-fit: cover; }
.prodimg__placeholder {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  font-size: 12px;
}
.prodimg__actions { display: flex; gap: 8px; }

.privacy-note {
  display: flex; align-items: flex-start; gap: 8px;
  padding: 10px 12px;
  background: var(--accent-soft);
  border-radius: 12px;
  font-size: 11px;
  color: var(--fg);
  margin: 0;
  line-height: 1.5;
}
.privacy-note svg { width: 14px; height: 14px; flex-shrink: 0; margin-top: 2px; color: var(--accent); }

.formgrid { display: flex; flex-direction: column; gap: 4px; }
.ai-hint { background: color-mix(in srgb, var(--accent) 10%, transparent); border-radius: 10px; padding: 10px 14px; font-size: 13px; }
.group-stock-card { padding: 14px 16px; }
.field {
  padding: 12px 16px;
  background: var(--card-bg);
  border: 1px solid var(--card-line);
  border-radius: 14px;
}
.field__label { font-size: 11px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--fg-mute); margin: 0; }
.field__value {
  display: flex; align-items: center; justify-content: space-between;
  margin-top: 4px;
  font-size: 15px; font-weight: 500;
}
.field__value svg { width: 14px; height: 14px; }

.storeprice { font: 600 14px/1 var(--font-display); margin: 0; font-feature-settings: "tnum"; }
.danger { color: #b54a2c !important; }

/* Storage / R2 */
.storage-card {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 18px;
  background: var(--card-bg);
  border: 1px solid var(--card-line);
  border-radius: var(--radius-card);
}
.storage-card > div:first-child { flex: 1 1; }
.storage-card__value { font: 600 28px/1 var(--font-display); margin: 4px 0 8px; letter-spacing: -0.02em; font-feature-settings: "tnum"; }
.storage-card__r2 {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  text-align: center; font-size: 12px; font-weight: 600;
  padding: 12px;
  background: var(--accent-soft);
  border-radius: 14px;
  min-width: 100px;
}
.storage-card__r2 svg { width: 24px; height: 24px; color: var(--accent); }
.storage-card__r2 p { margin: 0; line-height: 1.3; }

.privacy-banner {
  display: flex; gap: 12px;
  padding: 14px 16px;
  background: var(--accent-soft);
  border: 1px solid var(--accent);
  border-radius: var(--radius-card);
  font-size: 12px;
  line-height: 1.5;
}
.privacy-banner svg { width: 20px; height: 20px; color: var(--accent); flex-shrink: 0; margin-top: 2px; }
.privacy-banner__title { font: 600 14px/1 var(--font-sans); margin: 0 0 4px; color: var(--accent); }
.privacy-banner p { margin: 0; }

.photogrid { display: grid; grid-template-columns: 1fr 1fr 1fr; grid-gap: 8px; gap: 8px; }
.photo-tile {
  aspect-ratio: 1;
  background: var(--card-bg);
  border: 1px solid var(--card-line);
  border-radius: 12px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  padding: 8px;
  text-align: center;
}
.photo-tile__name { margin: 0; font-size: 10px; font-weight: 500; color: var(--fg-mute); line-height: 1.2; }

/* Privacy screen */
.privacy-hero { text-align: center; padding: 16px 0; }
.privacy-hero__icon {
  width: 56px; height: 56px;
  background: var(--accent-soft);
  color: var(--accent);
  border-radius: 50%;
  display: inline-grid; place-items: center;
  margin-bottom: 12px;
}
.privacy-hero__icon svg { width: 26px; height: 26px; }
.privacy-hero h2 { font: 600 22px/1.2 var(--font-display); margin: 0 0 6px; letter-spacing: -0.02em; }
.privacy-hero p { margin: 0; }

.privacy-toggle {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px;
  background: var(--card-bg);
  border: 1px solid var(--card-line);
  border-radius: 14px;
}

.switch {
  width: 44px; height: 26px;
  background: var(--track);
  border-radius: 999px;
  position: relative;
  transition: background 200ms ease;
  flex-shrink: 0;
}
.switch.is-on { background: var(--accent); }
.switch__thumb {
  position: absolute;
  top: 3px; left: 3px;
  width: 20px; height: 20px;
  background: white;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
  transition: transform 200ms cubic-bezier(.2, .9, .3, 1.4);
}
.switch.is-on .switch__thumb { transform: translateX(18px); }

/* AI screen */
.ai-screen { padding-bottom: 110px; }
.ai-title { display: flex; align-items: center; gap: 10px; }
.ai-avatar {
  width: 36px; height: 36px;
  background: var(--accent);
  color: var(--accent-fg);
  border-radius: 50%;
  display: grid; place-items: center;
}
.ai-avatar svg { width: 20px; height: 20px; }
.ai-clear-btn {
  display: flex; align-items: center; gap: 5px;
  padding: 5px 10px; border-radius: 8px;
  background: color-mix(in srgb, var(--fg) 8%, transparent);
  border: none; color: var(--fg-mute);
  font-size: 11px; font-weight: 600; cursor: pointer;
  white-space: nowrap;
}
.ai-clear-btn:active { opacity: 0.6; }
.ai-clear-btn svg { width: 14px; height: 14px; }

.ai-chips {
  display: flex; gap: 6px;
  overflow-x: auto;
  margin: 0 -20px;
  padding: 4px 20px;
  scrollbar-width: none;
}
.ai-chips::-webkit-scrollbar { display: none; }
.ai-chip {
  flex-shrink: 0;
  padding: 8px 14px;
  background: var(--card-bg);
  border: 1px solid var(--card-line);
  border-radius: 999px;
  font-size: 12px;
  color: var(--fg);
}

.ai-feed { display: flex; flex-direction: column; gap: 12px; padding: 4px 0; }
.bubble { display: flex; gap: 8px; max-width: 85%; }
.bubble--user { margin-left: auto; flex-direction: row-reverse; }
.bubble__avatar {
  width: 28px; height: 28px;
  background: var(--accent-soft);
  color: var(--accent);
  border-radius: 50%;
  display: grid; place-items: center;
  flex-shrink: 0;
}
.bubble__avatar svg { width: 14px; height: 14px; }
.bubble__body {
  background: var(--card-bg);
  border: 1px solid var(--card-line);
  border-radius: 16px;
  padding: 10px 14px;
  font-size: 14px;
  line-height: 1.5;
}
.bubble--user .bubble__body { background: var(--fg); color: var(--bg); border-color: var(--fg); }
.bubble__body p { margin: 0; }
.bubble__chip {
  margin-top: 8px;
  padding: 6px 10px;
  background: var(--accent-soft);
  color: var(--accent);
  border-radius: 999px;
  font-size: 12px; font-weight: 600;
  display: inline-block;
}
.bubble__actions { display: flex; gap: 6px; margin-top: 10px; }

/* AI action proposals */
.ai-actions { margin-top: 10px; border-radius: 10px; background: color-mix(in srgb, var(--accent) 8%, transparent); border: 1px solid color-mix(in srgb, var(--accent) 20%, transparent); padding: 10px; display: flex; flex-direction: column; gap: 6px; }
.ai-actions--done { background: color-mix(in srgb, var(--green, #38a169) 8%, transparent); border-color: color-mix(in srgb, var(--green, #38a169) 20%, transparent); }
.ai-action-row { display: flex; align-items: center; gap: 8px; }
.ai-action-row--fail { color: var(--red, #e53e3e); }
.ai-action-icon { display: flex; align-items: center; justify-content: center; width: 22px; height: 22px; border-radius: 6px; background: color-mix(in srgb, var(--accent) 12%, transparent); color: var(--accent); flex-shrink: 0; }
.ai-actions--done .ai-action-icon { background: color-mix(in srgb, var(--green, #38a169) 12%, transparent); color: var(--green, #38a169); }
.ai-action-row--fail .ai-action-icon { background: color-mix(in srgb, var(--red, #e53e3e) 12%, transparent); color: var(--red, #e53e3e); }
.ai-action-info { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.ai-action-label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; color: var(--fg-mute); }
.ai-action-detail { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ai-action-buttons { display: flex; gap: 8px; margin-top: 6px; }
.ai-pending-note { font-size: 11px; color: var(--fg-mute); margin: 4px 0 0; }
.ai-refused-note { font-size: 12px; color: var(--fg-mute); margin-top: 8px; padding: 8px 10px; border-radius: 8px; background: color-mix(in srgb, var(--orange, #ed8936) 8%, transparent); border: 1px solid color-mix(in srgb, var(--orange, #ed8936) 20%, transparent); }

.ai-composer {
  position: fixed;
  left: 16px; right: 16px;
  bottom: 80px;
  max-width: 568px;
  margin: 0 auto;
  display: flex; align-items: center; gap: 8px;
  padding: 8px 8px 8px 18px;
  background: var(--card-bg);
  border: 1px solid var(--card-line);
  border-radius: 28px;
  box-shadow: 0 8px 28px -10px rgba(20,14,8,0.16);
  z-index: 25;
}
.ai-composer input { flex: 1 1; font-size: 14px; padding: 10px 0; }
.ai-send {
  width: 40px; height: 40px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-fg);
  display: grid; place-items: center;
  flex-shrink: 0;
}
.ai-send svg { width: 18px; height: 18px; }

/* List edit */
.title-input {
  font: 600 22px/1.2 var(--font-display);
  letter-spacing: -0.02em;
  width: 100%;
  margin-top: 4px;
  padding: 4px 0;
  border-bottom: 1px solid var(--rule);
}
.empty-list {
  padding: 24px;
  text-align: center;
  border: 1px dashed var(--card-line);
  border-radius: var(--radius-card);
}
.ai-suggest {
  display: flex; align-items: center; gap: 12px;
  padding: 14px; width: 100%; text-align: left;
  background: var(--accent-soft);
  border: 1px dashed var(--accent);
  border-radius: var(--radius-card);
  cursor: pointer; color: inherit;
}
.ai-suggest:active { opacity: 0.7; }
.ai-suggest-form { display: flex; gap: 8px; margin-top: 8px; align-items: center; }
.ai-suggest__icon {
  width: 36px; height: 36px;
  background: var(--accent);
  color: var(--accent-fg);
  border-radius: 10px;
  display: grid; place-items: center;
  flex-shrink: 0;
}
.ai-suggest__icon svg { width: 18px; height: 18px; }

/* ============================================================
   STOCK DISPLAY COMPONENT
============================================================ */
.stock-display { display: inline; }

/* ============================================================
   AUTH PAGES
============================================================ */
/* Add item photo upload */
.additem-photo { margin-bottom: 4px; }
.additem-photo__empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  width: 100%;
  padding: 24px 16px;
  border: 2px dashed var(--card-line);
  border-radius: var(--radius-card);
  background: var(--card-bg);
  color: var(--fg-mute);
  cursor: pointer;
  transition: border-color 0.15s;
}
.additem-photo__empty:hover { border-color: var(--accent); }
.additem-photo__empty p { margin: 0; font-size: 14px; }
.additem-photo__preview {
  border-radius: var(--radius-card);
  overflow: hidden;
  border: 1px solid var(--card-line);
  background: var(--card-bg);
}
.additem-photo__preview img {
  width: 100%;
  height: 160px;
  object-fit: cover;
  display: block;
}
.additem-photo__actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
}
.additem-photo__label {
  font-size: 13px;
  color: var(--positive);
  font-weight: 600;
}

.purchase-rows { display: flex; flex-direction: column; gap: 10px; }
.purchase-total { display: flex; justify-content: space-between; align-items: center; padding: 16px 0; border-top: 1px solid var(--rule); margin-top: 4px; font-weight: 600; }
.purchase-total__value { font-size: 20px; font-feature-settings: "tnum"; }

/* Purchase card */
.pcard { background: var(--card); border-radius: 16px; padding: 14px 16px 12px; display: flex; flex-direction: column; gap: 10px; }
.pcard--new { border: 1.5px solid var(--accent-soft); }
.pcard__top { display: flex; align-items: flex-start; gap: 8px; }
.pcard__name { flex: 1 1; display: flex; align-items: center; gap: 8px; min-width: 0; }
.pcard__badge { flex-shrink: 0; font-size: 10px; font-weight: 700; letter-spacing: 0.06em; background: var(--accent-soft); color: var(--accent); border-radius: 6px; padding: 2px 6px; }
.pcard__edit-badge { flex-shrink: 0; width: 24px; height: 24px; border-radius: 6px; border: none; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; cursor: pointer; }
.pcard__edit-badge:active { opacity: 0.6; }
.pcard__edit-badge svg { width: 11px; height: 11px; }
.pcard__del { flex-shrink: 0; width: 28px; height: 28px; display: flex; align-items: center; justify-content: center; color: var(--fg-mute); font-size: 18px; border-radius: 8px; }
.pcard__name-edit { background: transparent; border: none; border-bottom: 1px solid var(--rule); border-radius: 0; font-size: 13px; color: var(--fg-mute); padding: 4px 0; width: 100%; outline: none; }
.pcard__name-edit::placeholder { color: var(--fg-faint); }
.pcard__footer { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.pcard__field { display: flex; align-items: center; gap: 6px; }
.pcard__sep { font-size: 15px; color: var(--fg-mute); font-weight: 500; }
.pcard__price-wrap { display: flex; align-items: baseline; }
.pcard__currency { font-size: 13px; color: var(--accent); font-weight: 600; margin-right: 1px; }
.pcard__num { background: transparent; border: none; outline: none; font: 600 17px/1 var(--font-sans); color: var(--fg); width: 48px; text-align: center; -moz-appearance: textfield; }
.pcard__num--price { color: var(--accent); width: 60px; }
.pcard__num::-webkit-inner-spin-button, .pcard__num::-webkit-outer-spin-button { -webkit-appearance: none; }
.pcard__total { font-size: 13px; font-weight: 700; color: var(--fg-mute); font-feature-settings: "tnum"; }

/* ItemPicker card mode */
.item-picker__card-trigger { background: transparent; border: none; padding: 0; text-align: left; cursor: pointer; min-width: 0; }
.item-picker__card-name { font: 600 16px/1.2 var(--font-sans); color: var(--fg); display: block; }
.item-picker__card-trigger .item-picker__placeholder { font: 500 14px/1.2 var(--font-sans); color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }

.auth-page {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  padding: 24px;
  font-family: var(--font-sans);
  color: var(--fg);
}
.auth-card {
  width: 100%;
  max-width: 380px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.auth-logo {
  font: 700 32px/1 var(--font-display);
  text-align: center;
  margin: 0;
  letter-spacing: -0.03em;
  color: var(--accent);
}
.auth-sub {
  text-align: center;
  color: var(--fg-mute);
  font-size: 14px;
  margin: -8px 0 8px;
}
.auth-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.auth-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.auth-label {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--fg-mute);
}
.auth-input {
  padding: 14px 16px;
  background: var(--card-bg);
  border: 1px solid var(--card-line);
  border-radius: 14px;
  font-size: 16px;
  color: var(--fg);
  transition: border-color 180ms ease;
}
.auth-input:focus {
  border-color: var(--accent);
  outline: none;
}
.auth-input--code {
  text-align: center;
  font-size: 28px;
  font-weight: 700;
  letter-spacing: 8px;
  font-feature-settings: "tnum";
}
.auth-error {
  margin: 0;
  padding: 12px 16px;
  background: #fbe9df;
  color: #b54a2c;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 500;
}
.auth-forgot {
  text-align: center;
  font-size: 14px;
  margin: 0 0 12px;
}
.auth-forgot a {
  color: var(--accent);
  text-decoration: none;
}
.auth-hint {
  text-align: center;
  font-size: 14px;
  color: var(--fg-mute);
  line-height: 1.5;
  margin: 8px 0 20px;
}
.auth-switch {
  text-align: center;
  font-size: 14px;
  color: var(--fg-mute);
  margin: 0;
}
.auth-switch a {
  color: var(--accent);
  font-weight: 600;
  text-decoration: none;
}
.auth-resend {
  text-align: center;
  font-size: 14px;
  color: var(--accent);
  font-weight: 600;
  display: block;
  margin: 0 auto;
}

/* ============================================================
   SPENDING DASHBOARD
============================================================ */
.spend-bars {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  height: 120px;
  padding-top: 24px;
}
.spend-bar {
  flex: 1 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  height: 100%;
}
.spend-bar__value {
  font-size: 10px;
  color: var(--fg-mute);
  white-space: nowrap;
  min-height: 14px;
}
.spend-bar__track {
  flex: 1 1;
  width: 100%;
  display: flex;
  align-items: flex-end;
  background: var(--track);
  border-radius: 4px;
  overflow: hidden;
}
.spend-bar__fill {
  width: 100%;
  background: var(--accent);
  border-radius: 4px 4px 0 0;
  transition: height 300ms ease;
  min-height: 2px;
}
.spend-bar__label {
  font-size: 10px;
  color: var(--fg-mute);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.spend-hbar {
  margin-bottom: 10px;
}
.spend-hbar__label {
  display: flex;
  align-items: center;
  font-size: 13px;
  margin-bottom: 4px;
  color: var(--fg);
}
.spend-hbar__row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.spend-hbar__track {
  flex: 1 1;
  height: 6px;
  background: var(--track);
  border-radius: 3px;
  overflow: hidden;
}
.spend-hbar__fill {
  height: 100%;
  background: var(--accent);
  border-radius: 3px;
  transition: width 300ms ease;
}
.spend-hbar__value {
  font-size: 12px;
  font-weight: 600;
  color: var(--fg);
  min-width: 40px;
  text-align: right;
}
.hbar-tap { display: block; width: 100%; background: none; border: none; padding: 0; cursor: pointer; text-align: left; color: inherit; }
.hbar-tap:active { opacity: 0.6; }

/* ============================================================
   HISTORY ROWS — tappable variant
============================================================ */
.historyrow--tap {
  cursor: pointer;
  border-radius: 12px;
  transition: background 120ms;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid var(--rule);
  background: none;
  border-left: 0;
  border-right: 0;
  border-top: 0;
}
.historyrow--tap:active {
  background: var(--cat-bg);
}

/* ============================================================
   BADGES
============================================================ */
.badge {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}
.badge--tap { cursor: pointer; border: none; background: var(--card-bg); color: var(--fg); font-size: 12px; padding: 4px 10px; border-radius: 8px; text-transform: none; }
.badge--tap:active { opacity: 0.6; }
.badge--receipt {
  background: var(--accent-soft);
  color: var(--accent);
}
.badge--manual {
  background: var(--cat-bg);
  color: var(--fg-mute);
}
.badge--ai {
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.15), rgba(59, 130, 246, 0.15));
  color: #7c3aed;
}
[data-dark="true"] .badge--ai { color: #a78bfa; }
.badge--undone {
  background: rgba(220, 50, 50, 0.12);
  color: #dc3232;
}

/* Undone purchase state */
.historyrow--undone .historyrow__name { text-decoration: line-through; color: var(--fg-mute); }
.historyrow--undone .historyrow__price { color: var(--fg-mute); text-decoration: line-through; }
.historyrow--undone .historyrow__sub { color: var(--fg-mute); opacity: 0.7; }
.purchase-undone .historyrow__name { text-decoration: line-through; color: var(--fg-mute); }
.purchase-undone .historyrow__price { text-decoration: line-through; color: var(--fg-mute); }
.purchase-undone .pdetail-hero__store { text-decoration: line-through; color: var(--fg-mute); }
.purchase-undone .purchase-total { opacity: 0.5; }

/* Purchase detail hero */
.pdetail-hero { display: flex; align-items: flex-start; gap: 14px; padding: 12px 16px 16px; }
.pdetail-hero__info { flex: 1 1; }
.pdetail-hero__store { font-size: 18px; font-weight: 700; margin: 0 0 2px; }
.pdetail-hero__total { font-size: 20px; font-weight: 700; white-space: nowrap; }

/* Receipt thumbnail */
.receipt-thumb { display: block; width: 100%; border-radius: 14px; overflow: hidden; background: var(--card-bg); max-height: 220px; }
.receipt-thumb__img { width: 100%; max-height: 220px; object-fit: cover; object-position: top; display: block; }

/* Full-screen receipt overlay */
.receipt-fullscreen { position: fixed; inset: 0; background: rgba(0,0,0,0.92); z-index: 100; display: flex; align-items: center; justify-content: center; }
.receipt-fullscreen__img { max-width: 100%; max-height: 100%; object-fit: contain; }

/* ============================================================
   ADMIN PANEL — desktop-oriented
============================================================ */
.admin-layout {
  display: flex;
  min-height: 100vh;
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--fg);
}
.admin-sidebar {
  width: 220px;
  flex-shrink: 0;
  background: var(--card-bg);
  border-right: 1px solid var(--card-line);
  display: flex;
  flex-direction: column;
  padding: 24px 0;
}
.admin-sidebar__logo {
  font-weight: 700;
  font-size: 15px;
  padding: 0 20px 20px;
  border-bottom: 1px solid var(--card-line);
  margin-bottom: 12px;
  color: var(--accent);
}
.admin-sidebar__nav {
  flex: 1 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 0 8px;
}
.admin-sidebar__footer {
  padding: 12px 8px 0;
  border-top: 1px solid var(--card-line);
}
.admin-nav__link {
  display: block;
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  color: var(--fg);
  text-decoration: none;
  transition: background 120ms;
}
.admin-nav__link:hover {
  background: var(--cat-bg);
}
.admin-main {
  flex: 1 1;
  padding: 32px 40px;
  max-width: 960px;
}
.admin-page__title {
  font-size: 24px;
  font-weight: 700;
  margin: 0 0 24px;
  letter-spacing: -0.02em;
}
.admin-stats {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  grid-gap: 16px;
  gap: 16px;
  margin-bottom: 32px;
}
.admin-stat {
  background: var(--card-bg);
  border: 1px solid var(--card-line);
  border-radius: 14px;
  padding: 20px;
}
.admin-stat__label {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--fg-mute);
  margin: 0 0 8px;
}
.admin-stat__value {
  font-size: 32px;
  font-weight: 700;
  margin: 0;
}
.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  margin-top: 16px;
}
.admin-table th {
  text-align: left;
  padding: 8px 12px;
  font-weight: 600;
  font-size: 11px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--fg-mute);
  border-bottom: 1px solid var(--card-line);
}
.admin-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--rule);
  vertical-align: middle;
}
.admin-table tr:last-child td {
  border-bottom: 0;
}
.admin-search {
  display: block;
  width: 100%;
  max-width: 360px;
  padding: 10px 14px;
  background: var(--card-bg);
  border: 1px solid var(--card-line);
  border-radius: 10px;
  font-size: 14px;
  color: var(--fg);
  margin-bottom: 16px;
}
.admin-form {
  background: var(--card-bg);
  border: 1px solid var(--card-line);
  border-radius: 14px;
  padding: 20px;
  margin-bottom: 24px;
}
.admin-form h3 {
  font-size: 14px;
  font-weight: 600;
  margin: 0 0 14px;
}
.admin-form__row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}
.admin-input {
  padding: 8px 12px;
  background: var(--bg);
  border: 1px solid var(--card-line);
  border-radius: 8px;
  font-size: 14px;
  color: var(--fg);
  flex: 1 1;
  min-width: 140px;
}
.admin-btn {
  padding: 8px 16px;
  background: var(--accent);
  color: var(--accent-fg);
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: 0;
  white-space: nowrap;
}
.admin-btn--ghost {
  background: var(--card-bg);
  color: var(--fg);
  border: 1px solid var(--card-line);
}
.admin-btn--sm {
  padding: 4px 10px;
  font-size: 12px;
  margin-right: 4px;
}
.admin-btn--danger {
  background: #fbe9df;
  color: var(--accent);
}
.admin-muted {
  color: var(--fg-mute);
  font-size: 14px;
}

/* ============================================================
   HISTORY ROWS — tappable variant
============================================================ */
.historyrow--tap {
  background: none;
  border: none;
  cursor: pointer;
  border-radius: 10px;
  transition: background 120ms ease;
  padding: 10px 4px;
}
.historyrow--tap:hover, .historyrow--tap:active {
  background: var(--card-bg);
}

/* ============================================================
   BADGES — receipt / manual source indicators
============================================================ */
.badge {
  display: inline-block;
  padding: 2px 7px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
}
.badge--receipt {
  background: var(--accent-soft);
  color: var(--accent);
}
.badge--manual {
  background: var(--cat-bg);
  color: var(--fg-mute);
}

/* ============================================================
   SPENDING DASHBOARD — bar + horizontal bar charts
============================================================ */
.spend-bars {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  height: 120px;
  padding-bottom: 20px;
}
.spend-bar {
  flex: 1 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  height: 100%;
}
.spend-bar__value {
  font-size: 10px;
  color: var(--fg-mute);
  white-space: nowrap;
}
.spend-bar__track {
  flex: 1 1;
  width: 100%;
  background: var(--track);
  border-radius: 4px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  overflow: hidden;
}
.spend-bar__fill {
  width: 100%;
  background: var(--accent);
  border-radius: 4px 4px 0 0;
  min-height: 2px;
  transition: height 400ms ease;
}
.spend-bar__label {
  font-size: 10px;
  color: var(--fg-mute);
  text-transform: capitalize;
}
.spend-hbar {
  margin-bottom: 10px;
}
.spend-hbar__label {
  display: flex;
  align-items: center;
  font-size: 13px;
  margin-bottom: 4px;
  gap: 4px;
}
.spend-hbar__row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.spend-hbar__track {
  flex: 1 1;
  height: 6px;
  background: var(--track);
  border-radius: 3px;
  overflow: hidden;
}
.spend-hbar__fill {
  height: 100%;
  background: var(--accent);
  border-radius: 3px;
  transition: width 400ms ease;
}
.spend-hbar__value {
  font-size: 13px;
  font-weight: 600;
  min-width: 40px;
  text-align: right;
}

/* ============================================================
   ADMIN PANEL — desktop sidebar layout
============================================================ */
.admin-layout {
  display: flex;
  min-height: 100vh;
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--fg);
}
.admin-sidebar {
  width: 220px;
  background: var(--card-bg);
  border-right: 1px solid var(--rule);
  display: flex;
  flex-direction: column;
  padding: 24px 0;
  position: -webkit-sticky;
  position: sticky;
  top: 0;
  height: 100vh;
}
.admin-sidebar__logo {
  font: 700 16px/1 var(--font-display);
  color: var(--accent);
  padding: 0 20px 24px;
  border-bottom: 1px solid var(--rule);
  margin-bottom: 16px;
}
.admin-sidebar__nav {
  display: flex;
  flex-direction: column;
  flex: 1 1;
}
.admin-sidebar__footer {
  padding: 16px 0 0;
  border-top: 1px solid var(--rule);
}
.admin-nav__link {
  display: block;
  padding: 10px 20px;
  font-size: 14px;
  font-weight: 500;
  color: var(--fg);
  text-decoration: none;
  border-radius: 0;
  transition: background 120ms ease;
}
.admin-nav__link:hover {
  background: var(--cat-bg);
}
.admin-main {
  flex: 1 1;
  padding: 32px;
  overflow-y: auto;
  max-width: 960px;
}
.admin-page__title {
  font: 700 24px/1.2 var(--font-display);
  margin: 0 0 24px;
}
.admin-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  grid-gap: 16px;
  gap: 16px;
  margin-bottom: 32px;
}
.admin-stat {
  background: var(--card-bg);
  border: 1px solid var(--card-line);
  border-radius: 14px;
  padding: 20px;
}
.admin-stat__label {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--fg-mute);
  margin: 0 0 8px;
}
.admin-stat__value {
  font-size: 32px;
  font-weight: 700;
  margin: 0;
}
.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
.admin-table th {
  text-align: left;
  padding: 8px 12px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--fg-mute);
  border-bottom: 1px solid var(--rule);
}
.admin-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--rule);
  vertical-align: middle;
}
.admin-table tr:hover td {
  background: var(--cat-bg);
}
.admin-muted {
  color: var(--fg-mute);
  font-size: 14px;
}
.admin-search {
  display: block;
  width: 100%;
  max-width: 360px;
  padding: 10px 14px;
  background: var(--card-bg);
  border: 1px solid var(--card-line);
  border-radius: 10px;
  font-size: 14px;
  color: var(--fg);
  margin-bottom: 20px;
}
.admin-form {
  background: var(--card-bg);
  border: 1px solid var(--card-line);
  border-radius: 14px;
  padding: 20px;
  margin-bottom: 24px;
}
.admin-form h3 {
  font-size: 14px;
  font-weight: 600;
  margin: 0 0 14px;
}
.admin-form__row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}
.admin-input {
  padding: 9px 12px;
  background: var(--bg);
  border: 1px solid var(--card-line);
  border-radius: 8px;
  font-size: 14px;
  color: var(--fg);
  flex: 1 1;
  min-width: 140px;
}
.admin-btn {
  padding: 9px 16px;
  background: var(--accent);
  color: var(--accent-fg);
  border: none;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}
.admin-btn:disabled {
  opacity: 0.5;
}
.admin-btn--ghost {
  background: var(--cat-bg);
  color: var(--fg);
}
.admin-btn--sm {
  padding: 5px 10px;
  font-size: 12px;
  margin-right: 4px;
}
.admin-btn--danger {
  background: #fbe9df;
  color: var(--accent);
}

