/* ---------- Tokens ---------- */
:root {
  --bg: #faf8f7;
  --surface: #ffffff;
  --surface-2: #f4f0ef;
  --text: #1b1516;
  --text-muted: #7a6f6d;
  --border: #ece5e3;
  --accent: #96293f;
  --accent-2: #b83a56;
  --accent-tint: #96293f14;
  --danger: #ea580c;
  --warn: #d97706;
  --protein: #3b82f6;
  --carbs: #f59e0b;
  --fat: #a855f7;
  --radius: 20px;
  --radius-sm: 13px;
  --shadow: 0 1px 2px rgba(20, 10, 10, 0.03), 0 6px 20px rgba(20, 10, 10, 0.05);
  --shadow-lg: 0 4px 10px rgba(20, 10, 10, 0.05), 0 16px 40px rgba(20, 10, 10, 0.12);
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #130f0f;
    --surface: #1e1717;
    --surface-2: #271d1d;
    --text: #f4efed;
    --text-muted: #a89996;
    --border: #382a29;
    --accent: #c14d68;
    --accent-2: #d97690;
    --accent-tint: #c14d6822;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.35), 0 6px 20px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 4px 10px rgba(0, 0, 0, 0.35), 0 16px 40px rgba(0, 0, 0, 0.45);
  }
}
:root[data-theme="dark"] {
  --bg: #130f0f;
  --surface: #1e1717;
  --surface-2: #271d1d;
  --text: #f4efed;
  --text-muted: #a89996;
  --border: #382a29;
  --accent: #c14d68;
  --accent-2: #d97690;
  --accent-tint: #c14d6822;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.35), 0 6px 20px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 4px 10px rgba(0, 0, 0, 0.35), 0 16px 40px rgba(0, 0, 0, 0.45);
}

/* =========================================================
   KANAŁ BETA — motyw wg eksportu z Figmy (Ustawienia -> Preferencje
   -> Kanał appki). Tylko na becie; kanał Stabilny (domyślny) wygląda
   dokładnie tak jak dotychczas dla każdego, kto go świadomie nie włączył.
   Ten motyw jest z założenia ciemny (materiał źródłowy nie miał wariantu
   jasnego) — musi wygrać niezależnie od wybranego Jasny/Ciemny/Systemowy,
   stąd świadomie umieszczony NIŻEJ niż oba bloki data-theme powyżej (ta
   sama specyficzność selektora — o wygranej decyduje kolejność w pliku).
   ========================================================= */
:root[data-design="beta"] {
  /* Wartości 1:1 z dostarczonego przez Ciebie referencyjnego style.css
     (nie z odczytu ze zrzutów) — patrz sekcja poniżej. */
  --bg: #0e0e10;
  --surface: #1c1c1e;
  --surface-2: #2a2a2c;
  --text: #f5f5f7;
  --text-muted: #9a9aa0;
  --border: #38383a;
  --accent: #f2622b;
  --accent-2: #f2622b;
  --accent-tint: #f2622b26;
  --danger: #e5544a;
  --warn: #f2622b;
  --protein: #57c08a;
  --carbs: #efe97e;
  --fat: #f2622b;
  --calorie-block: #d9c8fb;
  --calorie-block-text: #1c1c1e;
  --radius: 26px;
  --radius-sm: 18px;
  --shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
  --shadow-lg: 0 20px 48px rgba(0, 0, 0, 0.55);
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-tap-highlight-color: transparent;
  -webkit-font-smoothing: antialiased;
  /* Blokada przybliżania: dopuszczone tylko przewijanie (pan), bez
     pinch-zoom ani zoomu przez podwójne stuknięcie — appka ma się
     zachowywać jak natywna, nie jak strona www. */
  touch-action: pan-x pan-y;
}
body { overscroll-behavior-y: none; }
h1, h2, h3 { margin: 0 0 12px; letter-spacing: -0.01em; }
p { line-height: 1.5; }
button, input, select { font-family: inherit; }
::selection { background: var(--accent-tint); color: var(--accent); }

.hidden { display: none !important; }
.muted { color: var(--text-muted); font-size: 0.92rem; }
.visually-hidden-input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }

/* ---------- App shell ---------- */
#app {
  max-width: 640px;
  margin: 0 auto;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  padding-top: var(--safe-top);
  border-bottom: 1px solid var(--border);
}
.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 52px;
  position: relative;
}
.topbar-inner h1 { font-size: 1.05rem; font-weight: 700; text-align: center; }
.icon-btn {
  background: none;
  border: none;
  font-size: 1.4rem;
  color: var(--text);
  width: 40px;
  height: 40px;
  border-radius: 50%;
  cursor: pointer;
}
.icon-btn:active { background: var(--surface-2); }
.date-label {
  background: none;
  border: none;
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text);
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
}
.date-label:active { background: var(--surface-2); }

main {
  flex: 1;
  padding: 14px 14px calc(90px + var(--safe-bottom));
}

