:root {
  --bg: #f4f6f5;
  --surface: #ffffff;
  --surface-2: #eef1f0;
  --border: #e2e7e5;
  --text: #17201c;
  --muted: #6b7772;
  --accent: #10b26c;
  --accent-strong: #0a9a5c;
  --accent-soft: #e2f6ec;
  --on-accent: #ffffff;
  --danger: #e5484d;
  --danger-soft: #fdecec;
  --warn: #f5a524;
  --protein: #e5546c;
  --fat: #f2a33a;
  --carbs: #3e8ef7;
  --shadow: 0 1px 2px rgba(16, 24, 20, .05), 0 4px 16px rgba(16, 24, 20, .06);
  --radius: 18px;
  --radius-sm: 12px;
  --tabbar-h: 58px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  --kb: 0px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e1110;
    --surface: #171c1a;
    --surface-2: #212825;
    --border: #2a322f;
    --text: #e9efec;
    --muted: #93a09a;
    --accent: #22c47e;
    --accent-strong: #3fd590;
    --accent-soft: #15301f;
    --on-accent: #06140d;
    --danger: #ff6b6f;
    --danger-soft: #3a1c1d;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 4px 16px rgba(0, 0, 0, .25);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.4 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  min-height: 100vh;
  min-height: 100dvh;
  overscroll-behavior-y: none;
}
body.locked { position: fixed; left: 0; right: 0; overflow: hidden; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
img { max-width: 100%; display: block; }
h1, h2, h3 { margin: 0; line-height: 1.2; }
[hidden] { display: none !important; }

.boot { min-height: 100dvh; display: grid; place-items: center; }

/* ---------- Spinner ---------- */
.spinner {
  width: 28px; height: 28px; border-radius: 50%;
  border: 3px solid var(--border); border-top-color: var(--accent);
  animation: spin .8s linear infinite;
}
.spinner.sm { width: 18px; height: 18px; border-width: 2px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Layout ---------- */
.screen { min-height: 100dvh; padding-bottom: calc(var(--tabbar-h) + var(--safe-b) + 24px); }
.topbar {
  position: sticky; top: 0; z-index: 20;
  padding: calc(var(--safe-t) + 10px) 16px 10px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  -webkit-backdrop-filter: saturate(180%) blur(16px);
  backdrop-filter: saturate(180%) blur(16px);
  display: flex; align-items: center; gap: 10px; min-height: 52px;
}
.topbar h1 { font-size: 26px; font-weight: 800; letter-spacing: -.02em; flex: 1; }
.content { padding: 4px 16px 16px; max-width: 640px; margin: 0 auto; }
.section-title { font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin: 22px 4px 8px; }

/* ---------- Tab bar ---------- */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: flex; justify-content: space-around;
  padding: 6px 4px calc(6px + var(--safe-b));
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  -webkit-backdrop-filter: saturate(180%) blur(16px);
  backdrop-filter: saturate(180%) blur(16px);
  border-top: 1px solid var(--border);
}
.tabbar a {
  flex: 1; max-width: 110px; display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 4px 0; font-size: 11px; font-weight: 600; color: var(--muted); text-decoration: none;
}
.tabbar a svg { width: 26px; height: 26px; }
.tabbar a.active { color: var(--accent); }

/* ---------- Cards & lists ---------- */
.card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; }
.card + .card { margin-top: 12px; }
.list { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.list-item {
  display: flex; align-items: center; gap: 12px; width: 100%;
  padding: 13px 16px; min-height: 56px; background: none; border: 0; text-align: left;
  border-bottom: 1px solid var(--border);
}
.list-item:last-child { border-bottom: 0; }
button.list-item:active, .list-item.tappable:active { background: var(--surface-2); }
.list-item .main { flex: 1; min-width: 0; }
.list-item .title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-item .sub { font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-item .end { text-align: right; font-weight: 700; white-space: nowrap; }
.list-item .end small { display: block; font-weight: 500; font-size: 12px; color: var(--muted); }
.avatar {
  width: 40px; height: 40px; border-radius: 50%; flex: none; display: grid; place-items: center;
  background: var(--accent-soft); color: var(--accent-strong); font-weight: 800; text-transform: uppercase;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 0 20px; border-radius: 14px; border: 0;
  background: var(--surface-2); color: var(--text); font-weight: 700; font-size: 16px;
  transition: transform .08s ease, opacity .15s;
  touch-action: manipulation; user-select: none; -webkit-user-select: none;
}
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .5; pointer-events: none; }
.btn.primary { background: var(--accent); color: var(--on-accent); }
.btn.danger { background: var(--danger-soft); color: var(--danger); }
.btn.ghost { background: transparent; color: var(--accent-strong); }
.btn.block { width: 100%; }
.btn.sm { min-height: 36px; padding: 0 14px; font-size: 14px; border-radius: 10px; }
.btn svg { width: 20px; height: 20px; }
.icon-btn {
  width: 40px; height: 40px; border-radius: 50%; border: 0; display: grid; place-items: center; flex: none;
  background: var(--surface); color: var(--text); box-shadow: var(--shadow); touch-action: manipulation;
}
.icon-btn.accent { background: var(--accent); color: var(--on-accent); }
.icon-btn.flat { background: transparent; box-shadow: none; }
.icon-btn svg { width: 22px; height: 22px; }
.icon-btn:active { transform: scale(.94); }
.btn-row { display: flex; gap: 10px; }
.btn-row > .btn { flex: 1; }

/* ---------- Forms ---------- */
.field { display: block; margin-bottom: 14px; }
.field > span { display: block; font-size: 13px; font-weight: 600; color: var(--muted); margin: 0 0 6px 4px; }
.input, .field input, .field select, .field textarea {
  width: 100%; min-height: 48px; padding: 12px 14px; border-radius: 12px;
  border: 1.5px solid var(--border); background: var(--surface); font-size: 16px; outline: none;
  -webkit-appearance: none; appearance: none;
}
.field textarea { min-height: 96px; resize: vertical; line-height: 1.4; }
.input:focus, .field input:focus, .field select:focus, .field textarea:focus { border-color: var(--accent); }
.field .hint { font-size: 12px; color: var(--muted); margin: 6px 4px 0; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 10px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0 8px; }
.input-suffix { position: relative; }
.input-suffix input { padding-right: 44px; }
.input-suffix em { position: absolute; right: 14px; top: 50%; transform: translateY(-50%); font-style: normal; color: var(--muted); font-size: 14px; pointer-events: none; }
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 6px 4px 14px; font-weight: 600; }
.switch { position: relative; width: 52px; height: 32px; flex: none; }
.switch input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; z-index: 1; }
.switch i { position: absolute; inset: 0; border-radius: 16px; background: var(--border); transition: background .2s; }
.switch i::after { content: ""; position: absolute; top: 3px; left: 3px; width: 26px; height: 26px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: transform .2s; }
.switch input:checked + i { background: var(--accent); }
.switch input:checked + i::after { transform: translateX(20px); }
.search {
  display: flex; align-items: center; gap: 8px; background: var(--surface); border-radius: 14px; padding: 0 12px;
  box-shadow: var(--shadow); min-height: 46px;
}
.search svg { width: 20px; height: 20px; color: var(--muted); flex: none; }
.search input { flex: 1; border: 0; background: none; outline: none; min-height: 46px; font-size: 16px; min-width: 0; }
.form-error { background: var(--danger-soft); color: var(--danger); padding: 10px 14px; border-radius: 12px; font-size: 14px; font-weight: 600; margin-bottom: 14px; }

