/* menu.domowe: style wspólne.
   Kierunek: domowy kalendarz ścienny. Dni tygodnia są kolumnami, data to duża cyfra Fraunces,
   nazwy dań zawsze w Fraunces, interfejs w Work Sans zdaniowo (bez wersalików z rozstrzeleniem).
   Ruch tylko tam, gdzie pokazuje, co się zmieniło (patrz sekcja „Ruch” na końcu). */
:root {
  /* paleta: mąka, papier, atrament, szałwia, terakota, miód */
  --bg: #faf6ef;
  --bg-warm: #f4ecdc;
  --paper: #fffdf8;
  --ink: #1c1410;
  --ink-soft: #5a4a3c;
  --ink-muted: #7d6b58;
  --sage: #3d4f2d;
  --sage-deep: #2e3c21;
  --sage-light: #7a8f5c;
  --sage-pale: #e3ebd8;
  --terracotta: #b84a28;
  --terracotta-deep: #9c3d20;
  --terracotta-soft: #d98a6c;
  --terracotta-pale: #fbe8df;
  --gold: #b8904b;
  --gold-ink: #8a6524;
  --gold-pale: #f3e7cc;
  --cream-line: #e8dec9;
  --cream-line-strong: #d9cbaf;
  --cream-line-soft: #f0e7d3;

  --font-display: 'Fraunces', Georgia, 'Times New Roman', serif;
  --font-body: 'Work Sans', -apple-system, BlinkMacSystemFont, sans-serif;

  --shadow-soft: 0 1px 2px rgba(60, 40, 20, 0.05), 0 2px 8px rgba(60, 40, 20, 0.04);
  --shadow-lift: 0 2px 4px rgba(60, 40, 20, 0.06), 0 18px 40px rgba(60, 40, 20, 0.16);
  --shadow-inset: inset 0 0 0 1px var(--cream-line);

  /* promienie: hierarchia, nie jeden na wszystko */
  --radius: 6px;      /* pola, chipy */
  --radius-lg: 10px;  /* karty, kolumny */
  --radius-xl: 14px;  /* duże panele */

  /* ruch */
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --ease-in-out: cubic-bezier(0.77, 0, 0.175, 1);
  --ease-move: cubic-bezier(0.2, 0, 0, 1);
  --dur-press: 140ms;
  --dur-fast: 180ms;
  --dur-base: 240ms;
  --dur-move: 320ms;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }
body {
  margin: 0;
  font-family: var(--font-body);
  font-weight: 400;
  color: var(--ink);
  background: var(--bg);
  font-size: 16px;
  line-height: 1.6;
  min-height: 100vh;
}

body::before {
  content: '';
  position: fixed; inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 200 200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0.4 0 0 0 0 0.3 0 0 0 0 0.15 0 0 0 0.7 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  opacity: 0.035;
  pointer-events: none;
  z-index: 1000;
  mix-blend-mode: multiply;
}

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-variation-settings: 'opsz' 144, 'SOFT' 50;
  font-weight: 400;
  letter-spacing: -0.02em;
  color: var(--ink);
  margin: 0;
  line-height: 1.05;
}

a { color: var(--sage); text-decoration: none; transition: color var(--dur-fast) ease; }
@media (hover: hover) and (pointer: fine) {
  a:hover { color: var(--terracotta); }
}

:focus-visible { outline: 2px solid var(--sage); outline-offset: 2px; border-radius: 4px; }

/* ── Nawigacja ─────────────────────────────────────────────────────────── */
.wordmark {
  font-family: var(--font-display);
  font-variation-settings: 'opsz' 144, 'SOFT' 80, 'wght' 400;
  font-size: 26px;
  letter-spacing: -0.035em;
  color: var(--ink);
  display: inline-flex;
  align-items: baseline;
  gap: 4px;
}
.wordmark em {
  font-style: italic;
  font-variation-settings: 'opsz' 144, 'SOFT' 100, 'wght' 300;
  color: var(--sage);
}
.wordmark-dot {
  width: 5px; height: 5px; border-radius: 50%;
  background: var(--terracotta);
  display: inline-block;
  margin: 0 2px 4px;
}

.site-nav {
  border-bottom: 1px solid var(--cream-line);
  position: sticky; top: 0; z-index: 50;
  backdrop-filter: blur(8px);
  background: rgba(250, 246, 239, 0.92);
  view-transition-name: site-nav;
}
.site-nav__inner {
  max-width: 1280px; margin: 0 auto;
  padding: 18px 32px;
  display: flex; align-items: center; justify-content: space-between;
  gap: 32px;
}
.site-nav__links { display: flex; align-items: center; gap: 4px; }
.site-nav__links a {
  position: relative;
  color: var(--ink-soft);
  font-size: 15px;
  font-weight: 500;
  padding: 8px 14px;
  border-radius: 999px;
  transition: color var(--dur-fast) ease, background-color var(--dur-fast) ease;
}
@media (hover: hover) and (pointer: fine) {
  .site-nav__links a:hover { color: var(--ink); background: var(--bg-warm); }
}
.site-nav__links a.nav-active { color: var(--ink); }
.nav-indicator {
  position: absolute; left: 14px; right: 14px; bottom: 2px;
  height: 2px; border-radius: 2px;
  background: var(--terracotta);
  view-transition-name: nav-indicator;
}
.site-nav__user {
  display: flex; align-items: center; gap: 18px;
  font-size: 14px; color: var(--ink-soft);
}
.site-nav__user-name {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 16px;
  font-variation-settings: 'opsz' 24, 'SOFT' 100, 'wght' 400;
  color: var(--ink);
}