/* ---------- Cards ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 14px;
  box-shadow: var(--shadow);
}
.card h2 { font-size: 0.95rem; font-weight: 700; }

/* ---------- Summary / ring ---------- */
.summary-card {
  display: flex;
  align-items: center;
  gap: 18px;
}
.ring-wrap {
  position: relative;
  width: 120px;
  height: 120px;
  flex-shrink: 0;
}
.ring-svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring-bg { fill: none; stroke: var(--surface-2); stroke-width: 10; }
.ring-fg {
  fill: none;
  stroke: var(--accent);
  stroke-width: 10;
  stroke-linecap: round;
  stroke-dasharray: 326.7;
  stroke-dashoffset: 326.7;
  transition: stroke-dashoffset 0.4s ease, stroke 0.4s ease;
}
.ring-center {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}
.ring-value { font-size: 1.5rem; font-weight: 700; line-height: 1.1; }
.ring-label { font-size: 0.68rem; color: var(--text-muted); max-width: 80px; }

.summary-stats { flex: 1; display: flex; flex-direction: column; gap: 8px; }
.stat { display: flex; justify-content: space-between; border-bottom: 1px solid var(--border); padding-bottom: 6px; }
.stat:last-child { border-bottom: none; padding-bottom: 0; }
.stat-val { font-weight: 700; }
.stat-lbl { color: var(--text-muted); font-size: 0.85rem; }

/* ---------- Macros ---------- */
.macros-card { display: flex; flex-direction: column; gap: 12px; }
.macro-row { display: flex; align-items: center; gap: 10px; }
.macro-name { width: 92px; font-size: 0.88rem; color: var(--text-muted); flex-shrink: 0; }
.macro-bar-track { flex: 1; height: 8px; border-radius: 4px; background: var(--surface-2); overflow: hidden; }
.macro-bar-fill { height: 100%; border-radius: 4px; transition: width 0.3s ease; }
.macro-vals { width: 92px; text-align: right; font-size: 0.82rem; color: var(--text-muted); flex-shrink: 0; }

/* ---------- Meals ---------- */
.meal-section { margin-bottom: 14px; }
.meal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 4px 8px;
}
.meal-title { font-weight: 700; font-size: 0.95rem; }
.meal-kcal { color: var(--text-muted); font-size: 0.85rem; }
.meal-add-btn {
  background: var(--surface);
  border: 1px dashed var(--border);
  color: var(--accent);
  border-radius: var(--radius-sm);
  padding: 10px;
  width: 100%;
  text-align: center;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.9rem;
}
.entry-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  margin-bottom: 6px;
  cursor: pointer;
  transition: transform 0.1s ease, border-color 0.15s ease;
}
.entry-item:active { transform: scale(0.98); border-color: var(--accent); }
.entry-name { font-weight: 600; font-size: 0.92rem; }
.entry-sub { color: var(--text-muted); font-size: 0.78rem; }
.entry-kcal { font-weight: 700; font-size: 0.9rem; white-space: nowrap; margin-left: 10px; }

/* ---------- Lists (foods / weight) ---------- */
.view-header { display: flex; gap: 8px; margin-bottom: 12px; }
.search-input {
  flex: 1;
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 16px;
}
.list { display: flex; flex-direction: column; gap: 8px; }
.list-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  cursor: pointer;
  transition: transform 0.1s ease, border-color 0.15s ease;
}
.list-item:active { transform: scale(0.98); border-color: var(--accent); }
.list-item-main { flex: 1; min-width: 0; }
.list-item-title { font-weight: 600; font-size: 0.94rem; }
.list-item-sub { color: var(--text-muted); font-size: 0.8rem; margin-top: 2px; }
.star-btn { background: none; border: none; font-size: 1.2rem; cursor: pointer; padding: 4px 8px; color: var(--text-muted); transition: transform 0.15s ease; }
.star-btn.active { color: var(--warn); }
.star-btn:active { transform: scale(1.15); }

/* ---------- Znajomi ---------- */
.friend-date-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  margin: 4px 0 2px;
}