/* ---------- Segmented ---------- */
.segmented { display: flex; background: var(--surface-2); padding: 3px; border-radius: 12px; gap: 2px; }
.segmented button {
  flex: 1; border: 0; background: none; padding: 9px 6px; border-radius: 10px; font-size: 14px; font-weight: 600; color: var(--muted);
  white-space: nowrap; touch-action: manipulation;
}
.segmented button.active { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px rgba(0,0,0,.12); }

/* ---------- Badges & chips ---------- */
.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 700; background: var(--accent-soft); color: var(--accent-strong); vertical-align: middle; }
.badge.muted { background: var(--surface-2); color: var(--muted); }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { border: 1.5px solid var(--border); background: var(--surface); border-radius: 999px; padding: 7px 14px; font-size: 14px; font-weight: 600; touch-action: manipulation; }
.chip.active { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-strong); }

/* ---------- Empty ---------- */
.empty { text-align: center; padding: 40px 24px; color: var(--muted); }
.empty svg { width: 52px; height: 52px; opacity: .5; margin-bottom: 8px; }
.empty h3 { color: var(--text); font-size: 17px; margin-bottom: 4px; }
.empty p { margin: 0 0 16px; font-size: 14px; }

/* ---------- Login ---------- */
.login {
  min-height: 100dvh; display: flex; flex-direction: column; justify-content: center;
  padding: calc(var(--safe-t) + 24px) 24px calc(var(--safe-b) + 24px); max-width: 420px; margin: 0 auto;
}
.logo { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.logo-mark { width: 56px; height: 56px; border-radius: 16px; background: var(--accent); display: grid; place-items: center; color: var(--on-accent); box-shadow: 0 8px 24px color-mix(in srgb, var(--accent) 35%, transparent); }
.logo-mark svg { width: 32px; height: 32px; }
.logo h1 { font-size: 34px; font-weight: 800; letter-spacing: -.03em; }
.login .tagline { color: var(--muted); margin: 0 0 32px; }
.pw-wrap { position: relative; }
.pw-wrap input { padding-right: 52px; }
.pw-wrap button { position: absolute; right: 4px; top: 4px; width: 40px; height: 40px; border: 0; background: none; color: var(--muted); display: grid; place-items: center; }
.pw-wrap button svg { width: 22px; height: 22px; }

/* ---------- Sheets ---------- */
.sheet-backdrop {
  position: fixed; inset: 0; z-index: 100; background: rgba(0, 0, 0, .38);
  opacity: 0; transition: opacity .22s ease;
}
.sheet-backdrop.open { opacity: 1; }
.sheet {
  position: fixed; left: 0; right: 0; bottom: var(--kb); z-index: 101;
  max-width: 640px; margin: 0 auto;
  max-height: calc(var(--vvh, 100dvh) - var(--safe-t) - 12px);
  display: flex; flex-direction: column;
  background: var(--bg); border-radius: 22px 22px 0 0;
  transform: translateY(100%); transition: transform .28s cubic-bezier(.2, .8, .2, 1);
  box-shadow: 0 -8px 32px rgba(0, 0, 0, .18);
}
.sheet.open { transform: translateY(0); }
.sheet.full { height: calc(var(--vvh, 100dvh) - var(--safe-t) - 12px); }
.sheet-head { display: flex; align-items: center; gap: 8px; padding: 8px 12px 8px 20px; flex: none; position: relative; }
.sheet-head::before { content: ""; position: absolute; top: 6px; left: 50%; width: 36px; height: 5px; border-radius: 3px; background: var(--border); transform: translateX(-50%); }
.sheet-head h2 { flex: 1; font-size: 19px; font-weight: 800; padding-top: 14px; }
.sheet-head .icon-btn { margin-top: 10px; }
.sheet-body {
  flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain;
  padding: 8px 20px calc(20px + var(--safe-b));
}
.sheet-foot { flex: none; padding: 12px 20px calc(12px + var(--safe-b)); border-top: 1px solid var(--border); background: var(--bg); }
.sheet.kb-open .sheet-body, .sheet.kb-open .sheet-foot { padding-bottom: 12px; }

/* ---------- Toasts ---------- */
#toasts { position: fixed; left: 0; right: 0; top: calc(var(--safe-t) + 10px); z-index: 200; display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; padding: 0 16px; }
.toast {
  background: #1f2924; color: #fff; padding: 12px 18px; border-radius: 14px; font-size: 15px; font-weight: 600;
  box-shadow: 0 8px 24px rgba(0,0,0,.25); max-width: 480px; animation: toast-in .25s ease; pointer-events: auto;
}
.toast.error { background: var(--danger); }
.toast.success { background: var(--accent-strong); color: #fff; }
.toast.out { opacity: 0; transform: translateY(-8px); transition: all .25s; }
@keyframes toast-in { from { opacity: 0; transform: translateY(-10px); } }

/* ---------- Misc ---------- */
.muted { color: var(--muted); }
.small { font-size: 13px; }
.center { text-align: center; }
.mt { margin-top: 16px; }
.mb { margin-bottom: 16px; }
.row { display: flex; align-items: center; gap: 10px; }
.row .grow { flex: 1; min-width: 0; }
.kv { display: flex; justify-content: space-between; padding: 6px 0; font-size: 15px; }
.kv b { font-weight: 700; }
.loading-block { display: grid; place-items: center; padding: 48px 0; }
.stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.stat { background: var(--surface); border-radius: var(--radius-sm); padding: 12px; box-shadow: var(--shadow); text-align: center; }
.stat b { display: block; font-size: 22px; font-weight: 800; }
.stat span { font-size: 12px; color: var(--muted); font-weight: 600; }

/* ---------- Skaner ---------- */
.scanner { position: relative; border-radius: var(--radius); overflow: hidden; background: #000; aspect-ratio: 3 / 4; max-height: 58vh; width: 100%; }
.scanner video { width: 100%; height: 100%; object-fit: cover; display: block; }
.scanner-frame { position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none; }
.scanner-frame i { width: 78%; height: 32%; border: 3px solid rgba(255,255,255,.9); border-radius: 16px; box-shadow: 0 0 0 9999px rgba(0,0,0,.35); }
.scanner-msg { position: absolute; left: 12px; right: 12px; bottom: 12px; color: #fff; text-align: center; font-size: 14px; font-weight: 600; display: flex; flex-direction: column; align-items: center; gap: 6px; text-shadow: 0 1px 3px rgba(0,0,0,.6); }
.scanner-msg svg { width: 32px; height: 32px; }

/* ---------- Produkty ---------- */
.macro-line { font-size: 13px; color: var(--muted); }
.macro-line b { font-weight: 700; }
.m-p { color: var(--protein); }
.m-f { color: var(--fat); }
.m-c { color: var(--carbs); }
.input-group { display: flex; gap: 8px; }
.input-group > input { flex: 1; min-width: 0; }
.fab-row { display: flex; gap: 8px; }
.notice { display: flex; gap: 10px; align-items: flex-start; background: var(--accent-soft); color: var(--accent-strong); border-radius: 12px; padding: 10px 12px; font-size: 14px; font-weight: 600; margin-bottom: 14px; }
.notice.warn { background: color-mix(in srgb, var(--warn) 16%, transparent); color: color-mix(in srgb, var(--warn) 60%, var(--text)); }
.notice svg { width: 20px; height: 20px; flex: none; margin-top: 1px; }
.notice button { margin-left: auto; }
.per100 { display: flex; align-items: baseline; justify-content: space-between; margin: 18px 4px 10px; }
.per100 h3 { font-size: 16px; font-weight: 800; }

/* ---------- Profil ---------- */
.big-input { font-size: 22px !important; font-weight: 800; }
.macro-row { display: flex; align-items: center; gap: 10px; padding: 6px 0; }
.macro-row .grow { flex: 1; min-width: 0; }
.macro-row .dot { width: 10px; height: 10px; border-radius: 50%; background: currentColor; flex: none; }
.macro-row .pct { width: 92px; flex: none; }
.macro-row .pct input { width: 100%; min-height: 44px; padding: 10px 30px 10px 12px; border-radius: 12px; border: 1.5px solid var(--border); background: var(--surface); outline: none; font-size: 16px; font-weight: 700; text-align: right; }
.macro-row .pct input:focus { border-color: var(--accent); }
.macro-row .pct em { right: 12px; }
.macro-row .grams { width: 60px; text-align: right; color: var(--muted); font-weight: 600; font-size: 14px; flex: none; }
.badge.danger { background: var(--danger-soft); color: var(--danger); }
details.calc { margin-top: 12px; padding: 0; }
details.calc summary { list-style: none; display: flex; align-items: center; gap: 10px; padding: 16px; font-weight: 700; cursor: pointer; color: var(--accent-strong); }
details.calc summary::-webkit-details-marker { display: none; }
details.calc summary svg { width: 22px; height: 22px; flex: none; }
.calc-body { padding: 0 16px 16px; }
.field select { background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 18px) 21px, calc(100% - 13px) 21px; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 34px; }

/* ---------- Dziennik ---------- */
.diary-top h1 { font-size: 24px; }
.topbar .grow { flex: 1; min-width: 0; }
.diary-top .icon-btn { position: relative; overflow: hidden; }
.date-overlay { position: absolute; inset: 0; opacity: 0; width: 100%; height: 100%; font-size: 16px; border: 0; padding: 0; margin: 0; }
.week { display: flex; align-items: stretch; gap: 2px; margin: 0 -8px 14px; }
.week-nav { flex: 0 0 28px; border: 0; background: none; color: var(--muted); display: grid; place-items: center; padding: 0; }
.week-nav svg { width: 20px; height: 20px; }
.week-day {
  flex: 1; min-width: 0; border: 0; background: none; border-radius: 14px; padding: 6px 0 7px;
  display: flex; flex-direction: column; align-items: center; gap: 3px; color: var(--text); touch-action: manipulation;
}
.week-day .wd { font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase; }
.week-day .dn { font-size: 17px; font-weight: 800; width: 34px; height: 34px; display: grid; place-items: center; border-radius: 50%; }
.week-day.today .dn { color: var(--accent-strong); }
.week-day.active .dn { background: var(--accent); color: var(--on-accent); }
.wbar { width: 24px; height: 4px; border-radius: 2px; background: var(--border); overflow: hidden; }
.wbar i { display: block; height: 100%; background: var(--accent); border-radius: 2px; }
.wbar i.over { background: var(--danger); }

.summary { display: flex; align-items: center; gap: 16px; }
.ring-wrap { position: relative; width: 128px; height: 128px; flex: none; }
.ring { width: 100%; height: 100%; }
.ring circle { fill: none; stroke-width: 11; }
.ring .track { stroke: var(--surface-2); }
.ring .bar { stroke: var(--accent); stroke-linecap: round; transition: stroke-dashoffset .5s ease; }
.ring.over .bar { stroke: var(--danger); }
.ring-text { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
.ring-text b { font-size: 26px; font-weight: 800; letter-spacing: -.02em; line-height: 1.1; }
.ring-text span { font-size: 11px; color: var(--muted); font-weight: 600; max-width: 80px; }
.summary-right { flex: 1; min-width: 0; }
.eaten { margin-bottom: 8px; font-size: 14px; }
.eaten b { font-size: 18px; font-weight: 800; }
.mbar + .mbar { margin-top: 7px; }
.mbar-top { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); font-weight: 600; margin-bottom: 3px; gap: 6px; }
.mbar-top b { color: var(--text); }
.mbar-track { height: 6px; border-radius: 3px; background: var(--surface-2); overflow: hidden; }
.mbar-track i { display: block; height: 100%; border-radius: 3px; transition: width .5s ease; }
.bg-p { background: var(--protein); }
.bg-f { background: var(--fat); }
.bg-c { background: var(--carbs); }

.meal { margin-top: 12px; padding: 0; overflow: hidden; }
.meal-head { display: flex; align-items: center; gap: 6px; padding: 14px 12px 14px 16px; }
.meal-head h3 { font-size: 17px; font-weight: 800; }
.meal-head .muted { margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.meal-head .grow { flex: 1; min-width: 0; }
.meal-head .icon-btn { width: 38px; height: 38px; }
.meal-items { border-top: 1px solid var(--border); }
.entry {
  display: flex; align-items: center; gap: 12px; width: 100%; padding: 11px 16px; border: 0; background: none; text-align: left;
  border-bottom: 1px solid var(--border); touch-action: manipulation;
}
.entry:last-child { border-bottom: 0; }
.entry:active { background: var(--surface-2); }
.entry .main { flex: 1; min-width: 0; }
.entry .title { font-weight: 600; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.entry .sub { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.entry .sub .macro-line { font-size: 12px; }
.entry .kcal { font-weight: 800; text-align: right; white-space: nowrap; }
.entry .kcal small { display: block; font-size: 11px; color: var(--muted); font-weight: 600; }
.thumb { width: 42px; height: 42px; border-radius: 10px; object-fit: cover; flex: none; background: var(--surface-2); }
.ai-tag { display: inline-flex; vertical-align: -3px; margin-right: 4px; color: var(--accent-strong); }
.ai-tag svg { width: 16px; height: 16px; }

/* ---------- Dodawanie ---------- */
.add-top { flex: none; padding: 0 20px 10px; display: flex; flex-direction: column; gap: 10px; border-bottom: 1px solid var(--border); }
.meal-chips { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; margin: 0 -20px; padding: 2px 20px; -webkit-overflow-scrolling: touch; }
.meal-chips::-webkit-scrollbar { display: none; }
.meal-chips .chip { flex: none; }
.add-food { padding-top: 14px !important; }
.back { padding-left: 4px; margin: -6px 0 4px -4px; }
.amount-title { font-size: 22px; font-weight: 800; }
.amount-input { display: flex; align-items: baseline; justify-content: center; gap: 8px; margin: 22px 0 14px; }
.amount-input input {
  width: 3em; min-width: 1.6em; max-width: 70%; text-align: center; font-size: 40px; font-weight: 800; border: 0; border-bottom: 2.5px solid var(--accent);
  background: none; outline: none; padding: 4px 0; border-radius: 0; letter-spacing: -.02em;
}
.amount-input span { font-size: 20px; font-weight: 700; color: var(--muted); }
.center-chips { justify-content: center; }
.preview { margin-top: 18px; text-align: center; }
.preview-kcal { font-size: 15px; color: var(--muted); }
.preview-kcal b { font-size: 34px; font-weight: 800; color: var(--text); letter-spacing: -.02em; }
.preview-macros { display: grid; grid-template-columns: repeat(3, 1fr); margin-top: 10px; }
.preview-macros div { display: flex; flex-direction: column; }
.preview-macros b { font-size: 17px; font-weight: 800; }
.preview-macros span { font-size: 12px; color: var(--muted); }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0 8px; }
.grid-3 .input-suffix input { padding-right: 30px; }
.grid-3 .input-suffix em { right: 10px; }
.entry-photo { width: 100%; max-height: 260px; object-fit: cover; border-radius: var(--radius); margin-bottom: 12px; }
.li-icon { width: 22px; height: 22px; color: var(--accent-strong); flex: none; }
.danger-text, .danger-text .li-icon { color: var(--danger); }

/* ---------- Przepisy ---------- */
.ing { padding: 10px 4px 10px 16px; gap: 8px; }
.ing-grams { width: 96px; flex: none; }
.ing-grams input { width: 100%; min-height: 42px; padding: 8px 28px 8px 10px; border-radius: 10px; border: 1.5px solid var(--border); background: var(--surface); text-align: right; font-weight: 700; outline: none; font-size: 16px; }
.ing-grams input:focus { border-color: var(--accent); }
.ing-grams em { right: 10px; }
.ing .icon-btn { width: 36px; height: 36px; color: var(--muted); }
.ing .icon-btn svg { width: 18px; height: 18px; }
.instructions { white-space: pre-wrap; line-height: 1.5; }

/* ---------- Zdjęcie AI ---------- */
.ai-hero { text-align: center; padding: 18px 12px 8px; }
.ai-icon { width: 64px; height: 64px; border-radius: 20px; margin: 0 auto 12px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-strong); }
.ai-icon svg { width: 34px; height: 34px; }
.ai-hero h3 { font-size: 20px; font-weight: 800; margin-bottom: 6px; }
.ai-hero p { margin: 0 auto; max-width: 320px; }
.ai-pick { display: flex; flex-direction: column; gap: 10px; margin-top: 22px; }
.ai-pick label { cursor: pointer; }
.ai-photo { position: relative; border-radius: var(--radius); overflow: hidden; background: var(--surface-2); }
.ai-photo img { width: 100%; max-height: 42vh; object-fit: cover; }
.ai-photo .icon-btn { position: absolute; top: 10px; right: 10px; background: rgba(0,0,0,.5); color: #fff; box-shadow: none; }
.ai-photo.analyzing img { filter: saturate(.7) brightness(.85); }
.scan-line { position: absolute; left: 0; right: 0; height: 3px; background: var(--accent); box-shadow: 0 0 18px 4px color-mix(in srgb, var(--accent) 70%, transparent); animation: scan 2.2s ease-in-out infinite; }
@keyframes scan { 0%, 100% { top: 6%; } 50% { top: 92%; } }
.ai-loading { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 24px 0; text-align: center; }
.ai-loading b { font-size: 17px; }
.ai-result-head { display: flex; gap: 12px; align-items: center; margin-bottom: 12px; }
.ai-thumb { width: 72px; height: 72px; border-radius: 14px; object-fit: cover; flex: none; }
.ai-name { font-weight: 800; font-size: 17px !important; margin-bottom: 6px; min-height: 44px !important; padding: 9px 12px !important; }
.ai-total { margin-bottom: 12px; }
.mbar-top span { white-space: nowrap; }
@media (max-width: 380px) {
  .summary { gap: 12px; padding: 14px; }
  .ring-wrap { width: 104px; height: 104px; }
  .ring-text b { font-size: 22px; }
  .ring-text span { font-size: 10px; }
  .mbar-top { font-size: 11px; }
  .week-day .dn { width: 30px; height: 30px; font-size: 16px; }
}