.link-btn {
  background: none; border: none; padding: 0;
  font: inherit; cursor: pointer;
  color: var(--terracotta);
  font-size: 14px;
  font-weight: 500;
  text-decoration: underline;
  text-decoration-color: transparent;
  text-underline-offset: 3px;
  transition: color var(--dur-fast) ease, text-decoration-color var(--dur-fast) ease;
}
@media (hover: hover) and (pointer: fine) {
  .link-btn:hover { color: var(--terracotta-deep); text-decoration-color: currentColor; }
}

main.page {
  max-width: 1280px; margin: 0 auto;
  padding: 56px 32px 96px;
  position: relative;
}
/* Wybór dań potrzebuje szerokości: 7 kolumn ma się mieścić na 1280-1440 px bez ściskania. */
main.page:has(.plan--pick),
body:has(.plan--pick) .site-nav__inner,
body:has(.plan--pick) footer.site-foot { max-width: 1560px; }

/* ── Typografia ────────────────────────────────────────────────────────── */
.eyebrow {
  font-size: 14px;
  font-weight: 500;
  color: var(--terracotta);
  display: inline-flex; align-items: center; gap: 10px;
}
.eyebrow::before { content: ''; width: 20px; height: 1px; background: currentColor; }

.display-xl {
  font-family: var(--font-display);
  font-variation-settings: 'opsz' 144, 'SOFT' 30, 'wght' 400;
  font-size: clamp(48px, 7vw, 92px);
  letter-spacing: -0.035em;
  line-height: 0.95;
  color: var(--ink);
}
.display-xl em {
  font-style: italic;
  font-variation-settings: 'opsz' 144, 'SOFT' 80, 'wght' 300;
  color: var(--sage);
}
.display-lg {
  font-family: var(--font-display);
  font-variation-settings: 'opsz' 144, 'SOFT' 40, 'wght' 400;
  font-size: clamp(36px, 4.5vw, 58px);
  letter-spacing: -0.025em;
  line-height: 1;
}
.display-lg em {
  font-style: italic;
  font-variation-settings: 'opsz' 144, 'SOFT' 100, 'wght' 300;
  color: var(--sage);
}
.display-md {
  font-family: var(--font-display);
  font-variation-settings: 'opsz' 72, 'SOFT' 50, 'wght' 400;
  font-size: clamp(26px, 3vw, 36px);
  letter-spacing: -0.015em;
  line-height: 1.1;
}
.lede {
  font-family: var(--font-display);
  font-variation-settings: 'opsz' 32, 'SOFT' 70, 'wght' 300;
  font-size: clamp(17px, 1.7vw, 21px);
  line-height: 1.5;
  color: var(--ink-soft);
  font-style: italic;
  max-width: 62ch;
  margin: 0;
}

.rule { height: 1px; background: var(--cream-line); border: 0; margin: 32px 0; }

.paper {
  background: var(--paper);
  border: 1px solid var(--cream-line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-soft);
}

/* ── Przyciski ─────────────────────────────────────────────────────────── */
.btn {
  position: relative;
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  padding: 12px 24px;
  background: var(--ink);
  color: var(--bg);
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 15px;
  line-height: 1.3;
  border: 1px solid transparent; cursor: pointer;
  border-radius: 999px;
  text-decoration: none;
  transition: background-color var(--dur-fast) ease, color var(--dur-fast) ease,
              border-color var(--dur-fast) ease, opacity var(--dur-fast) ease,
              transform var(--dur-press) var(--ease-out);
}
.btn:active:not(:disabled) { transform: scale(0.97); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }
.btn--terra { background: var(--terracotta); color: var(--paper); }
.btn--sage { background: var(--sage); color: var(--paper); }
.btn--ghost { background: transparent; color: var(--ink); border-color: var(--cream-line-strong); }
@media (hover: hover) and (pointer: fine) {
  .btn:hover:not(:disabled) { background: var(--sage); color: var(--paper); }
  .btn--terra:hover:not(:disabled) { background: var(--terracotta-deep); }
  .btn--sage:hover:not(:disabled) { background: var(--sage-deep); }
  .btn--ghost:hover:not(:disabled) { background: var(--bg-warm); color: var(--ink); border-color: var(--ink-muted); }
}
/* Przycisk w trakcie pracy: kręciołek przed etykietą. */
.btn.is-loading { cursor: progress; opacity: 1; }
.btn.is-loading::before {
  content: '';
  width: 14px; height: 14px; flex: 0 0 auto;
  border: 2px solid currentColor; border-right-color: transparent;
  border-radius: 50%;
  animation: spin 700ms linear infinite;
}

