/* FreshSense prototype. Colors follow the presentation: cream, deep green, sage. */

:root {
  --bg: #F3EEE3;
  --surface: #FBF8F1;
  --line: #E4DED0;
  --ink: #17301F;
  --muted: #6E776A;
  --green: #1F4A2C;
  --green-2: #3D6B45;
  --sage: #7F9C6B;
  --sage-100: #E4EAD8;
  --orange: #E28E2C;
  --orange-100: #FBEBD5;
  --red: #C2553D;
  --red-100: #F7E0D9;
  --radius: 22px;
  --shadow: 0 1px 2px rgb(23 48 31 / .05), 0 8px 24px -12px rgb(23 48 31 / .18);
  --font: 'Plus Jakarta Sans', system-ui, sans-serif;
  --serif: 'Fraunces', Georgia, serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font: 15px/1.45 var(--font);
  color: var(--ink);
  background: radial-gradient(circle at 30% 20%, #EFE8DA, #DCD4C3);
  display: grid; place-items: center;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; }
img { display: block; max-width: 100%; }
h1, h2, h3, h4, p { margin: 0; }
.i { flex: none; }

/* ---------- device shell ---------- */

.device {
  position: relative; display: flex; flex-direction: column;
  width: 393px; height: min(852px, calc(100vh - 32px));
  background: var(--bg);
  border: 11px solid #1A1C1A; border-radius: 56px;
  overflow: hidden;
  box-shadow: 0 40px 80px -30px rgb(30 40 25 / .55);
}
.statusbar {
  flex: none; height: 50px; padding: 14px 30px 0;
  display: flex; justify-content: space-between; align-items: flex-start;
  font-weight: 700; font-size: 15px;
}
.notch { width: 110px; height: 32px; margin-top: -6px; border-radius: 20px; background: #1A1C1A; }
.sb-icons { font-size: 9px; letter-spacing: 1px; padding-top: 4px; }

.view {
  flex: 1; overflow-y: auto; overscroll-behavior: contain;
  padding: 4px 18px 120px;
  scrollbar-width: none;
}
.view::-webkit-scrollbar { display: none; }
.view.enter { animation: enter .28s ease-out; }
@keyframes enter { from { opacity: 0; transform: translateY(8px); } }

@media (max-width: 520px) {
  body { display: block; background: var(--bg); }
  .device { width: 100%; height: 100%; border: 0; border-radius: 0; box-shadow: none; }
  .statusbar { display: none; }
  .view { padding-top: calc(env(safe-area-inset-top) + 8px); }
}

/* ---------- tab bar ---------- */

.tabbar {
  position: absolute; inset: auto 0 0;
  display: grid; grid-template-columns: repeat(5, 1fr); align-items: end;
  padding: 8px 6px calc(10px + env(safe-area-inset-bottom));
  background: rgb(251 248 241 / .9); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid var(--line);
}
.tabbar a {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  font-size: 11px; font-weight: 600; color: var(--muted); padding: 4px 0;
}
.tabbar a.on { color: var(--green); }
.tabbar span { display: grid; place-items: center; }
.tabbar__add span {
  width: 56px; height: 56px; margin-top: -26px; border-radius: 50%;
  background: var(--green); color: #fff; box-shadow: 0 10px 20px -8px rgb(31 74 44 / .7);
}
body[data-tab="dodaj"] .tabbar { display: none; }

/* ---------- push banner + toast ---------- */

.push {
  position: absolute; z-index: 20; left: 10px; right: 10px; top: 54px;
  display: flex; gap: 12px; align-items: flex-start;
  padding: 12px 14px; border-radius: 22px;
  background: rgb(255 255 255 / .9); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  box-shadow: 0 14px 40px -12px rgb(0 0 0 / .35);
  transform: translateY(calc(-100% - 80px)); transition: transform .45s cubic-bezier(.2, .9, .3, 1.2);
}
.push.show { transform: none; }
.push__ic { width: 38px; height: 38px; border-radius: 10px; background: var(--green); display: grid; place-items: center; flex: none; }
.push__ic svg path:first-child { fill: #DDE8CF; }
.push__ic svg path:last-child { stroke: var(--green); }
.push__body { display: grid; gap: 1px; font-size: 13.5px; flex: 1; }
.push__app { font-size: 12px; color: var(--muted); display: flex; justify-content: space-between; }
.push__app em { font-style: normal; }
.push small { color: #3E4A3B; font-size: 13px; }
@media (max-width: 520px) { .push { top: calc(env(safe-area-inset-top) + 8px); } }

.toast {
  position: absolute; z-index: 21; left: 50%; bottom: 104px;
  transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  width: max-content; max-width: 86%;
  padding: 11px 16px; border-radius: 14px;
  background: var(--green); color: #fff; font-weight: 600; font-size: 14px; text-align: center;
  transition: .3s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- onboarding ---------- */

.onboarding { position: absolute; inset: 0; z-index: 30; background: var(--bg); display: flex; flex-direction: column; transition: opacity .45s; }
.onboarding[hidden] { display: none; }
.onboarding.out { opacity: 0; pointer-events: none; }
.onboarding img { width: 100%; height: 52%; object-fit: cover; object-position: 50% 62%; mask-image: linear-gradient(#000 70%, transparent); -webkit-mask-image: linear-gradient(#000 70%, transparent); }
.onboarding__body { flex: 1; display: flex; flex-direction: column; gap: 14px; padding: 8px 28px calc(28px + env(safe-area-inset-bottom)); }
.onboarding h1 { font: italic 500 34px/1.1 var(--serif); color: var(--green-2); }
.caps { text-transform: uppercase; letter-spacing: .16em; font-size: 11.5px; color: var(--muted); line-height: 1.8; }
.onboarding .btn { margin-top: auto; }

/* ---------- typography + header ---------- */

.logo { display: inline-flex; align-items: center; gap: 6px; font-size: 22px; letter-spacing: -.02em; }
.logo b { color: var(--green); font-weight: 800; }
.logo span { color: var(--sage); font-weight: 600; margin-left: -6px; }
.logo--lg { font-size: 38px; }
.logo--lg span { margin-left: -6px; }

.top { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 52px; margin-bottom: 6px; }
.top--center .title { flex: 1; text-align: center; }
.top__actions { display: flex; gap: 8px; }
.title { font-size: 28px; font-weight: 800; letter-spacing: -.025em; color: var(--green); }
.title--sm { font-size: 19px; }
.h2 { font-size: 21px; font-weight: 800; letter-spacing: -.02em; margin: 18px 0 6px; color: var(--green); }
.lead { color: var(--muted); margin-bottom: 14px; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.center { text-align: center; }
.warn-text { color: var(--orange); font-weight: 700; }

.hello { margin: 4px 0 14px; }
.hello h1 { font-size: 24px; font-weight: 800; letter-spacing: -.02em; }
.hello p { color: var(--muted); }

.iconbtn {
  position: relative; width: 42px; height: 42px; border-radius: 50%; flex: none;
  display: grid; place-items: center; background: var(--surface); color: var(--green);
  box-shadow: var(--shadow);
}
span.iconbtn { visibility: hidden; }
.iconbtn--float { position: absolute; top: 12px; left: 30px; }
.dot {
  position: absolute; top: -2px; right: -2px; min-width: 18px; height: 18px; padding: 0 4px;
  border-radius: 9px; background: var(--orange); color: #fff; font-size: 11px; font-weight: 800;
  display: grid; place-items: center;
}
.fab { width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; background: var(--green); color: #fff; }

.sect { display: flex; justify-content: space-between; align-items: baseline; margin: 22px 2px 10px; }
.sect h3 { font-size: 17px; font-weight: 800; letter-spacing: -.01em; }
.sect a { font-size: 13px; font-weight: 700; color: var(--sage); }

/* ---------- cards ---------- */

.card { display: block; background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px; }
.card + .card, .card + .btn, .grid2 + .card, .card + .grid2 { margin-top: 12px; }
a.card, button.card { transition: transform .15s; }
a.card:active, button.card:active { transform: scale(.98); }

.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid2 + .grid2 { margin-top: 12px; }

.hero__img { margin: -14px -14px 12px; border-radius: var(--radius) var(--radius) 0 0; overflow: hidden; background: #EFE9DC; }
.hero__img img { width: 100%; height: 190px; object-fit: cover; }
.hero__row { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; margin-bottom: 12px; }
.hero h2 { font-size: 20px; font-weight: 800; letter-spacing: -.02em; }

.metric { display: grid; justify-items: center; gap: 1px; text-align: center; padding: 14px 10px 10px; color: var(--green); }
.metric strong { font-size: 24px; font-weight: 800; letter-spacing: -.02em; margin-top: 4px; }
.metric span { font-size: 13px; color: var(--muted); }
.metric em { font-style: normal; font-size: 11.5px; color: var(--muted); }
.spark { width: 100%; height: 34px; margin-top: 6px; overflow: visible; }
.spark path { fill: none; stroke: var(--green-2); stroke-width: 2; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.spark circle { fill: var(--green-2); }

.bar { height: 8px; border-radius: 4px; background: #E7E2D6; overflow: hidden; }
.bar i { display: block; height: 100%; border-radius: inherit; background: var(--green-2); transition: width .6s; }
.bar--uskoro i { background: var(--orange); }
.bar--pokvareno i { background: var(--red); }

.chip { flex: none; padding: 4px 10px; border-radius: 99px; font-size: 12px; font-weight: 700; background: var(--sage-100); color: var(--green); }
.chip--uskoro { background: var(--orange-100); color: #A35D10; }
.chip--pokvareno { background: var(--red-100); color: var(--red); }
.tag { justify-self: start; margin-bottom: 4px; padding: 2px 8px; border-radius: 99px; font-size: 11.5px; font-weight: 700; background: var(--sage-100); color: var(--green); }
.tag--uskoro { background: var(--orange-100); color: #A35D10; }
.tag--pokvareno { background: var(--red-100); color: var(--red); }

.banner {
  display: flex; align-items: center; gap: 12px; margin-top: 12px;
  padding: 16px; border-radius: var(--radius); color: #fff; background: var(--green-2);
}
.banner > span:nth-child(2) { flex: 1; display: grid; }
.banner b { font-size: 16px; }
.banner small { font-size: 13.5px; opacity: .9; }
.banner__ic { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; background: rgb(255 255 255 / .16); flex: none; }
.banner--warn { background: var(--orange); }
.banner--bad { background: var(--red); }

.recipe { display: flex; align-items: center; gap: 12px; padding: 10px; }
.recipe + .recipe { margin-top: 10px; }
.recipe > img { width: 86px; height: 86px; border-radius: 16px; object-fit: cover; flex: none; }
.recipe__body { flex: 1; display: grid; gap: 2px; min-width: 0; }
.recipe__body b { font-size: 15.5px; }
.recipe__body small { color: var(--muted); font-size: 12.5px; line-height: 1.35; }
.recipe > .i { color: var(--muted); }
.meta { display: flex; gap: 12px; font-size: 12px; color: var(--muted); margin-top: 4px; }
.meta span { display: inline-flex; align-items: center; gap: 4px; }
.meta--lg { font-size: 14px; margin: 6px 0 10px; }

.hscroll { display: flex; gap: 10px; overflow-x: auto; margin: 0 -18px; padding: 2px 18px 12px; scroll-snap-type: x mandatory; scrollbar-width: none; }
.hscroll::-webkit-scrollbar { display: none; }
.mini { flex: 0 0 136px; scroll-snap-align: start; display: grid; gap: 4px; padding: 10px; }
.mini img { width: 100%; height: 84px; object-fit: contain; }
.mini b { font-size: 13.5px; line-height: 1.2; }
.mini small { color: var(--muted); font-size: 12px; }

.empty { text-align: center; display: grid; gap: 10px; justify-items: center; padding: 20px; }
.empty img { border-radius: 16px; }

/* ---------- buttons + forms ---------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 50px; padding: 0 18px; border-radius: 16px;
  background: var(--green); color: #fff; font-weight: 700; font-size: 15px;
  transition: transform .12s, background .2s;
}
.btn:active { transform: scale(.97); }
.btn--block { display: flex; width: 100%; margin-top: 12px; }
.btn--ghost { background: transparent; color: var(--green); box-shadow: inset 0 0 0 1.5px var(--line); }
.btn--soft { background: var(--sage-100); color: var(--green); font-size: 13.5px; }

.field { display: grid; gap: 6px; margin-top: 16px; font-size: 13px; font-weight: 700; color: var(--muted); }
.field input {
  font: inherit; font-size: 16px; font-weight: 500; color: var(--ink);
  padding: 14px 16px; border-radius: 14px; border: 1.5px solid var(--line); background: var(--surface);
}
.field input:focus { outline: 0; border-color: var(--sage); }

.photo-btn { cursor: pointer; }
.photo-btn img { width: 34px; height: 34px; border-radius: 8px; object-fit: cover; }

/* ---------- list rows ---------- */

.row { display: flex; align-items: center; gap: 12px; padding: 10px 14px 10px 10px; width: 100%; text-align: left; }
.row + .row { margin-top: 10px; }
.row > img { width: 92px; height: 72px; object-fit: contain; flex: none; }
.row__body { flex: 1; display: grid; gap: 4px; min-width: 0; }
.row__body b { font-size: 16px; }
.row__body small { color: var(--muted); font-size: 13px; }
.row > .i { color: var(--muted); }
.dev-ic { width: 52px; height: 52px; border-radius: 16px; display: grid; place-items: center; background: var(--sage-100); color: var(--green); flex: none; }

.list { padding: 4px 14px; }
.list > * { display: flex; align-items: center; gap: 10px; padding: 12px 0; }
.list > * + * { border-top: 1px solid var(--line); }
.info span { flex: 1; color: var(--muted); font-size: 13.5px; }
.info b { display: inline-flex; align-items: center; gap: 5px; font-size: 14px; text-align: right; }

.check input { width: 20px; height: 20px; accent-color: var(--green-2); }
.check input:checked + span { text-decoration: line-through; color: var(--muted); }
.steps { margin: 0; padding: 0 0 0 4px; list-style: none; counter-reset: s; display: grid; gap: 12px; }
.steps li { counter-increment: s; display: flex; gap: 12px; }
.steps li::before {
  content: counter(s); flex: none; width: 28px; height: 28px; border-radius: 50%;
  display: grid; place-items: center; background: var(--sage-100); color: var(--green); font-weight: 800; font-size: 13px;
}

.cover { position: relative; margin: -4px -18px 16px; }
.cover img { width: 100%; height: 230px; object-fit: cover; }
.pills { display: flex; flex-wrap: wrap; gap: 8px; }
.pill { display: inline-flex; align-items: center; gap: 8px; padding: 4px 12px 4px 4px; border-radius: 99px; background: var(--surface); box-shadow: var(--shadow); font-weight: 700; font-size: 13.5px; }
.pill img { width: 34px; height: 34px; border-radius: 50%; object-fit: cover; background: #EFE9DC; }
.pill small { color: var(--muted); font-weight: 500; }

/* ---------- container detail ---------- */

.tabs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; padding: 4px; margin-bottom: 14px; border-radius: 16px; background: var(--sage-100); }
.tabs button { padding: 10px 0; border-radius: 12px; font-weight: 700; color: var(--green-2); }
.tabs button[aria-selected="true"] { background: var(--green-2); color: #fff; box-shadow: var(--shadow); }

.photo { position: relative; padding: 0; overflow: hidden; background: #EFE9DC; }
.photo img { width: 100%; height: 210px; object-fit: contain; }
.photo .chip { position: absolute; top: 12px; right: 12px; }

.voc__head { display: flex; align-items: center; gap: 8px; color: var(--green); margin-bottom: 14px; }
.voc__head span { flex: 1; font-weight: 700; }
.lvl { padding: 3px 10px; border-radius: 99px; font-size: 12.5px; background: var(--sage-100); }
.lvl--warn { background: var(--orange-100); color: #A35D10; }
.lvl--bad { background: var(--red-100); color: var(--red); }
.gauge { position: relative; height: 10px; border-radius: 5px; background: linear-gradient(90deg, var(--sage) 0 36%, var(--orange) 36% 77%, var(--red) 77%); }
.gauge i { position: absolute; top: 50%; width: 20px; height: 20px; border-radius: 50%; background: #fff; border: 3px solid var(--green); transform: translate(-50%, -50%); transition: left .6s; }
.gauge__labels { display: flex; justify-content: space-between; margin-top: 8px; font-size: 11.5px; color: var(--muted); }

.days__head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; font-size: 17px; color: var(--green); }
.days small { display: block; margin-top: 10px; font-size: 12px; }

.demo { margin-top: 24px; padding: 12px; border-radius: var(--radius); border: 1.5px dashed var(--line); }
.demo > small { display: block; margin-bottom: 8px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .12em; color: var(--muted); }

.chartcard h4 { display: flex; align-items: center; gap: 6px; margin-bottom: 8px; font-size: 15px; color: var(--green); }
.chart { width: 100%; height: auto; overflow: visible; }
.chart text { font-size: 10px; fill: var(--muted); font-family: var(--font); }
.chart .band { fill: var(--sage-100); }
.chart .thr { stroke: var(--orange); stroke-width: 1.5; stroke-dasharray: 4 4; }
.chart .area { opacity: .1; }
.chart .line { fill: none; stroke-width: 2.2; stroke-linecap: round; }

.events > div { font-size: 14px; }
.events span { flex: 1; }
.events small { color: var(--muted); font-size: 12px; }
.ev { width: 10px; height: 10px; border-radius: 50%; background: var(--sage); flex: none; }
.ev--uskoro, .ev--temp { background: var(--orange); }
.ev--pokvareno { background: var(--red); }

.tip { display: flex; gap: 12px; align-items: flex-start; }
.tip p { font-size: 14.5px; }
.tip + .tip { margin-top: 10px; }

/* ---------- pairing ---------- */

.stepper { display: flex; gap: 6px; margin: 0 0 16px; padding: 0; list-style: none; }
.stepper li { flex: 1; padding-top: 8px; border-top: 4px solid var(--line); font-size: 12px; font-weight: 700; color: var(--muted); }
.stepper li.on { border-color: var(--green-2); color: var(--green); }
.pairimg { padding: 0; overflow: hidden; }
.pairimg img { width: 100%; }

.radar { position: relative; width: 220px; height: 220px; margin: 60px auto 26px; display: grid; place-items: center; }
.radar span { position: absolute; inset: 0; border-radius: 50%; border: 2px solid var(--sage); opacity: 0; animation: ping 2.4s ease-out infinite; }
.radar span:nth-child(2) { animation-delay: .8s; }
.radar span:nth-child(3) { animation-delay: 1.6s; }
.radar b { width: 84px; height: 84px; border-radius: 50%; display: grid; place-items: center; background: var(--green); color: #fff; box-shadow: 0 12px 30px -10px rgb(31 74 44 / .7); }
@keyframes ping { from { transform: scale(.35); opacity: .9; } to { transform: scale(1); opacity: 0; } }

.foods { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.food { display: grid; justify-items: center; gap: 2px; padding: 8px 4px 10px; border-radius: 16px; background: var(--surface); box-shadow: var(--shadow); outline: 2px solid transparent; transition: outline-color .15s; }
.food img { width: 100%; height: 56px; object-fit: contain; }
.food span { font-size: 12.5px; font-weight: 700; line-height: 1.2; text-align: center; }
.food small { font-size: 11px; color: var(--muted); }
.food.is-on { outline-color: var(--green-2); background: #fff; }

.done { display: grid; justify-items: center; text-align: center; padding-top: 50px; }
.done .btn { width: 100%; }
.done__ic { width: 96px; height: 96px; border-radius: 50%; display: grid; place-items: center; background: var(--green-2); color: #fff; animation: pop .45s cubic-bezier(.2, .9, .3, 1.4); }
@keyframes pop { from { transform: scale(.4); opacity: 0; } }

/* ---------- profile ---------- */

.me { display: flex; align-items: center; gap: 14px; }
.me > div:last-child { display: grid; }
.me small { color: var(--muted); }
.avatar { width: 54px; height: 54px; border-radius: 50%; display: grid; place-items: center; background: var(--green); color: #fff; font-weight: 800; flex: none; }
.stats { margin-top: 12px; }
.stats .card { display: grid; margin: 0; }
.stats strong { font-size: 24px; font-weight: 800; color: var(--green); letter-spacing: -.02em; }
.stats span { font-size: 13px; color: var(--muted); }

.bars { display: flex; align-items: flex-end; gap: 14px; height: 130px; padding: 0 6px; }
.bars__col { flex: 1; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 6px; }
.bars__stack { width: 100%; max-width: 34px; display: flex; flex-direction: column; border-radius: 8px; overflow: hidden; }
.bars small, .legend { font-size: 11.5px; color: var(--muted); }
.saved { background: var(--green-2); }
.waste { background: var(--orange); }
.legend { display: flex; gap: 14px; margin-top: 12px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; }

.stock img { width: 44px; height: 36px; object-fit: contain; }
.stock span { flex: 1; display: grid; gap: 5px; }
.stock b { font-size: 14px; }
.stock small { font-size: 12.5px; color: var(--muted); min-width: 52px; text-align: right; }

.modules span { flex: 1; display: grid; }
.modules small { color: var(--muted); font-size: 12.5px; }
.modules em { font-style: normal; display: inline-flex; align-items: center; gap: 4px; font-size: 13px; }

.toggle { cursor: pointer; }
.toggle span { flex: 1; display: grid; }
.toggle small { color: var(--muted); font-size: 12.5px; }
.toggle input {
  appearance: none; -webkit-appearance: none; flex: none; position: relative; margin: 0;
  width: 50px; height: 30px; border-radius: 15px; background: var(--line); transition: background .2s; cursor: pointer;
}
.toggle input::after { content: ''; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgb(0 0 0 / .2); transition: transform .2s; }
.toggle input:checked { background: var(--green-2); }
.toggle input:checked::after { transform: translateX(20px); }

/* ---------- alerts ---------- */

.alert { display: flex; gap: 12px; align-items: flex-start; }
.alert + .alert { margin-top: 10px; }
.alert > span:last-child { display: grid; gap: 2px; }
.alert small { color: #44503F; font-size: 13.5px; }
.alert em { font-style: normal; font-size: 12px; color: var(--muted); }
.alert.is-new { box-shadow: inset 4px 0 0 var(--orange), var(--shadow); }
.alert__ic { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; flex: none; background: var(--orange-100); color: #A35D10; }
.alert__ic--pokvareno { background: var(--red-100); color: var(--red); }

:focus-visible { outline: 2px solid var(--sage); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