/* ---------- Forms ---------- */
.inline-form { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.inline-form input {
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font-size: 16px;
}
.inline-form input[type="number"] { width: 90px; }
/* Pole daty nie miało ograniczonej szerokości — natywny <input type=date>
   bierze wtedy więcej miejsca niż inne pola w tym samym wierszu i nachodzi
   na sąsiadów (Sylwetka: Data + Waga/Talia w jednym .inline-form). Dotyczy
   obu kanałów, to nie jest kwestia wyglądu, tylko realny brak ograniczenia
   szerokości. */
.inline-form input[type="date"] { width: 150px; flex-shrink: 0; }
/* min-width:0 na SAMYM polu (nie tylko na kontenerze .form-grid/flex) —
   natywne kontrolki formularza (input/select) mają domyślnie min-width:auto,
   które w praktyce zachowuje się jak min-content i potrafi zignorować
   ograniczenie z minmax(0, 1fr)/flex-shrink na rodzicu. Dotyczy zwłaszcza
   <input type="date"> na iOS Safari — tam jego naturalna szerokość (żeby
   zmieścić "dd.mm.rrrr" + ikonę) jest spora i realnie zderzała się z tym
   właśnie ograniczeniem, mimo że na Chromium/desktopie wyglądało to dobrze. */
input[type="date"] { min-width: 0; }
.unit-suffix { color: var(--text-muted); }

/* minmax(0, 1fr), nie goły 1fr — bez tego natywny <input type="date"> (jego
   intrinsic/min-content jest spory, zwłaszcza na iOS Safari) potrafi
   "rozepchnąć" kolumnę siatki szerszą niż połowa karty, mimo width:100%
   na samym polu. Dotyczy obu kanałów — to nie kwestia wyglądu. */
.form-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; }
.form-grid label { display: flex; flex-direction: column; gap: 4px; font-size: 0.85rem; color: var(--text-muted); }
.form-grid button { grid-column: 1 / -1; }
/* font-size: 16px (nie rem) celowo — poniżej 16px Mobile Safari/Chrome
   automatycznie przybliżają widok przy focusie na polu. */
.form-grid input, .modal input, .modal select, .modal textarea, .auth-box input {
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font-size: 16px;
  width: 100%;
}
.row-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.92rem;
}
.row-label:last-child { border-bottom: none; }
.row-label select,
.row-label input[type="time"] {
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font-size: 16px;
}

/* ---------- Buttons ---------- */
.btn {
  padding: 11px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  transition: transform 0.1s ease, opacity 0.15s ease, background-color 0.15s ease;
}
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-danger { background: transparent; border-color: var(--danger); color: var(--danger); }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.btn:active { opacity: 0.85; transform: scale(0.97); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }
.btn:disabled:active { transform: none; }

/* ---------- Tab bar ---------- */
.tabbar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 20;
  max-width: 640px;
  margin: 0 auto;
  display: flex;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-top: 1px solid var(--border);
  padding-bottom: var(--safe-bottom);
}
.tab-btn {
  flex: 1;
  background: none;
  border: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 9px 2px 7px;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.62rem;
  min-width: 0;
}
.tab-btn svg { width: 20px; height: 20px; fill: currentColor; transition: transform 0.15s ease; }
.tab-btn span { white-space: nowrap; transition: color 0.15s ease; }
.tab-btn.active { color: var(--accent); }
.tab-btn.active svg { transform: translateY(-1px); }
.tab-btn:active svg { transform: scale(0.9); }

/* ---------- Modal ---------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 10, 10, 0.5);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 50;
}
.modal {
  background: var(--surface);
  width: 100%;
  max-width: 640px;
  max-height: 88vh;
  overflow-y: auto;
  border-radius: var(--radius) var(--radius) 0 0;
  padding: 20px 18px calc(24px + var(--safe-bottom));
  box-shadow: var(--shadow-lg);
}
@media (min-width: 480px) {
  .modal-overlay { align-items: center; }
  .modal { border-radius: var(--radius); max-height: 80vh; }
}
.modal h2 { font-size: 1.1rem; font-weight: 700; }
.modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  background: var(--surface-2);
  border: none;
  border-radius: 50%;
  width: 32px;
  height: 32px;
  font-size: 1.1rem;
  cursor: pointer;
  color: var(--text);
}
.modal-form { display: flex; flex-direction: column; gap: 12px; margin-top: 14px; }
.modal-form label { display: flex; flex-direction: column; gap: 4px; font-size: 0.85rem; color: var(--text-muted); }
.modal-actions { display: flex; gap: 10px; margin-top: 8px; }
.modal-actions .btn { flex: 1; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.two-col label { display: flex; flex-direction: column; gap: 4px; font-size: 0.85rem; color: var(--text-muted); }
.three-col { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; }

/* Poprawianie błędnych wartości odżywczych z bazy online/skanera (dane
   crowdsourcingowe bywają przypisane do złego wariantu produktu). */
.fix-nutrition { margin: 12px 0; }
.fix-nutrition summary { cursor: pointer; font-size: 0.85rem; font-weight: 600; color: var(--accent); }
.fix-nutrition .small-note { margin: 8px 0 10px; font-size: 0.78rem; }
.fix-nutrition .two-col { margin-bottom: 10px; }

.food-pick-list { display: flex; flex-direction: column; gap: 6px; max-height: 40vh; overflow-y: auto; margin: 12px 0; }
.food-pick-item {
  display: flex;
  justify-content: space-between;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  cursor: pointer;
}
.food-pick-item:active { opacity: 0.7; }
.segment {
  display: flex;
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  padding: 3px;
  margin-bottom: 14px;
}
.segment button {
  flex: 1;
  border: none;
  background: none;
  padding: 8px;
  border-radius: 9px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease;
}
.segment button.active { background: var(--surface); color: var(--accent); box-shadow: var(--shadow); }

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  bottom: calc(80px + var(--safe-bottom));
  left: 50%;
  transform: translateX(-50%);
  background: var(--text);
  color: var(--bg);
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 0.88rem;
  z-index: 60;
  box-shadow: var(--shadow);
}