/* ── Formularze ────────────────────────────────────────────────────────── */
.field { display: block; }
.field + .field { margin-top: 20px; }
.field__label {
  display: block;
  font-size: 14px;
  font-weight: 500;
  color: var(--ink-soft);
  margin-bottom: 6px;
}
.field__label em {
  font-style: italic;
  font-family: var(--font-display); font-size: 14px;
  font-variation-settings: 'opsz' 18, 'SOFT' 100, 'wght' 400;
  color: var(--ink-muted);
}
.input, .textarea {
  width: 100%;
  font-family: var(--font-body);
  font-size: 16px;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--cream-line-strong);
  border-radius: var(--radius);
  padding: 11px 14px;
  transition: border-color var(--dur-fast) ease, box-shadow var(--dur-fast) ease;
}
.input::placeholder, .textarea::placeholder { color: #a8977f; }
.textarea { font-family: var(--font-display); font-variation-settings: 'opsz' 18, 'SOFT' 80; font-size: 17px; line-height: 1.5; resize: vertical; }
.input:focus, .textarea:focus {
  outline: none;
  border-color: var(--sage);
  box-shadow: 0 0 0 4px var(--sage-pale);
}

/* ── Komunikaty i etykiety ─────────────────────────────────────────────── */
.alert {
  padding: 14px 18px;
  border-radius: var(--radius);
  font-size: 15px;
  line-height: 1.5;
  display: flex; align-items: flex-start; gap: 12px;
  margin: 0;
}
.alert--ok { background: var(--sage-pale); color: var(--sage-deep); border-left: 3px solid var(--sage); }
.alert--err { background: var(--terracotta-pale); color: var(--terracotta-deep); border-left: 3px solid var(--terracotta); }
.alert--info { background: var(--gold-pale); color: #6e5019; border-left: 3px solid var(--gold); }
.alert a { color: inherit; text-decoration: underline; text-underline-offset: 3px; font-weight: 500; }
/* Komunikat, który pojawia się w odpowiedzi na akcję, wjeżdża krótko (nie przy pierwszym renderze strony). */
.alert[role="alert"]:not([hidden]), .alert[role="status"]:not([hidden]) { animation: msg-in var(--dur-base) var(--ease-out); }

.pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 11px;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.5;
  border-radius: 999px;
  background: var(--bg-warm);
  color: var(--ink-soft);
  border: 1px solid var(--cream-line);
  white-space: nowrap;
}
.pill--sage { background: var(--sage-pale); color: var(--sage-deep); border-color: transparent; }
.pill--terra { background: var(--terracotta-pale); color: var(--terracotta-deep); border-color: transparent; }
.pill--gold { background: var(--gold-pale); color: #6e5019; border-color: transparent; }
.pill--ink { background: var(--ink); color: var(--bg); border-color: transparent; }

/* ── Gwiazdki oceny (partial dish-rating + katalog) ────────────────────── */
.dish-rating {
  position: relative;
  display: inline-flex;
  gap: 1px;
  font-size: 17px;
  line-height: 1;
  user-select: none;
}
.dish-rating__star {
  display: inline-block;
  cursor: pointer;
  color: var(--cream-line-strong);
  padding: 3px;
  border-radius: 4px;
  transition: color 120ms ease, transform var(--dur-press) var(--ease-out);
}
.dish-rating__star.is-filled { color: var(--gold); }
.dish-rating.is-hovering .dish-rating__star { color: var(--cream-line-strong); }
.dish-rating.is-hovering .dish-rating__star.is-hover-fill { color: var(--gold); }
.dish-rating__star:active { transform: scale(0.88); }
@media (hover: hover) and (pointer: fine) {
  .dish-rating__star:hover { transform: scale(1.12); }
}
/* Po kliknięciu: zapalone gwiazdki „podskakują” po kolei (opóźnienie z --i ustawia skrypt). */
.dish-rating__star.is-pop { animation: star-pop 320ms var(--ease-out) both; animation-delay: calc(var(--i, 0) * 35ms); }
.dish-rating.is-saving { cursor: progress; }
.dish-rating::after {
  content: 'zapisano';
  position: absolute; left: 100%; top: 50%;
  margin-left: 8px;
  font-family: var(--font-body);
  font-size: 12px; color: var(--sage);
  white-space: nowrap;
  opacity: 0;
  transform: translate(-4px, -50%);
  transition: opacity var(--dur-fast) ease, transform var(--dur-fast) var(--ease-out);
  pointer-events: none;
}
.dish-rating.is-saved::after { opacity: 1; transform: translate(0, -50%); }

/* ── Stopka ────────────────────────────────────────────────────────────── */
footer.site-foot {
  max-width: 1280px; margin: 0 auto;
  padding: 32px 32px 40px;
  border-top: 1px solid var(--cream-line);
  display: flex; align-items: baseline; justify-content: space-between;
  color: var(--ink-muted);
  font-size: 14px;
}
footer.site-foot em {
  font-family: var(--font-display);
  font-style: italic;
  font-variation-settings: 'opsz' 18, 'SOFT' 100, 'wght' 400;
  color: var(--sage);
}

/* Ozdobna gałązka (logowanie) */
.sprig { position: absolute; color: var(--sage); opacity: 0.35; pointer-events: none; }
.sprig svg { width: 100%; height: 100%; }

@media (max-width: 860px) {
  .site-nav__inner { padding: 14px 20px; gap: 12px; flex-wrap: wrap; }
  .site-nav__links { order: 3; width: 100%; overflow-x: auto; margin: 0 -14px; }
  main.page { padding: 32px 20px 64px; }
  footer.site-foot { flex-direction: column; gap: 6px; padding: 24px 20px; }
}

/* ══ Niedziela: wspólne ═══════════════════════════════════════════════════ */
.plan__head { margin-bottom: 36px; }
.plan__head h1 { margin: 28px 0 14px; }
.plan__empty { padding: 28px 28px; color: var(--ink-soft); font-family: var(--font-display); font-style: italic; font-size: 18px; font-variation-settings: 'opsz' 24, 'SOFT' 100; }
.plan__actions { display: flex; justify-content: flex-end; align-items: center; gap: 12px; margin-top: 32px; }

/* Pasek kroków: to prawdziwa sekwencja, więc numery mają sens. */
.plan-steps {
  list-style: none; margin: 0; padding: 0;
  display: flex; align-items: center; gap: 6px;
  font-size: 14px;
  counter-reset: none;
}
.plan-steps__item { position: relative; display: flex; align-items: center; gap: 6px; color: var(--ink-muted); }
.plan-steps__item + .plan-steps__item::before {
  content: ''; width: 28px; height: 1px; background: var(--cream-line-strong); margin-right: 6px;
}
.plan-steps__item.is-done + .plan-steps__item::before { background: var(--sage-light); }
.plan-steps__link, .plan-steps__here {
  position: relative;
  display: inline-flex; align-items: center; gap: 8px;
  padding: 4px 10px 4px 4px;
  border-radius: 999px;
  color: inherit;
}
.plan-steps__num {
  display: inline-grid; place-items: center;
  width: 24px; height: 24px; border-radius: 50%;
  font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums;
  border: 1px solid var(--cream-line-strong);
  background: var(--paper);
}
.plan-steps__item.is-done { color: var(--sage); }
.plan-steps__item.is-done .plan-steps__num { background: var(--sage-pale); border-color: transparent; color: var(--sage); }
.plan-steps__item.is-current { color: var(--ink); font-weight: 500; }
.plan-steps__item.is-current .plan-steps__num { background: var(--terracotta); border-color: var(--terracotta); color: var(--paper); }
.plan-steps__bar {
  position: absolute; left: 36px; right: 10px; bottom: -3px;
  height: 2px; border-radius: 2px; background: var(--terracotta);
  view-transition-name: plan-step-bar;
}
@media (hover: hover) and (pointer: fine) {
  .plan-steps__link { transition: background-color var(--dur-fast) ease; }
  .plan-steps__link:hover { background: var(--bg-warm); color: var(--sage-deep); }
}

.plan-banner { margin: 0 0 24px; }
.plan-error { margin-top: 16px; }
.plan-discard { margin-top: 28px; }
/* Atrybut hidden ma wygrywać z display ustawionym przez .btn i .alert. */
.plan [hidden] { display: none !important; }

/* ── Krok 1: ocena ─────────────────────────────────────────────────────── */
.plan-rate-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.plan-rate { display: flex; align-items: center; gap: 18px; padding: 12px 20px 12px 12px; }
.plan-rate__img { width: 64px; height: 64px; border-radius: var(--radius); object-fit: cover; flex: 0 0 auto; background: var(--bg-warm); }
.plan-rate__body { flex: 1; display: flex; flex-direction: column; min-width: 0; gap: 2px; }
.plan-rate__meta { font-size: 13px; color: var(--ink-muted); }
.plan-rate__name { font-family: var(--font-display); font-variation-settings: 'opsz' 32, 'SOFT' 60; font-size: 21px; line-height: 1.2; color: var(--ink); }
.plan-rate .dish-rating { font-size: 24px; margin-right: 64px; }

/* ── Krok 2: układ (edytor wspólny z ustawieniami) ─────────────────────── */
.plan-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 10px; }
.plan-day {
  background: var(--bg-warm);
  border: 1px solid var(--cream-line);
  border-radius: var(--radius-lg);
  padding: 12px 10px 10px;
  display: flex; flex-direction: column; gap: 8px;
  min-height: 168px;
  transition: background-color var(--dur-base) ease, border-color var(--dur-base) ease;
}
.plan-day.is-off { background: transparent; border-style: dashed; }
.plan-day__label { display: flex; justify-content: space-between; align-items: baseline; padding: 0 2px 2px; font-size: 14px; font-weight: 600; }
.plan-day__label small {
  font-family: var(--font-display); font-weight: 400; font-size: 15px;
  font-variation-settings: 'opsz' 24, 'SOFT' 50; color: var(--ink-muted); font-variant-numeric: tabular-nums;
}
.plan-day.is-off .plan-day__label { color: var(--ink-muted); }
.plan-day.is-off .plan-day__chips::before {
  content: 'wolny dzień'; display: block; padding: 18px 0; text-align: center;
  font-family: var(--font-display); font-style: italic; font-size: 14px;
  font-variation-settings: 'opsz' 18, 'SOFT' 100; color: var(--ink-muted);
}
.plan-day__chips { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.plan-chip {
  display: flex; flex-wrap: wrap; align-items: flex-start; gap: 2px 0;
  background: var(--paper);
  border: 1px solid var(--cream-line);
  border-radius: var(--radius);
  padding: 6px 3px 6px 9px;
  font-size: 13.5px; line-height: 1.3;
  box-shadow: var(--shadow-soft);
}
.plan-chip__label { flex: 1 1 0; min-width: 0; padding: 1px 2px 0 0; overflow-wrap: break-word; }
.plan-chip__wish-toggle, .plan-chip__remove {
  flex: 0 0 auto;
  display: inline-grid; place-items: center;
  width: 20px; height: 20px;
  background: none; border: 0; border-radius: 50%; cursor: pointer;
  color: var(--ink-muted); padding: 0; font-size: 14px; line-height: 1;
  transition: color var(--dur-fast) ease, background-color var(--dur-fast) ease, transform var(--dur-press) var(--ease-out);
}
.plan-chip__wish-toggle:active, .plan-chip__remove:active { transform: scale(0.9); }
@media (hover: hover) and (pointer: fine) {
  .plan-chip__wish-toggle:hover, .plan-chip__remove:hover { color: var(--terracotta); background: var(--terracotta-pale); }
}
.plan-chip__wish {
  flex: 1 1 100%; width: 100%; min-width: 0; margin-top: 4px;
  font: inherit; font-size: 13px;
  border: 1px dashed var(--terracotta-soft); border-radius: 4px;
  padding: 4px 6px; color: var(--terracotta-deep); background: var(--paper);
}
.plan-chip__wish:focus { outline: none; border-style: solid; border-color: var(--terracotta); }
.plan-chip__wish:not([hidden]) { animation: wish-in var(--dur-fast) var(--ease-out); }
.plan-chip__wish[hidden] { display: none; }
.plan-chip.is-entering { animation: chip-in var(--dur-base) var(--ease-out) both; }
.plan-chip.is-leaving { animation: chip-out 150ms var(--ease-out) both; pointer-events: none; }
.plan-add {
  font: inherit; font-size: 13px; color: var(--sage);
  background: transparent;
  border: 1px dashed var(--sage-light); border-radius: var(--radius);
  padding: 6px 8px; cursor: pointer; margin-top: auto;
  transition: background-color var(--dur-fast) ease, border-color var(--dur-fast) ease;
}
@media (hover: hover) and (pointer: fine) {
  .plan-add:hover { background: var(--sage-pale); border-style: solid; }
}

.plan-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 16px; margin-top: 24px; }
.plan-total { font-size: 15px; color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.plan-total b { color: var(--ink); font-weight: 600; }
.plan-theme { flex: 1; min-width: 240px; }
.plan-default { font-size: 14px; color: var(--ink-soft); display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }
.plan-default input { accent-color: var(--sage); width: 16px; height: 16px; margin: 0; }
.plan-hint { margin: 12px 0 0; font-size: 14px; color: var(--ink-muted); }
.plan-hint:not([hidden]) { animation: msg-in var(--dur-base) var(--ease-out); }

@media (max-width: 960px) {
  .plan-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (max-width: 560px) {
  .plan-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .plan-steps__label { display: none; }
  .plan-steps__item.is-current .plan-steps__label { display: inline; }
}

/* ── Krok 3: wybór dań (kolumna = dzień, grupa = danie z 3 propozycjami) ─ */
.pick-board {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr)); /* nadpisuje skrypt: puste dni węższe */
  gap: 10px;
  align-items: stretch;
  transition: opacity 200ms ease;
}
/* Akcja trwa: przygaszamy dopiero, gdy serwer myśli dłużej, żeby szybkie kliknięcia nie migały. */
.pick-board.is-busy { pointer-events: none; opacity: 0.6; transition-delay: 400ms; }
.pick-day {
  position: relative;
  background: var(--bg-warm);
  border: 1px solid var(--cream-line);
  border-radius: var(--radius-lg);
  padding: 12px 8px 8px;
  display: flex; flex-direction: column; gap: 10px;
  min-height: 240px; min-width: 0;
  transition: background-color var(--dur-fast) ease, border-color var(--dur-fast) ease, box-shadow var(--dur-fast) ease;
}
.pick-day__label { display: flex; align-items: baseline; gap: 8px; padding: 0 4px; min-width: 0; }
.pick-day__num {
  font-family: var(--font-display);
  font-variation-settings: 'opsz' 144, 'SOFT' 40, 'wght' 380;
  font-size: 34px; line-height: 1; letter-spacing: -0.03em;
  color: var(--ink); font-variant-numeric: lining-nums;
}
.pick-day__name { display: flex; flex-direction: column; min-width: 0; line-height: 1.2; }
.pick-day__dow { font-size: 14px; font-weight: 600; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pick-day__dow--short { display: none; }
.pick-day__month { font-size: 13px; color: var(--ink-muted); }
.pick-day__groups { display: flex; flex-direction: column; gap: 10px; flex: 1; }
.pick-day__free {
  margin: 24px 0 0; text-align: center;
  font-family: var(--font-display); font-style: italic; font-size: 14px;
  font-variation-settings: 'opsz' 18, 'SOFT' 100;
  color: var(--ink-muted);
}
.pick-day.is-empty { background: transparent; border-style: dashed; }
.pick-day.is-empty .pick-day__label { flex-direction: column; align-items: center; gap: 4px; }
.pick-day.is-empty .pick-day__num { font-size: 26px; color: var(--ink-muted); }
.pick-day.is-empty .pick-day__name { align-items: center; }
.pick-day.is-empty .pick-day__dow--full, .pick-day.is-empty .pick-day__month { display: none; }
.pick-day.is-empty .pick-day__dow--short { display: inline; color: var(--ink-muted); }
.pick-board.is-dragging-board .pick-day.is-empty { border-color: var(--sage-light); }
.pick-day.is-drop-target {
  background: var(--sage-pale);
  border-color: var(--sage-light);
  box-shadow: inset 0 0 0 1px var(--sage-light);
}
.pick-day.is-drop-target .pick-day__free { color: var(--sage); }

.pick-group {
  position: relative;
  background: var(--paper);
  border: 1px solid var(--cream-line);
  border-radius: var(--radius-lg);
  padding: 6px 6px 8px;
  display: flex; flex-direction: column; gap: 6px;
  box-shadow: var(--shadow-soft);
  user-select: none; -webkit-user-select: none;
  transition: border-color var(--dur-fast) ease, box-shadow var(--dur-fast) ease, background-color var(--dur-fast) ease;
}
.pick-group.is-complete { border-color: #cdd8bd; }
/* Miejsce po podniesionej grupie: pusty, przerywany obrys tam, skąd ją wzięto. */
.pick-group.is-dragging { background: transparent; border-style: dashed; border-color: var(--cream-line-strong); box-shadow: none; }
.pick-group.is-dragging > * { opacity: 0; }
.pick-group.is-drop-target { border-color: var(--terracotta); box-shadow: 0 0 0 2px var(--terracotta-soft), var(--shadow-soft); }
.pick-group.is-flying { z-index: 5; }

.pick-group__head {
  display: flex; align-items: flex-start; gap: 2px;
  padding: 0 0 0 2px; min-height: 28px;
  font-size: 13px; font-weight: 600; color: var(--ink-soft);
  cursor: grab;
}
.pick-group__grip {
  flex: 0 0 auto; width: 16px; text-align: center; padding-top: 6px;
  cursor: grab; touch-action: none;
  color: var(--cream-line-strong); font-size: 14px; line-height: 1;
  transition: color var(--dur-fast) ease;
}
@media (hover: hover) and (pointer: fine) {
  .pick-group:hover .pick-group__grip { color: var(--ink-muted); }
}
.pick-group__title {
  flex: 1; min-width: 0; line-height: 1.25; padding: 3px 0;
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden;
}
.pick-group__wish { font-style: italic; font-weight: 500; color: var(--terracotta); }
.pick-group__reroll, .pick-group__remove {
  flex: 0 0 auto;
  display: inline-grid; place-items: center;
  width: 28px; height: 28px;
  background: none; border: 0; border-radius: 50%; cursor: pointer;
  color: var(--sage); font-size: 17px; line-height: 1; padding: 0;
  transition: color var(--dur-fast) ease, background-color var(--dur-fast) ease, transform var(--dur-press) var(--ease-out);
}
.pick-group__remove { color: var(--ink-muted); font-size: 18px; }
.pick-group__reroll:active, .pick-group__remove:active { transform: scale(0.9); }
@media (hover: hover) and (pointer: fine) {
  .pick-group__reroll:hover { color: var(--sage-deep); background: var(--sage-pale); }
  .pick-group__remove:hover { color: var(--terracotta); background: var(--terracotta-pale); }
}
.pick-group__reroll-icon { display: inline-block; }
.pick-group.is-rerolling .pick-group__reroll-icon { animation: spin 600ms var(--ease-in-out) infinite; }

.pick-group__cards { display: flex; flex-direction: column; gap: 6px; }
.pick-group__note, .pick-group__empty, .pick-group__msg { margin: 0; padding: 0 4px; font-size: 13px; line-height: 1.35; color: var(--ink-muted); }
.pick-group__empty {
  padding: 16px 8px; text-align: center;
  border: 1px dashed var(--cream-line-strong); border-radius: var(--radius);
  font-family: var(--font-display); font-style: italic; font-size: 14px; font-variation-settings: 'opsz' 18, 'SOFT' 100;
}
.pick-group__msg { color: var(--terracotta-deep); }
.pick-group__msg, .pick-group__note { animation: msg-in var(--dur-base) var(--ease-out); }

.pick-card {
  position: relative;
  display: flex; flex-direction: column;
  text-align: left; font: inherit; color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--cream-line);
  border-radius: var(--radius);
  padding: 0; overflow: hidden; cursor: pointer;
  transition: border-color var(--dur-fast) ease, box-shadow var(--dur-fast) ease,
              opacity var(--dur-base) ease, transform var(--dur-press) var(--ease-out);
}
.pick-card:active { transform: scale(0.98); }
@media (hover: hover) and (pointer: fine) {
  .pick-card:hover { border-color: var(--sage-light); box-shadow: var(--shadow-soft); }
}
.pick-card.is-chosen { border-color: var(--terracotta); box-shadow: 0 0 0 1px var(--terracotta); }
/* Grupa z wyborem: pozostałe propozycje cichną, ale dalej można w nie kliknąć. */
.pick-group.is-complete .pick-card:not(.is-chosen) { opacity: 0.55; }
.pick-group.is-complete .pick-card:not(.is-chosen) .pick-card__img { filter: saturate(0.6); }
@media (hover: hover) and (pointer: fine) {
  .pick-group.is-complete .pick-card:not(.is-chosen):hover { opacity: 1; }
}
.pick-card__img { display: block; width: 100%; height: 72px; flex: 0 0 72px; object-fit: cover; background: var(--bg-warm); transition: filter var(--dur-base) ease; }
.pick-card__body { display: flex; flex-direction: column; gap: 3px; padding: 7px 9px 8px; min-width: 0; }
.pick-card__name {
  font-family: var(--font-display);
  font-variation-settings: 'opsz' 24, 'SOFT' 60, 'wght' 420;
  font-size: 15px; line-height: 1.22; letter-spacing: -0.005em;
  overflow-wrap: break-word; hyphens: auto;
}
.pick-card__meta { display: flex; gap: 8px; flex-wrap: wrap; align-items: baseline; font-size: 12px; color: var(--ink-muted); }
.pick-card__stars { color: var(--gold); letter-spacing: 1px; font-size: 12px; }
.pick-card__unrated { font-style: italic; }
.pick-card__tick {
  position: absolute; top: 6px; right: 6px;
  width: 22px; height: 22px; line-height: 22px; text-align: center;
  border-radius: 50%;
  background: var(--terracotta); color: var(--paper);
  font-size: 12px; font-weight: 700;
  box-shadow: 0 1px 4px rgba(60, 30, 10, 0.3);
}

/* Duch przeciąganej grupy: podnosi się (skala, lekki obrót, cień) i podąża za kursorem. */
.pick-ghost {
  position: fixed; left: 0; top: 0; z-index: 2000;
  margin: 0;
  pointer-events: none;
  cursor: grabbing;
  box-shadow: var(--shadow-soft);
  transition: scale 200ms var(--ease-out), rotate 200ms var(--ease-out), box-shadow 200ms var(--ease-out);
}
.pick-ghost.is-lifted { scale: 1.03; rotate: -1.2deg; box-shadow: var(--shadow-lift); }
html.is-grabbing, html.is-grabbing * { cursor: grabbing !important; user-select: none; -webkit-user-select: none; }

.pick-bar { justify-content: flex-end; position: sticky; bottom: 0; z-index: 20; margin-top: 20px; padding: 14px 0; background: linear-gradient(to bottom, rgba(250, 246, 239, 0), var(--bg) 35%); }
.pick-bar .pick-meter { margin-right: auto; }
/* Pływający przycisk zgłoszeń stoi w prawym dolnym rogu: przyklejony pasek nie może pod niego wejść. */
body:has(#mdpz-root) .pick-bar { padding-right: 188px; }
.pick-meter { display: inline-flex; align-items: center; gap: 12px; }
.pick-meter__track { width: 120px; height: 4px; border-radius: 4px; background: var(--cream-line); overflow: hidden; }
.pick-meter__fill { display: block; height: 100%; width: 100%; background: var(--sage-light); transform-origin: left center; transform: scaleX(0); transition: transform var(--dur-move) var(--ease-out), background-color var(--dur-base) ease; }
.pick-meter.is-full .pick-meter__fill { background: var(--sage); }

/* 961-1180 px (np. 1024): cały tydzień dalej w jednym rzędzie, tylko gęściej. */
@media (max-width: 1180px) {
  main.page:has(.plan--pick) { padding-left: 20px; padding-right: 20px; }
  .pick-board { gap: 6px; }
  .pick-day { padding: 10px 5px 6px; gap: 8px; }
  .pick-day__num { font-size: 28px; }
  .pick-day__label { gap: 6px; }
  .pick-day__dow { font-size: 13px; }
  .pick-day__month { display: none; }
  .pick-group { padding: 4px 4px 6px; }
  .pick-group__head { font-size: 12px; }
  .pick-group__grip { width: 12px; }
  .pick-group__reroll, .pick-group__remove { width: 24px; height: 24px; font-size: 15px; }
  .pick-card__img { height: 56px; flex-basis: 56px; }
  .pick-card__body { padding: 6px 7px 7px; }
  .pick-card__name { font-size: 14px; }
}

/* Wąskie ekrany: kolumny dni przewijają się w poziomie zamiast łamać tydzień w wiersze. */
@media (max-width: 960px) {
  .pick-board {
    display: flex; overflow-x: auto; scroll-snap-type: x proximity;
    padding-bottom: 8px; margin: 0 -20px; padding-left: 20px; padding-right: 20px;
  }
  .pick-day { flex: 0 0 210px; scroll-snap-align: start; }
  .pick-day.is-empty { flex-basis: 84px; }
}

/* ── Krok 4: synchronizacja ────────────────────────────────────────────── */
.sync-progress { margin-bottom: 28px; }
.sync-progress__bar { position: relative; height: 6px; background: var(--cream-line); border-radius: 6px; overflow: hidden; }
.sync-progress__bar span {
  display: block; height: 100%; width: 100%;
  background: var(--sage);
  border-radius: 6px;
  transform-origin: left center;
  transform: scaleX(0);
  transition: transform 600ms var(--ease-out);
}
/* Nic jeszcze nie skończone: pasek „pracuje” stałym, liniowym ruchem. */
.sync-progress.is-indeterminate .sync-progress__bar::after {
  content: '';
  position: absolute; top: 0; bottom: 0; left: 0; width: 30%;
  border-radius: 6px;
  background: var(--sage-light);
  animation: indeterminate 1.4s linear infinite;
}
.sync-progress__now { margin: 10px 0 0; color: var(--ink-soft); font-size: 15px; min-height: 1.6em; }

.sync-attention {
  display: grid; grid-template-columns: auto 1fr; gap: 20px;
  margin: 0 0 28px; padding: 24px 28px;
  background: var(--paper);
  border: 1px solid #ecd2c4;
  border-left: 4px solid var(--terracotta);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-soft);
}
.sync-attention:not([hidden]) { animation: msg-in var(--dur-base) var(--ease-out); }
.sync-attention__icon {
  width: 40px; height: 40px; border-radius: 50%;
  background: var(--terracotta-pale);
  display: grid; place-items: center;
}
.sync-attention__icon::before, .sync-attention__icon::after { content: none; }
.sync-attention__icon span { display: flex; gap: 4px; }
.sync-attention__icon span::before, .sync-attention__icon span::after {
  content: ''; width: 4px; height: 14px; border-radius: 2px; background: var(--terracotta);
}
.sync-attention__title { font-family: var(--font-display); font-size: 24px; line-height: 1.2; font-variation-settings: 'opsz' 48, 'SOFT' 50; margin: 6px 0 8px; }
.sync-attention__body p { margin: 0 0 10px; color: var(--ink-soft); max-width: 70ch; }
.sync-attention__steps { margin: 0 0 14px; padding-left: 20px; color: var(--ink); }
.sync-attention__steps li + li { margin-top: 4px; }
.sync-attention__steps a { text-decoration: underline; text-underline-offset: 3px; }
.sync-attention__detail { font-size: 14px; color: var(--ink-muted); }
.sync-attention__detail summary { cursor: pointer; width: fit-content; }
.sync-attention__detail p { margin: 8px 0 0; padding: 10px 12px; background: var(--bg-warm); border-radius: var(--radius); font-size: 13px; color: var(--ink-soft); overflow-wrap: anywhere; }

.sync-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.sync-item {
  display: flex; align-items: center; gap: 16px;
  padding: 12px 18px;
  background: var(--paper);
  border: 1px solid var(--cream-line);
  border-radius: var(--radius-lg);
  transition: background-color var(--dur-base) ease, border-color var(--dur-base) ease;
}
.sync-item__mark {
  flex: 0 0 auto;
  position: relative;
  width: 26px; height: 26px; border-radius: 50%;
  display: grid; place-items: center;
  font-size: 14px; font-weight: 700; line-height: 1;
  color: var(--ink-muted);
  border: 1.5px solid var(--cream-line-strong);
  transition: background-color var(--dur-base) ease, border-color var(--dur-base) ease, color var(--dur-base) ease;
}
.sync-item--ok .sync-item__mark { background: var(--sage); border-color: var(--sage); color: var(--paper); }
.sync-item--failed .sync-item__mark { background: var(--terracotta); border-color: var(--terracotta); color: var(--paper); }
.sync-item--running { border-color: var(--gold); background: #fdf7ea; }
.sync-item--running .sync-item__mark { border-color: var(--gold-pale); border-top-color: var(--gold); animation: spin 800ms linear infinite; }
.sync-item--paused .sync-item__mark { border-style: dashed; }
.sync-item--paused { background: transparent; }
.sync-item__body { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.sync-item__name { font-family: var(--font-display); font-variation-settings: 'opsz' 32, 'SOFT' 60; font-size: 19px; line-height: 1.25; }
.sync-item__date { font-size: 13px; color: var(--ink-muted); }
.sync-item__error { font-size: 13px; color: var(--terracotta-deep); overflow-wrap: anywhere; }
.sync-item__state { font-size: 13px; color: var(--ink-muted); white-space: nowrap; }
.sync-item--ok .sync-item__state { color: var(--sage); }
.sync-item--failed .sync-item__state { color: var(--terracotta-deep); }
.sync-item--running .sync-item__state { color: var(--gold-ink); }
.sync-item.is-entering { animation: rise-in var(--dur-base) var(--ease-out) both; animation-delay: calc(var(--i, 0) * 40ms); }
.sync-item.is-changed .sync-item__mark { animation: mark-pop 360ms var(--ease-out); }

/* ══ Ruch ═════════════════════════════════════════════════════════════════
   Czasy: naciśnięcie 140 ms, drobne 180 ms, wejścia 240 ms, przesunięcia 320 ms.
   Krzywe: --ease-out na wejścia, --ease-move (FLIP) na ruch po ekranie, liniowo tylko pętle. */
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes msg-in { from { opacity: 0; transform: translateY(-4px); } }
@keyframes rise-in { from { opacity: 0; transform: translateY(8px); } }
@keyframes fade-in { from { opacity: 0; } }
@keyframes chip-in { from { opacity: 0; transform: translateY(-4px) scale(0.96); } }
@keyframes chip-out { to { opacity: 0; transform: scale(0.94); } }
@keyframes wish-in { from { opacity: 0; transform: translateY(-3px); } }
@keyframes star-pop { 0% { transform: scale(1); } 45% { transform: scale(1.3); } 100% { transform: scale(1); } }
@keyframes mark-pop { 0% { transform: scale(0.6); opacity: 0.4; } 60% { transform: scale(1.12); opacity: 1; } 100% { transform: scale(1); } }
@keyframes indeterminate { from { transform: translateX(-100%); } to { transform: translateX(340%); } }
@keyframes card-in { from { opacity: 0; transform: translateY(8px); filter: blur(2px); } }
@keyframes tick-in { from { opacity: 0; transform: scale(0.5); } 70% { transform: scale(1.1); } to { opacity: 1; transform: scale(1); } }
@keyframes dim-in { from { opacity: 1; } }

/* Wejście strony logowania: jedna zaaranżowana sekwencja (pozostałe strony mają przejście widoku). */
.rise { animation: rise-in 600ms var(--ease-out) both; }
.rise-1 { animation-delay: 80ms; }
.rise-2 { animation-delay: 160ms; }

/* Wybór dań: propozycje wchodzą kaskadą (opóźnienie z --d, ustawia skrypt). */
.pick-group.is-entering { animation: rise-in 280ms var(--ease-out) both; animation-delay: var(--d, 0ms); }
.pick-card.is-entering { animation: card-in 280ms var(--ease-out) both; animation-delay: var(--d, 0ms); }
.pick-group.is-just-chosen .pick-card.is-chosen .pick-card__tick { animation: tick-in 260ms var(--ease-out) both; }
.pick-group.is-just-chosen .pick-card:not(.is-chosen) { animation: dim-in var(--dur-base) ease both; }

/* Przejścia między stronami (przeglądarki z View Transitions): treść krótko przenika,
   nawigacja stoi w miejscu, a znacznik aktywnej zakładki i kroku niedzieli przesuwa się. */
@view-transition { navigation: auto; }
::view-transition-old(root) { animation: 120ms ease-out both vt-out; }
::view-transition-new(root) { animation: 240ms var(--ease-out) 40ms both vt-in; }
::view-transition-group(nav-indicator),
::view-transition-group(plan-step-bar) { animation-duration: var(--dur-move); animation-timing-function: var(--ease-move); }
@keyframes vt-out { to { opacity: 0; } }
@keyframes vt-in { from { opacity: 0; transform: translateY(6px); } }

/* Ograniczony ruch: zostają przenikania (pomagają zrozumieć zmianę), znika przesuwanie i skalowanie. */
@media (prefers-reduced-motion: reduce) {
  ::view-transition-new(root) { animation-name: fade-in; }
  ::view-transition-group(*) { animation-duration: 0s; }
  .rise, .sync-item.is-entering, .pick-group.is-entering, .pick-card.is-entering {
    animation: fade-in 160ms ease both; animation-delay: 0ms;
  }
  .alert[role="alert"]:not([hidden]), .alert[role="status"]:not([hidden]),
  .sync-attention:not([hidden]), .plan-hint:not([hidden]),
  .pick-group__msg, .pick-group__note, .plan-chip__wish:not([hidden]),
  .plan-chip.is-entering { animation: fade-in 160ms ease both; }
  .plan-chip.is-leaving { animation: none; opacity: 0; }
  .dish-rating__star.is-pop, .sync-item.is-changed .sync-item__mark,
  .pick-group.is-just-chosen .pick-card.is-chosen .pick-card__tick { animation: none; }
  .btn:active:not(:disabled), .pick-card:active, .dish-rating__star:active, .dish-rating__star:hover { transform: none; }
  .pick-ghost.is-lifted { scale: 1; rotate: 0deg; }
  .pick-group.is-rerolling .pick-group__reroll-icon { animation-duration: 1.6s; animation-timing-function: linear; }
  .sync-progress__bar span, .pick-meter__fill { transition-duration: 0s; }
  .sync-progress.is-indeterminate .sync-progress__bar::after { animation: none; left: 0; width: 100%; opacity: 0.35; }
  .sync-item--running .sync-item__mark { animation-duration: 2.4s; }
}