.ios-share-icon { font-style: normal; }

/* ---------- Baner aktualizacji PWA ---------- */
.update-banner {
  position: fixed;
  top: calc(var(--safe-top) + 10px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 40; /* nad topbarem (10), pod modalem (50) */
  width: calc(100% - 28px);
  max-width: 480px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 10px 10px 16px;
  box-shadow: var(--shadow-lg);
  font-size: 0.88rem;
  font-weight: 600;
}
.update-banner .btn { padding: 8px 14px; font-size: 0.85rem; flex-shrink: 0; }

@media (min-width: 640px) {
  main { padding-bottom: 100px; }
}

/* ---------- Blokada poziomej orientacji ---------- */
.landscape-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 9999;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 24px;
  background: var(--bg);
  text-align: center;
}
.landscape-overlay p { color: var(--text-muted); font-weight: 600; max-width: 320px; }
.landscape-overlay-icon { font-size: 2.6rem; transform: rotate(90deg); }
/* max-height (nie max-width!) — w poziomie szerokość telefonu to nawet
   ~930px (duże iPhone'y), więc próg na szerokości by ich nie złapał.
   Wysokość w poziomie to krótszy bok telefonu — u największych iPhone'ów
   to ~430px, a u tabletów/desktopów zawsze wyraźnie więcej, więc to
   właściwe kryterium do odróżnienia telefonu od tabletu/desktopu. */
@media (orientation: landscape) and (max-height: 500px) {
  .landscape-overlay { display: flex; }
}

/* ---------- Ekran ładowania ---------- */
.loading-screen {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  background: var(--bg);
}
.loading-screen img { border-radius: 26%; box-shadow: 0 6px 20px var(--accent-tint); }
.loading-spinner {
  width: 28px;
  height: 28px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: loading-spin 0.7s linear infinite;
}
@keyframes loading-spin {
  to { transform: rotate(360deg); }
}

/* ---------- Auth screen ---------- */
.auth-screen {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  background: var(--bg);
}
.auth-box {
  width: 100%;
  max-width: 380px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 28px 22px;
}
.auth-logo { display: flex; flex-direction: column; align-items: center; gap: 10px; margin-bottom: 6px; }
.auth-logo img { border-radius: 26%; box-shadow: 0 6px 20px var(--accent-tint); }
.auth-logo h1 { margin: 0; font-size: 1.4rem; font-weight: 800; letter-spacing: -0.02em; }
.auth-tagline { text-align: center; margin: 0 0 18px; }
.auth-error {
  color: var(--danger);
  font-size: 0.85rem;
  background: color-mix(in srgb, var(--danger) 12%, transparent);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  margin: 0;
}
.small-note { font-size: 0.78rem; margin: -4px 0 0; }

/* ---------- Search row with scan button ---------- */
.search-row { display: flex; gap: 8px; align-items: center; }
.search-row .search-input { flex: 1; }
.btn-scan {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  font-size: 1.1rem;
}

/* ---------- Barcode scanner (zdjęcie zamiast podglądu wideo) ---------- */
.scanner-photo-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 20px;
  margin-top: 10px;
  font-size: 1.05rem;
  cursor: pointer;
}

/* ---------- Skaner (beta): podgląd kamery na żywo ---------- */
.scanner-video-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3;
  background: #000;
  border-radius: var(--radius-sm);
  overflow: hidden;
  margin-top: 10px;
}
.scanner-video-wrap video { width: 100%; height: 100%; object-fit: cover; display: block; }
.scanner-frame {
  position: absolute;
  inset: 18% 10%;
  border: 3px solid rgba(255, 255, 255, 0.85);
  border-radius: 12px;
  box-shadow: 0 0 0 2000px rgba(0, 0, 0, 0.35);
  pointer-events: none;
}

/* ---------- Stats tiles ---------- */
.stats-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.stat-tile {
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.stat-tile-val { font-size: 1.3rem; font-weight: 700; }
.stat-tile-lbl { font-size: 0.78rem; color: var(--text-muted); }

/* ---------- Recipe qty input ---------- */
/* Specyficzność .qty-input (1 klasa) jest NIŻSZA niż ".modal input" (klasa +
   typ) wyżej w tym pliku — bez tego dopisku szerokość 56px nigdy nie
   wygrywała w modalu przepisu i pole ilości rozciągało się na 100%
   szerokości wiersza, zasłaniając nazwę i kalorie składnika. */
.modal .qty-input {
  width: 56px;
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  text-align: center;
}

/* =========================================================
   KANAŁ BETA — reskin komponentów (kolory/kształty z tokenów wyżej już
   wchodzą automatycznie wszędzie, gdzie kod używa var(--surface) itp.;
   tu tylko to, czego same tokeny nie mogły zmienić — kształty pigułkowe,
   kolorowe bloki na kalorie/makro/wodę i pływająca nawigacja).
   ========================================================= */

/* Karty/wiersze: płaskie, bez obramowania (różnica tonu robi robotę) */
[data-design="beta"] .card,
[data-design="beta"] .list-item,
[data-design="beta"] .food-pick-item,
[data-design="beta"] .stat-tile {
  border-color: transparent;
}
[data-design="beta"] .card h2 { font-size: 1.05rem; letter-spacing: -0.01em; }

/* Modal "Dodaj wpis" — dopasowany do wyglądu Dziennika/Home: wiersze
   produktów jak .food-row z Twoich plików (te same odstępy/promień), nie
   ciaśniejsze .list-item ze Stabilnego. */
[data-design="beta"] .list-item,
[data-design="beta"] .food-pick-item {
  padding: 16px 18px;
  border-radius: var(--radius-sm);
}
[data-design="beta"] .modal h2 { font-size: 1.25rem; font-weight: 700; }

/* Przyciski i pola: pigułka */
[data-design="beta"] .btn { border-radius: 999px; }
[data-design="beta"] input:not([type="checkbox"]):not([type="file"]),
[data-design="beta"] select {
  border-radius: 999px;
}

/* Segment (zakładki): pigułka na białym, aktywna = pomarańczowa */
[data-design="beta"] .segment { background: #fff; border-radius: 999px; padding: 4px; }
[data-design="beta"] .segment button { color: #17151a; border-radius: 999px; }
[data-design="beta"] .segment button.active { background: var(--accent); color: #fff; box-shadow: none; }

/* =========================================================
   DZIENNIK (Beta) — #diary-beta zbudowany OD ZERA, wyłącznie z klas z
   Twojego home.html, oskopowany pod #diary-beta żeby nie kolidować z tymi
   samymi nazwami klas gdzie indziej w appce (np. .card, .icon-btn, .btn).
   #diary-stable to oryginalny, niezmieniony layout kanału Stabilnego —
   dwie osobne gałęzie DOM, patrz index.html. Bez karty Tłuszczu (home.html
   ma tylko Carbs+Protein) i bez przycisków dodawania pod posiłkami (nie ma
   ich w referencji — jedyny dodatek to #beta-fab-add, patrz niżej). */
#diary-beta { display: none; }
[data-design="beta"] #diary-beta { display: block; }
[data-design="beta"] #diary-stable { display: none; }

#diary-beta .top-actions { display: flex; align-items: center; justify-content: space-between; margin-bottom: 22px; }
#diary-beta .greet { display: flex; align-items: center; gap: 12px; font-weight: 600; }
#diary-beta .btns { display: flex; gap: 10px; }
#diary-beta .avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, #f2b56b, #f2622b);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 700;
  font-size: 1rem;
  flex: 0 0 auto;
}
#diary-beta .icon-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--surface-2);
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text);
  cursor: pointer;
  flex: 0 0 auto;
}

/* day-strip: 1:1 z Twoim .day-strip (kolumna wybranego dnia dostaje tło
   --calorie-block, bo samo color:var(--ink) na ciemnym tle byłoby
   niewidoczne), plus dwie Twoje poprawki:
   - przewijany poziomo (szerszy zakres dni niż jeden tydzień, patrz
     DAY_STRIP_RANGE w JS) zamiast sztywnego tygodnia bez dostępu do
     wcześniejszych/późniejszych dni,
   - wybrany dzień dostaje TYLKO jedno fioletowe podświetlenie na całą
     kolumnę (zaokrąglony prostokąt, nie elipsa), bez dodatkowego ciemnego
     kółka wokół samego numeru w środku. */
#diary-beta .day-strip {
  display: flex;
  gap: 4px;
  background: var(--surface);
  border-radius: var(--radius-sm);
  padding: 10px 8px;
  margin-bottom: 26px;
  overflow-x: auto;
  scrollbar-width: none;
}
#diary-beta .day-strip::-webkit-scrollbar { display: none; }
#diary-beta .day-strip .day {
  flex: 0 0 auto;
  width: 38px;
  text-align: center;
  font-size: 0.75rem;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 8px 2px;
  border-radius: var(--radius-sm);
  cursor: pointer;
}
#diary-beta .day-strip .num {
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  color: var(--text);
}
#diary-beta .day-strip .day.today .num { color: var(--accent); }
#diary-beta .day-strip .day.active {
  color: var(--calorie-block-text);
  background: var(--calorie-block);
}
#diary-beta .day-strip .day.active .num { color: var(--calorie-block-text); }

#diary-beta .section-title { font-size: 1.25rem; font-weight: 700; margin: 22px 0 14px; }

#diary-beta .card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 20px;
}
#diary-beta .card-lavender { background: var(--calorie-block); color: var(--calorie-block-text); }

/* Gauge: SVG <path> z łukiem, dokładnie Twoja technika z home.html. */
#diary-beta .gauge-wrap {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 14px 0 4px;
}
#diary-beta .gauge-wrap svg { display: block; }
#diary-beta .gauge-wrap #beta-gauge-fill { stroke: var(--calorie-block-text); transition: d 0.4s ease; }
#diary-beta .gauge-wrap .value {
  position: absolute;
  top: 14px;
  width: 180px;
  height: 100px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  padding-bottom: 10px;
  pointer-events: none;
}
#diary-beta .gauge-wrap .value b { display: block; font-size: 1.5rem; }
#diary-beta .gauge-wrap .value span { font-size: 0.8rem; opacity: 0.7; }
#diary-beta .gauge-scale { display: flex; justify-content: space-between; width: 170px; font-size: 0.75rem; opacity: 0.7; margin-top: 8px; }

/* Karty makro: 1:1 z Twoim .card-grid/.stat-card — tylko Carbs+Protein,
   jak na Home (bez Fat, tego nie ma w referencji). */
#diary-beta .card-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 18px; }
#diary-beta .stat-card { border-radius: var(--radius); padding: 18px; display: flex; flex-direction: column; gap: 10px; }
/* Etykieta i ikonka na jednym, wyśrodkowanym w pionie wierszu — wcześniej
   ikonka siedziała nad etykietą jako osobny "wiersz" (align-self:flex-end
   + stack pionowy), przez co karta zajmowała więcej wysokości niż trzeba i
   zabierała miejsce reszcie ekranu. */
#diary-beta .stat-card-head { display: flex; align-items: center; justify-content: space-between; }
#diary-beta .stat-card .stat-label { font-weight: 600; font-size: 0.95rem; }
#diary-beta .stat-icon {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
#diary-beta .progress-track { height: 6px; border-radius: 999px; background: rgba(0, 0, 0, 0.15); overflow: hidden; margin: 10px 0 6px; }
#diary-beta .progress-fill { height: 100%; background: var(--calorie-block-text); border-radius: 999px; }
#diary-beta .stat-range { display: flex; justify-content: space-between; font-size: 0.75rem; opacity: 0.75; }
#diary-beta .card-green { background: var(--protein); color: var(--calorie-block-text); }
#diary-beta .card-yellow { background: var(--carbs); color: var(--calorie-block-text); }
/* Tłuszcz: jak Fat w diet-details.html — card-orange z BIAŁYM paskiem
   postępu (nie ciemnym jak Carbs/Protein), bo tło jest już nasycone. */
#diary-beta .card-orange { background: var(--accent); color: #fff; }
#diary-beta .card-orange .stat-icon { background: rgba(255, 255, 255, 0.25); }
#diary-beta .card-orange .progress-track { background: rgba(255, 255, 255, 0.25); }
#diary-beta .card-orange .progress-fill { background: #fff; }

/* Posiłki: home.html nie ma dla nich dedykowanego komponentu (tylko jedna
   ogólna karta "Diet Plan" linkująca do przeglądania gotowych diet, czego
   appka nie ma) — lista wpisów złożona z tych samych klas co reszta
   referencji (.food-row/.food-name/.food-macro). */
#diary-beta .food-row { background: var(--surface); border-radius: var(--radius-sm); padding: 16px 18px; margin-bottom: 12px; }
#diary-beta .food-name { font-weight: 600; }
#diary-beta .food-macro { font-size: 0.75rem; color: var(--text-muted); margin-top: 4px; }

/* Dodawanie wpisu: appka bez tego nie działa, a referencja nie ma na Home
   żadnego przycisku dodawania (Diet Plan to tylko link do przeglądania
   gotowych diet) — Twoja decyzja: jeden pływający "+" w rogu ekranu. */
.fab {
  display: none;
  position: fixed;
  right: 20px;
  bottom: calc(100px + var(--safe-bottom));
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  border: none;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-lg);
  cursor: pointer;
  z-index: 15;
}
[data-design="beta"] .fab { display: flex; }

/* Produkty (Beta): usuń "+ Produkt"/"+ Przepis" w rzędzie — jeden pływający
   "+" jak na Dzienniku. Po kliknięciu mini-popup obok przycisku z wyborem
   Produkt/Przepis (Twoja prośba), zamiast od razu otwierać jeden z nich. */
[data-design="beta"] #foods-add-row { display: none; }
.fab-menu {
  position: fixed;
  right: 20px;
  bottom: calc(164px + var(--safe-bottom));
  background: var(--surface);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  z-index: 16;
  min-width: 140px;
}
.fab-menu button {
  background: none;
  border: none;
  color: var(--text);
  font-size: 0.9rem;
  font-weight: 600;
  text-align: left;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
}
.fab-menu button:active { background: var(--surface-2); }

/* Statystyki: kafelki średnich przechodzą przez tę samą paletę co makro */
[data-design="beta"] .stat-tile:nth-child(4n+1) { background: var(--calorie-block); }
[data-design="beta"] .stat-tile:nth-child(4n+2) { background: var(--carbs); }
[data-design="beta"] .stat-tile:nth-child(4n+3) { background: var(--protein); }
[data-design="beta"] .stat-tile:nth-child(4n+4) { background: var(--fat); }
[data-design="beta"] .stat-tile { color: var(--calorie-block-text); }
[data-design="beta"] .stat-tile-lbl { color: var(--calorie-block-text); opacity: 0.75; }

/* Dolna nawigacja: jedna pływająca pigułka z tłem (nie przezroczysta! —
   pierwotna wersja bez własnego tła zostawiała pod spodem widoczną treść
   strony w przerwach między ikonami), 1:1 z referencyjnym .bottom-nav. */
[data-design="beta"] .tabbar {
  left: 50%;
  right: auto;
  transform: translateX(-50%);
  width: auto;
  max-width: none;
  bottom: calc(20px + var(--safe-bottom));
  background: rgba(28, 28, 30, 0.9);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  border-top: none;
  border-radius: 999px;
  padding: 8px;
  gap: 12px;
  box-shadow: var(--shadow-lg);
}
[data-design="beta"] .tab-btn {
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--surface-2);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}
[data-design="beta"] .tab-btn span { display: none; } /* referencja: same ikony, bez podpisów */
[data-design="beta"] .tab-btn svg { width: 20px; height: 20px; }
[data-design="beta"] .tab-btn.active { background: var(--accent); color: #fff; }
[data-design="beta"] main { padding-bottom: calc(96px + var(--safe-bottom)); }

/* Ekran logowania: bez obramowanej karty, pełne tło (tak jak w referencji) */
[data-design="beta"] .auth-box { background: transparent; border: none; box-shadow: none; padding: 0; }
[data-design="beta"] .auth-screen { align-items: flex-start; padding-top: 72px; }
[data-design="beta"] .auth-logo h1 { font-size: 1.7rem; }

/* Stara belka "‹ Dzisiaj ›" — na Becie zastąpiona przez #diary-beta (własny
   nagłówek + day-strip), więc ukryta, żeby się nie dublowała. #date-picker
   jest poza #topbar-diary (bezpośrednio w .topbar), więc "Wybierz datę"
   nadal działa na kanale Stabilnym mimo ukrycia paska na Becie. */
[data-design="beta"] #topbar-diary { display: none; }

/* =========================================================
   USTAWIENIA (Beta) — bez oddzielnej gałęzi DOM jak #diary-beta: sama
   TREŚĆ się nie zmienia między kanałami (te same pola/przełączniki), więc
   wystarczy przemalować wspólny layout na komponenty z Twoich plików
   (list-card/list-row/switch z settings.html + settings-notifications.html,
   .field z ekranów logowania) zamiast duplikować cały DOM/JS drugi raz.
   ========================================================= */

/* Karta konta -> profile-row z awatarem, jak w settings.html */
[data-design="beta"] #settings-account-card {
  display: flex;
  align-items: center;
  gap: 14px;
}
.settings-avatar { display: none; }
[data-design="beta"] .settings-avatar {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: linear-gradient(135deg, #f2b56b, #f2622b);
  color: #fff;
  font-weight: 700;
  font-size: 1.1rem;
  flex: 0 0 auto;
}
[data-design="beta"] #settings-account-card .row-label {
  flex: 1;
  min-width: 0;
  border-bottom: none;
  padding: 0;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
}
[data-design="beta"] #settings-account-card .row-label span { font-size: 0.8rem; color: var(--text-muted); }
[data-design="beta"] #settings-account-card .row-label strong {
  font-size: 1rem;
  font-weight: 600;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Nagłówki kart -> section-title z referencji */
[data-design="beta"] #view-settings .card h2 { font-size: 1.15rem; font-weight: 700; margin-bottom: 14px; }

/* Wiersze etykieta+kontrolka -> więcej oddechu, jak .list-row */
[data-design="beta"] #view-settings .row-label { padding: 14px 0; }

/* Przełączniki (powiadomienia) -> pigułka z kropką, jak .switch z
   settings-notifications.html — to prawdziwy <input type="checkbox">
   ostylowany na wygląd przełącznika (appearance:none + pseudo-elementy),
   nie ozdobny div, żeby cała reszta appki (JS, testy) działała bez zmian. */
[data-design="beta"] #view-settings input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 46px !important;
  height: 26px;
  border-radius: 999px;
  background: var(--surface-2);
  position: relative;
  cursor: pointer;
  flex: 0 0 auto;
  margin: 0;
}
[data-design="beta"] #view-settings input[type="checkbox"]::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  transition: left 0.15s ease;
}
[data-design="beta"] #view-settings input[type="checkbox"]:checked { background: var(--accent); }
[data-design="beta"] #view-settings input[type="checkbox"]:checked::after { left: 23px; }

/* Wiersze-akcje pełnej szerokości z chevronem, jak .list-row.link-row z
   settings.html — zamiast przycisków w rzędzie. Ogólna klasa (nie tylko
   Ustawienia — używana też np. w liście Znajomych). */
[data-design="beta"] .actions-row { flex-direction: column; gap: 0; }
[data-design="beta"] .actions-row .btn {
  width: 100%;
  background: none;
  border: none;
  border-bottom: 1px solid var(--border);
  border-radius: 0;
  color: var(--text);
  text-align: left;
  font-weight: 500;
  padding: 14px 4px;
  position: relative;
}
[data-design="beta"] .actions-row .btn:last-child { border-bottom: none; }
[data-design="beta"] .actions-row .btn::after {
  content: "";
  position: absolute;
  right: 4px;
  top: 50%;
  width: 8px;
  height: 8px;
  border-right: 2px solid var(--text-muted);
  border-bottom: 2px solid var(--text-muted);
  transform: translateY(-50%) rotate(-45deg);
}
[data-design="beta"] .actions-row .btn-danger { color: var(--danger); }

/* =========================================================
   STATYSTYKI (Beta) — jak Ustawienia: sama treść (wykres, kafelki) się
   nie zmienia, więc bez osobnej gałęzi DOM. Karta wykresu -> card-lavender
   jak "Calorie Trends" z analysis.html (drawLineChart() czyta kolory z
   samego <canvas>, więc dziedziczy lokalne nadpisanie --accent poniżej).
   Kafelki średnich już miały kolorowe tło z wcześniejszej fazy (patrz
   .stat-tile:nth-child niżej) — to 1:1 z "Macro Distribution".
   ========================================================= */
[data-design="beta"] #stats-chart-card {
  --accent: var(--calorie-block-text);
  --text-muted: var(--calorie-block-text);
  background: var(--calorie-block);
  border-color: transparent;
  color: var(--calorie-block-text);
}
[data-design="beta"] #stats-chart-card h2 { color: var(--calorie-block-text); }

/* Za dużo opisowego tekstu na Ustawieniach — zostają tylko "Instalacja na
   telefonie" (i to warunkowo, patrz updateInstallCardVisibility() w JS) i
   "O aplikacji", reszta znika. */
[data-design="beta"] #settings-data-desc,
[data-design="beta"] #notif-ios-note {
  display: none;
}

/* Przełączniki dwuwariantowe (Moje/Znajomi, Waga/Pomiary, Talia/Klatka/...,
   Moje produkty/Baza online): z powrotem zwykła pigułka .segment (próba z
   podkreśleniem zamiast pigułki się nie sprawdziła) — brakowało jej tylko
   marginesu na dole, przez co dotykała treści pod spodem (patrz .segment
   w sekcji bazowej, dodane tam, dotyczy obu kanałów). Segment z wieloma
   zakładkami (Talia/Klatka/.../Szyja, 6 sztuk) i tak może nie mieścić się
   w jednej linii na wąskim ekranie — przewijany poziomo. */
[data-design="beta"] #measure-chart-segment {
  overflow-x: auto;
  scrollbar-width: none;
}
[data-design="beta"] #measure-chart-segment::-webkit-scrollbar { display: none; }
[data-design="beta"] #measure-chart-segment button { flex: 0 0 auto; padding: 8px 12px; }

/* Statystyki znajomego (modal) -> ten sam wygląd co "Moje" (lawendowa
   karta kalorii + wykresu, kolorowe kafelki makro), Twoja prośba. */
[data-design="beta"] #friend-cal-card,
[data-design="beta"] #friend-chart-card {
  --accent: var(--calorie-block-text);
  background: var(--calorie-block);
  border-color: transparent;
  color: var(--calorie-block-text);
}
[data-design="beta"] #friend-cal-card .row-label,
[data-design="beta"] #friend-chart-card h2 { color: var(--calorie-block-text); }
[data-design="beta"] #friend-macro-tiles .stat-tile:nth-child(1) { background: var(--protein); }
[data-design="beta"] #friend-macro-tiles .stat-tile:nth-child(2) { background: var(--carbs); }
[data-design="beta"] #friend-macro-tiles .stat-tile:nth-child(3) { background: var(--fat); }
[data-design="beta"] #friend-macro-tiles .stat-tile { color: var(--calorie-block-text); }
[data-design="beta"] #friend-macro-tiles .stat-tile-lbl { color: var(--calorie-block-text); opacity: 0.75; }
[data-design="beta"] #friend-macro-tiles { grid-template-columns: 1fr 1fr 1fr; }

/* Ikona skanera: kod QR na Becie zamiast "▤" (łatwiej odróżnić od reszty
   ikon) — patrz SCAN_ICON_HTML w JS. */
.scan-icon-beta { display: none; }
[data-design="beta"] .scan-icon-stable { display: none; }
[data-design="beta"] .scan-icon-beta { display: inline-block; vertical-align: middle; }
