:root{
  /* ---- paleta: ceramika bolesławiecka (biel + kobalt + akcent rdzy) ---- */
  --cobalt-900:#12305c;
  --cobalt-800:#173d70;
  --cobalt-700:#1f4e8c;
  --cobalt-600:#2c62a8;
  --cobalt-500:#3b6fb6;
  --cobalt-100:#eaf1fb;

  --rust:#c1573a;
  --rust-dark:#9c4029;

  --bg:#fbf8f2;
  --paper:#ffffff;
  --cream:#f3ede0;
  --cream-2:#ece3d1;
  --line:#e3dcc9;

  --ink:#25211a;
  --ink-soft:#6b6255;
  --ink-faint:#736a59; /* przyciemniony dla kontrastu WCAG AA (≥4.5:1) */

  /* nazwy zachowane dla zgodności z JS: makra dania */
  --red:#c1573a;        /* białko - rdza */
  --red-dark:#9c4029;
  --mustard:#3b6fb6;     /* węglowodany - kobalt */
  --mustard-dark:#1f4e8c;
  --wood:#7c9473;        /* tłuszcz - oliwka (liście na ceramice) */
  --wood-dark:#12305c;   /* granat - tła nagłówka/stopki (zachowana nazwa) */
  --green:#5f8f5a;
  --green-dark:#3f6e3b;

  --shadow: 0 8px 24px rgba(18,48,92,.08);
  --shadow-lg: 0 16px 40px rgba(18,48,92,.14);

  /* ---- tokeny "powierzchni markowych" (ciemne tło + jasny tekst) ----
     dzięki nim komponenty nie zależą od odwracanej skali kobaltu i mają
     wysoki kontrast w obu motywach ---- */
  --plate-from:#2c62a8;  --plate-to:#12305c;  --on-plate:#ffffff;
  --brand-from:#173d70;  --brand-to:#12305c;  --on-brand:#ffffff;
  --banner-from:#12305c; --banner-to:#1f4e8c; --on-banner:#eef4fb;
  --invert-bg:#12305c;   --on-invert:#eef4fb;
  --active-bg:#1f4e8c;   --active-bd:#12305c;  --on-active:#ffffff;
  --pill-over-bg:#fbe7e0; --pill-over-fg:#9c4029;
  --pill-ok-bg:#e8f2e6;   --pill-ok-fg:#3f6e3b;
  --tag-bg:#fbe7e0;       --tag-fg:#9c4029;
  --radius: 16px;
  --font-head: 'Poppins', 'Segoe UI', sans-serif;
  --font-body: 'Inter', 'Segoe UI', sans-serif;
}

*{box-sizing:border-box;}
html,body{margin:0;padding:0;}
html{overflow-x:hidden;}
body{
  font-family:var(--font-body);
  color:var(--ink);
  background:var(--bg);
  min-height:100vh;
  line-height:1.6;
  font-size:15.5px;
  -webkit-font-smoothing:antialiased;
  overflow-x:hidden;
  scrollbar-width:thin;
  scrollbar-color: var(--cobalt-500) var(--cream);
}
::-webkit-scrollbar{width:9px; height:9px;}
::-webkit-scrollbar-track{background:var(--cream);}
::-webkit-scrollbar-thumb{background:var(--cobalt-500); border-radius:8px; border:2px solid var(--cream);}
::-webkit-scrollbar-thumb:hover{background:var(--cobalt-700);}

h1,h2,h3,h4{font-family:var(--font-head); font-weight:600; letter-spacing:-.01em; color:var(--cobalt-900); margin:0 0 .4em;}

/* ---------- dekoracyjny wzór "pawie oczko" (subtelny, ceramika bolesławiecka) ---------- */
.ceramic-dots{
  background-image: radial-gradient(circle, rgba(255,255,255,.9) 0 2px, transparent 2.5px);
  background-size: 16px 16px;
}

/* ---------- HEADER (jasny, jak ceramika bolesławiecka: biel + kobalt) ---------- */
.site-header{
  background:#ffffff;
  color:var(--cobalt-900);
  padding:18px 24px 0;
  box-shadow:0 2px 14px rgba(18,48,92,.10);
  position:relative;
  overflow:hidden;
  border-bottom:1px solid var(--line);
}
.site-header::before{
  /* delikatna grafika talerzy/sztućców w tle nagłówka, w kolorze kobaltu */
  content:"";
  position:absolute; inset:0; pointer-events:none;
  opacity:.07;
  background-image:url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 800 220'><g fill='none' stroke='%231f4e8c' stroke-width='2'><circle cx='700' cy='55' r='42'/><circle cx='700' cy='55' r='27'/><g transform='translate(60,150)'><line x1='0' y1='0' x2='0' y2='60'/><line x1='-7' y1='0' x2='-7' y2='18'/><line x1='7' y1='0' x2='7' y2='18'/><line x1='-7' y1='0' x2='0' y2='22'/><line x1='7' y1='0' x2='0' y2='22'/></g><g transform='translate(90,150)'><line x1='0' y1='0' x2='0' y2='60'/><ellipse cx='0' cy='6' rx='7' ry='10'/></g><circle cx='400' cy='190' r='36'/><circle cx='400' cy='190' r='23'/></g></svg>");
  background-repeat:no-repeat, no-repeat;
  background-position:right -20px top, left 20px bottom;
  background-size:420px 220px;
}
.site-header::after{
  content:""; position:absolute; left:0; right:0; bottom:0; height:14px;
  background-image:url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 16'><circle cx='12' cy='8' r='6' fill='none' stroke='%231f4e8c' stroke-width='1.6'/><circle cx='12' cy='8' r='2.4' fill='%231f4e8c'/><circle cx='2' cy='8' r='1.5' fill='%23c1573a'/><circle cx='22' cy='8' r='1.5' fill='%23c1573a'/></svg>");
  background-repeat:repeat-x; background-size:24px 14px; background-position:left center;
  opacity:.9;
}
.header-top{display:flex; align-items:center; justify-content:space-between; max-width:1320px; margin:0 auto; flex-wrap:wrap; gap:14px; position:relative; z-index:1;}
.brand{display:flex; align-items:center; gap:14px;}
.brand-logo{flex-shrink:0; filter:drop-shadow(0 2px 6px rgba(18,48,92,.15));}
.brand-text h1{color:var(--cobalt-900); font-size:24px; margin:0; letter-spacing:-.01em; font-weight:700;}
.brand-text p{margin:2px 0 0; font-size:12.5px; color:var(--ink-soft); letter-spacing:.03em;}

.header-stats{display:flex; gap:8px; flex-wrap:wrap;}
.stat-pill{
  background:var(--cobalt-100);
  border:1px solid var(--line);
  border-radius:10px; padding:7px 14px; font-size:12.5px; color:var(--cobalt-800);
  display:flex; align-items:center; gap:6px;
}
.stat-pill b{color:var(--rust-dark); font-size:14px; font-weight:700;}

/* nav - poziome menu w kształcie "talerzy", rozciągnięte na całą szerokość, bez przewijania */
.tabs{
  display:flex; max-width:1320px; margin:10px auto 0; border-top:1px solid var(--line);
  padding:10px 4px 14px; position:relative; z-index:1; gap:4px;
}
.tab-btn{
  flex:1 1 0;
  background:transparent; border:none; font-family:var(--font-body);
  padding:8px 8px 10px; cursor:pointer;
  border-radius:16px; white-space:nowrap; display:flex; flex-direction:column; align-items:center; justify-content:center;
  transition:.18s;
}
.tab-plate{
  width:186px; height:46px; border-radius:12px; flex-shrink:0; position:relative;
  background:linear-gradient(155deg, var(--plate-from), var(--plate-to) 85%);
  border:2.5px solid var(--plate-to);
  display:flex; align-items:center; justify-content:center;
  color:var(--on-plate); font-weight:700; font-size:14.5px; letter-spacing:.2px; padding-bottom:6px;
  text-shadow:0 1px 2px rgba(0,0,0,.35);
  box-shadow: inset 0 0 0 3px rgba(255,255,255,.16), 0 3px 10px rgba(18,48,92,.22);
  transition:.18s; overflow:hidden;
}
.tab-plate::after{
  content:""; position:absolute; left:12px; right:12px; bottom:5px; height:6px;
  background-image:url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 6'><circle cx='8' cy='3' r='2' fill='none' stroke='%23ffffff' stroke-width='1' opacity='0.8'/><circle cx='1' cy='3' r='0.9' fill='%23c1573a'/><circle cx='15' cy='3' r='0.9' fill='%23c1573a'/></svg>");
  background-repeat:repeat-x; background-size:16px 6px; opacity:.9; transition:.18s;
}
.tab-btn:hover .tab-plate{border-color:var(--rust); transform:translateY(-2px); box-shadow: inset 0 0 0 3px rgba(255,255,255,.22), 0 5px 14px rgba(18,48,92,.3);}
.tab-btn.active .tab-plate{
  border-color:var(--rust);
  box-shadow: inset 0 0 0 3px rgba(255,255,255,.26), 0 6px 16px rgba(18,48,92,.35);
}

.container{max-width:1320px; margin:0 auto; padding:24px 24px 60px;}
.view{display:none;}
.view.active{display:block; animation:fadeIn .25s ease;}
@keyframes fadeIn{from{opacity:0; transform:translateY(6px);} to{opacity:1; transform:none;}}

/* ---------- PANEL / CARD ---------- */
.panel{
  background:var(--paper); border:1px solid var(--line); border-radius:var(--radius);
  box-shadow:var(--shadow); padding:22px 24px; margin-bottom:22px;
}
.panel-title{display:flex; align-items:center; gap:10px; margin-bottom:14px;}
.panel-title h2{font-size:17px; margin:0; display:flex; align-items:center; gap:8px;}

/* ---------- ustawienia: mniejsze, osobne karty ---------- */
.settings-grid{display:grid; grid-template-columns:repeat(auto-fit,minmax(240px,1fr)); gap:16px; margin-bottom:22px;}
.setting-card{
  background:var(--paper); border:1px solid var(--line); border-radius:14px; padding:18px 20px; box-shadow:var(--shadow);
}
.setting-card label, .field label{display:block; font-size:11.5px; font-weight:700; text-transform:uppercase; letter-spacing:.06em; color:var(--ink-faint); margin-bottom:10px;}
.mode-btns{display:flex; gap:6px; flex-wrap:wrap;}
.mode-btn{
  flex:1; min-width:88px; border:1.5px solid var(--line); background:var(--cream); color:var(--ink-soft);
  padding:9px 8px; border-radius:10px; cursor:pointer; font-weight:600; font-size:12.5px;
  transition:.15s;
}
.mode-btn:hover{border-color:var(--cobalt-500);}
.mode-btn.active{border-color:var(--active-bd); background:var(--active-bg); color:var(--on-active);}
.range-row{display:flex; align-items:center; gap:10px; font-size:13px; color:var(--ink-soft);}
input[type=range]{width:100%; accent-color:var(--cobalt-600);}
.people-stepper{display:flex; align-items:center; gap:12px;}
.step-btn{width:34px;height:34px;border-radius:9px; border:1.5px solid var(--line); background:var(--cream); color:var(--cobalt-800); font-size:17px; font-weight:700; cursor:pointer; transition:.15s;}
.step-btn:hover{border-color:var(--cobalt-500); color:var(--cobalt-700);}
.people-count{font-family:var(--font-head); font-weight:700; font-size:19px; min-width:26px; text-align:center;}
.chip-filters{display:flex; gap:8px; flex-wrap:wrap;}
.chip{
  border:1.5px solid var(--line); background:var(--cream); border-radius:999px; padding:7px 14px; font-size:12.5px;
  font-weight:600; cursor:pointer; color:var(--ink-soft); transition:.15s; user-select:none;
}
.chip:hover{border-color:var(--cobalt-500);}
.chip.active{background:var(--active-bg); border-color:var(--active-bd); color:var(--on-active);}

/* action bar */
.action-bar{display:flex; gap:10px; flex-wrap:wrap; margin-top:16px;}
.btn{
  font-family:var(--font-body); font-weight:600; border-radius:11px; border:none; cursor:pointer;
  padding:11px 20px; font-size:14px; display:inline-flex; align-items:center; gap:8px; transition:.15s;
}
.btn:active{transform:translateY(1px);}
/* przyciski w stylu owalnego półmiska ceramiki bolesławieckiej: białe tło, kobaltowa
   obwódka, drobny pasek wzoru "pawie oczko" wzdłuż dolnej krawędzi */
.btn-primary{
  background:var(--paper); color:var(--cobalt-900); border:2.5px solid var(--cobalt-700);
  border-radius:999px; position:relative; overflow:hidden; padding:11px 22px 15px;
  box-shadow:0 3px 10px rgba(18,48,92,.14);
}
.btn-primary::after{
  content:""; position:absolute; left:16px; right:16px; bottom:4px; height:5px;
  background-image:url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 6'><circle cx='8' cy='3' r='2' fill='none' stroke='%231f4e8c' stroke-width='1'/><circle cx='1' cy='3' r='0.9' fill='%23c1573a'/><circle cx='15' cy='3' r='0.9' fill='%23c1573a'/></svg>");
  background-repeat:repeat-x; background-size:16px 5px; opacity:.85;
}
.btn-primary:hover{border-color:var(--rust); background:var(--cobalt-100);}
.btn-secondary{
  background:var(--paper); color:var(--cobalt-800); border:2px solid var(--cobalt-500);
  border-radius:999px; padding:11px 20px; box-shadow:0 2px 6px rgba(18,48,92,.10);
}
.btn-secondary:hover{border-color:var(--rust); background:var(--cream);}
.btn-ghost{background:transparent; color:var(--cobalt-800); border:1.5px solid var(--line);}
.btn-ghost:hover{border-color:var(--cobalt-500); background:var(--cream);}
.btn-sm{padding:6px 12px; font-size:12px; border-radius:8px;}
.btn-icon{background:none; border:none; cursor:pointer; font-size:16px; padding:4px; border-radius:7px; transition:.15s;}
.btn-icon:hover{background:var(--cream-2);}

/* danie dnia - 4 karty (jedna na typ posiłku), jasne jak reszta strony */
.spotlight-grid{display:grid; grid-template-columns:repeat(auto-fit,minmax(240px,1fr)); gap:14px; margin-bottom:24px;}
.spotlight-mini{
  display:flex; gap:14px; align-items:flex-start; background:var(--paper);
  border-radius:16px; padding:16px 18px; color:var(--ink); box-shadow:var(--shadow);
  border:1px solid var(--line); border-top:3px solid var(--cobalt-600);
}
.spotlight-mini-emoji{font-size:26px; background:var(--cobalt-100); border-radius:12px; width:46px; height:46px; display:flex; align-items:center; justify-content:center; flex-shrink:0;}
.spotlight-mini-body{min-width:0;}
.spotlight-mini .tag{background:var(--tag-bg); color:var(--tag-fg); display:inline-block; padding:2px 9px; border-radius:999px; font-size:10px; letter-spacing:.05em; font-weight:700; margin-bottom:6px;}
.spotlight-mini h4{color:var(--cobalt-900); margin:0 0 4px; font-size:14.5px; line-height:1.3;}
.spotlight-mini .meta{font-size:11.5px; color:var(--ink-soft); margin-bottom:8px;}

/* ---------- tydzień: dni pod sobą ---------- */
.week-toolbar{display:flex; justify-content:space-between; align-items:center; flex-wrap:wrap; gap:10px; margin-bottom:14px;}
.week-list{display:flex; flex-direction:column; gap:14px;}
.day-row{background:var(--paper); border:1px solid var(--line); border-radius:14px; padding:16px 18px;}
.day-row-head{display:flex; align-items:center; justify-content:space-between; padding-bottom:10px; margin-bottom:12px; border-bottom:1px solid var(--line);}
.day-row-head h4{margin:0; font-size:16px; color:var(--cobalt-900); font-weight:700;}
.day-row-meta{display:flex; align-items:center; gap:10px;}
.day-kcal{font-size:12px; color:var(--ink-soft); font-weight:700; background:var(--cream); padding:4px 10px; border-radius:999px;}
.day-kcal.over{color:var(--pill-over-fg); background:var(--pill-over-bg);}
.day-kcal.under{color:var(--cobalt-700); background:var(--cobalt-100);}
.day-kcal.ok{color:var(--pill-ok-fg); background:var(--pill-ok-bg);}
.day-meals{display:flex; gap:12px; flex-wrap:wrap;}

.meal-card{
  flex:1 1 200px; min-width:180px;
  background:var(--cream); border:1px solid var(--line); border-radius:12px; padding:11px 12px; cursor:pointer;
  position:relative; transition:.15s;
}
.meal-card:hover{border-color:var(--cobalt-500); transform:translateY(-1px); box-shadow:0 4px 12px rgba(18,48,92,.08); background:var(--paper);}
.meal-card.eaten{opacity:.5;}
.meal-label{font-size:9.5px; text-transform:uppercase; letter-spacing:.08em; font-weight:700; color:var(--ink-faint); display:flex; justify-content:space-between; align-items:center;}
.meal-name{font-size:13px; font-weight:600; margin:5px 0 6px; color:var(--ink); line-height:1.3;}
.meal-kcal{font-size:11.5px; color:var(--cobalt-800); font-weight:700;}
.meal-tools{display:flex; gap:2px; position:absolute; top:7px; right:7px;}
.meal-fav{font-size:12px;}

/* macro bar */
.macro-bar{display:flex; height:8px; border-radius:999px; overflow:hidden; margin:8px 0; background:var(--line);}
.macro-bar span{height:100%;}
.macro-p{background:var(--red);}
.macro-c{background:var(--mustard);}
.macro-f{background:var(--wood);}
.macro-legend{display:flex; gap:14px; font-size:12px; color:var(--ink-soft); flex-wrap:wrap;}
.macro-legend .dot{display:inline-block; width:9px; height:9px; border-radius:50%; margin-right:4px; vertical-align:middle;}

/* shopping list */
.shop-cat{margin-bottom:18px;}
.shop-cat h4{display:flex; align-items:center; gap:8px; font-size:14px; margin-bottom:8px; color:var(--cobalt-900); font-weight:700;}
.shop-item{display:flex; align-items:center; gap:10px; padding:8px 10px; border-radius:9px; font-size:14px;}
.shop-item:hover{background:var(--cream);}
.shop-item.checked span.iname{text-decoration:line-through; opacity:.45;}
.shop-item input{width:18px; height:18px; accent-color:var(--cobalt-600);}
.shop-item .iqty{margin-left:auto; font-weight:700; color:var(--ink-soft); font-size:12.5px;}

/* recipe cards grid (favorites / knowledge) */
.recipe-grid{display:grid; grid-template-columns:repeat(auto-fill,minmax(230px,1fr)); gap:14px;}
.recipe-card{background:var(--paper); border:1px solid var(--line); border-radius:14px; padding:15px; cursor:pointer; transition:.15s;}
.recipe-card:hover{box-shadow:var(--shadow); transform:translateY(-2px); border-color:var(--cobalt-500);}
.recipe-card .rc-emoji{font-size:24px;}
.recipe-card h4{font-size:14.5px; margin:9px 0 4px; color:var(--ink); font-weight:600;}
.recipe-card .rc-meta{font-size:12px; color:var(--ink-soft);}
.tag-chip{display:inline-block; font-size:10.5px; background:var(--cobalt-100); color:var(--cobalt-800); border-radius:6px; padding:3px 9px; margin:2px 6px 2px 0; font-weight:600; cursor:default; border:1px solid rgba(31,78,140,.12);}

/* modal */
.modal-overlay{position:fixed; inset:0; background:rgba(12,28,50,.6); backdrop-filter:blur(3px); display:none; align-items:center; justify-content:center; z-index:100; padding:20px;}
.modal-overlay.open{display:flex;}
.modal{
  background:var(--paper); border-radius:22px; max-width:640px; width:100%; max-height:88vh; overflow-y:auto;
  box-shadow:0 30px 80px rgba(10,25,50,.35); border:1px solid var(--line);
  animation:modalIn .22s cubic-bezier(.2,.9,.3,1);
  scrollbar-width:thin; scrollbar-color: var(--cobalt-500) var(--cream);
}
.modal::-webkit-scrollbar{width:8px;}
.modal::-webkit-scrollbar-track{background:var(--cream); border-radius:0 22px 22px 0;}
.modal::-webkit-scrollbar-thumb{background:var(--cobalt-500); border-radius:8px;}
@keyframes modalIn{from{opacity:0; transform:translateY(10px) scale(.98);} to{opacity:1; transform:none;}}
.modal-head{background:linear-gradient(120deg,var(--brand-from),var(--brand-to)); padding:24px 26px; border-radius:21px 21px 0 0; color:var(--on-brand); position:relative;}
.modal-head::after{content:""; position:absolute; left:0; right:0; bottom:0; height:3px; background:linear-gradient(90deg, var(--rust), var(--cobalt-500));}
.modal-head h3{color:#fff; margin:0 0 4px; font-size:21px; font-weight:600;}
.modal-close{position:absolute; top:16px; right:18px; background:rgba(255,255,255,.14); border:none; color:#fff; width:32px;height:32px; border-radius:50%; cursor:pointer; font-size:16px; transition:.15s;}
.modal-close:hover{background:rgba(255,255,255,.26); transform:rotate(90deg);}
.modal-body{padding:24px 26px;}
.modal-section{margin-bottom:20px; padding-bottom:20px; border-bottom:1px solid var(--line);}
.modal-section:last-child, .modal-section.no-divider{border-bottom:none; padding-bottom:0;}
.modal-section h4{font-size:12.5px; letter-spacing:.06em; color:var(--ink-faint); font-weight:700; text-transform:uppercase;}
.tags-caption{font-size:11.5px; color:var(--ink-faint); font-weight:700; text-transform:uppercase; letter-spacing:.05em; margin-bottom:6px;}
.ingredient-list{list-style:none; padding:0; margin:0; display:grid; grid-template-columns:1fr 1fr; gap:6px 14px;}
.ingredient-list li{font-size:13.5px; display:flex; justify-content:space-between; border-bottom:1px dotted var(--line); padding-bottom:3px;}
.steps-list{padding-left:20px; margin:0; font-size:13.8px;}
.steps-list li{margin-bottom:8px;}
.alt-list{display:flex; flex-wrap:wrap; gap:7px; margin-top:8px;}
.alt-chip{border:1.5px solid var(--line); background:var(--cream); border-radius:10px; padding:6px 11px; font-size:12.5px; font-weight:600; cursor:pointer; transition:.15s;}
.alt-chip:hover{border-color:var(--cobalt-500); background:var(--paper);}

.kcal-breakdown{margin-top:14px; display:flex; flex-direction:column; gap:6px; border-top:1px dashed var(--line); padding-top:12px;}
.kcal-breakdown-item{display:flex; justify-content:space-between; font-size:12.5px; color:var(--ink-soft);}
.kcal-breakdown-item b{color:var(--cobalt-800); font-weight:700;}

.tip-box{
  display:flex; gap:12px; align-items:flex-start; background:var(--cobalt-100); border:1px solid var(--line);
  border-left:4px solid var(--rust); border-radius:12px; padding:14px 16px; font-size:13.5px; color:var(--ink);
}
.tip-box b{color:var(--cobalt-900);}
.tip-icon{font-size:18px; flex-shrink:0;}

/* knowledge base */
.kb-grid{display:grid; grid-template-columns:repeat(4, 1fr); gap:14px;}
.kb-card{background:var(--paper); border:1px solid var(--line); border-radius:14px; padding:18px; display:flex; flex-direction:column;}
.kb-card h4{font-size:15px; margin-bottom:7px; font-weight:700;}
.kb-card p{font-size:13.5px; color:var(--ink-soft); margin:0 0 10px;}
.kb-pros-cons{display:flex; flex-direction:column; gap:8px; font-size:12.5px;}
.kb-pros-cons div{line-height:1.45;}
.kb-pros-cons b{display:block; margin-bottom:3px; color:var(--cobalt-800);}
@media(max-width:980px){ .kb-grid{grid-template-columns:repeat(2, 1fr);} }
@media(max-width:560px){ .kb-grid{grid-template-columns:1fr;} }
.combine-table{width:100%; border-collapse:collapse; font-size:13px; margin-top:10px;}
.combine-table th, .combine-table td{border:1px solid var(--line); padding:8px 10px; text-align:left;}
.combine-table th{background:var(--cream); font-weight:700; color:var(--cobalt-900);}
.fact-banner{
  background:linear-gradient(120deg, var(--banner-from), var(--banner-to)); color:var(--on-banner); border-radius:14px; padding:16px 20px; margin-bottom:20px;
  display:flex; gap:12px; align-items:center; font-size:13.5px; border:1px solid rgba(255,255,255,.1);
}
.fact-banner b{color:#ffd8a8;}
.facts-list{display:grid; grid-template-columns:repeat(auto-fit,minmax(260px,1fr)); gap:10px;}
.fact-item{background:var(--cream); border-radius:12px; padding:12px 15px; font-size:13.2px; border:1px solid var(--line);}

/* toast */
.toast{position:fixed; bottom:22px; left:50%; transform:translateX(-50%) translateY(20px); background:var(--invert-bg); color:var(--on-invert); padding:13px 24px; border-radius:12px; font-size:13.5px; opacity:0; pointer-events:none; transition:.25s; z-index:200; box-shadow:var(--shadow-lg); font-weight:600; border:1px solid rgba(255,255,255,.14);}
.toast.show{opacity:1; transform:translateX(-50%) translateY(0);}

.empty-note{font-size:13.5px; color:var(--ink-faint); font-style:italic; padding:10px 0;}

/* ---------- stopka: pełna szerokość, wyśrodkowana, jedna linia ---------- */
footer.site-footer{
  background:var(--cobalt-900); color:#bcd0ea; padding:22px 24px; margin-top:30px; font-size:13px;
  width:100%; position:relative; overflow:hidden;
}
footer.site-footer::before{
  content:""; position:absolute; left:0; right:0; top:0; height:14px;
  background-image:url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 16'><circle cx='12' cy='8' r='6' fill='none' stroke='%235eead4' stroke-width='0' /><circle cx='12' cy='8' r='6' fill='none' stroke='%23ffffff' stroke-width='1.6' opacity='0.6'/><circle cx='12' cy='8' r='2.4' fill='%23ffffff' opacity='0.6'/><circle cx='2' cy='8' r='1.5' fill='%23c1573a'/><circle cx='22' cy='8' r='1.5' fill='%23c1573a'/></svg>");
  background-repeat:repeat-x; background-size:24px 14px; background-position:left center;
  opacity:.9;
}
.footer-inner{max-width:1320px; margin:0 auto; text-align:center; display:flex; flex-direction:column; gap:6px; align-items:center;}
.footer-brand{color:#eef4fb; font-weight:700; font-family:var(--font-head);}
.footer-line{font-size:13px; color:#cfe0f2;}
.footer-line b{color:#ffd8a8;}
.footer-note{opacity:.75; font-size:11.5px; max-width:640px;}

/* ---------- Asystent AI: generator przepisów + kalkulator posiłków ---------- */
.text-input{
  width:100%; border:1.5px solid var(--line); background:var(--paper); color:var(--ink);
  border-radius:12px; padding:11px 14px; font-family:var(--font-body); font-size:14px;
  transition:.15s; resize:vertical;
}
.text-input:focus{outline:none; border-color:var(--cobalt-500); box-shadow:0 0 0 3px var(--cobalt-100);}
.ai-input-row{display:flex; gap:10px; margin-top:12px; flex-wrap:wrap;}
.ai-input-row .text-input{flex:1 1 260px;}
.ai-input-row .btn{flex:0 0 auto;}

.ai-badge{
  display:inline-flex; align-items:center; gap:6px; background:var(--cobalt-100); color:var(--cobalt-900);
  font-size:11.5px; font-weight:700; padding:5px 12px; border-radius:999px; margin-bottom:10px;
  border:1px solid rgba(31,78,140,.2);
}
.ai-result-card{
  margin-top:18px; background:var(--paper); border:1px solid var(--line); border-top:3px solid var(--cobalt-600);
  border-radius:14px; padding:18px 20px; box-shadow:var(--shadow);
}
.ai-result-card h3{font-family:var(--font-head); font-size:19px; color:var(--cobalt-900); margin-bottom:4px;}
.ai-result-meta{font-size:13px; color:var(--ink-soft); margin-bottom:10px;}
.ai-disclaimer{
  margin-top:14px; font-size:12px; color:var(--ink-faint); font-style:italic;
  border-top:1px dashed var(--line); padding-top:10px;
}
.ai-empty{padding:16px 0; color:var(--ink-faint); font-size:13.5px; font-style:italic;}

.meallog-items{margin-top:14px; display:flex; flex-direction:column; gap:2px;}
.meallog-row{padding:10px 4px; border-bottom:1px solid var(--line);}
.meallog-row-main{display:flex; justify-content:space-between; align-items:baseline; gap:10px; flex-wrap:wrap; font-size:13.8px;}
.meallog-name{font-weight:600; color:var(--ink); word-break:break-word;}
.meallog-raw{font-weight:400; color:var(--ink-faint); font-size:12.5px;}
.meallog-kcal{font-weight:700; color:var(--cobalt-800); white-space:nowrap;}
.meallog-row-macro{margin-top:3px; font-size:12px; color:var(--ink-soft);}
.meallog-row.unmatched .meallog-name{color:var(--ink-faint); font-style:italic;}
.meallog-row.unmatched .meallog-kcal{color:var(--ink-faint); font-style:italic; font-weight:400;}
.meallog-totals{
  display:flex; gap:18px; flex-wrap:wrap; margin-top:14px; padding:14px 16px; background:var(--cream);
  border-radius:12px; font-size:13.5px; align-items:center;
}
.meallog-totals b{font-family:var(--font-head); color:var(--cobalt-900);}
.meallog-suggest-title{font-size:13px; font-weight:700; color:var(--cobalt-900); margin:16px 0 8px;}
.meallog-suggest-grid{display:grid; grid-template-columns:repeat(auto-fit,minmax(220px,1fr)); gap:10px;}

@media(max-width:780px){
  .tabs{flex-wrap:wrap; row-gap:8px;}
  .tab-btn{flex:1 1 45%; padding:6px 4px 8px;}
  .tab-plate{width:100%; min-width:0; height:42px; font-size:13px;}
  .brand-text h1{font-size:20px;}
  .modal-body .ingredient-list{grid-template-columns:1fr;}
  .panel{padding:18px 16px;}
  .day-meals{flex-direction:column;}
  .meal-card{flex:1 1 auto;}
  .ai-input-row{flex-direction:column;}
  .ai-input-row .btn{width:100%;}
}

@media(max-width:480px){
  .tabs{padding:8px 4px 12px; gap:8px;}
  .tab-btn{flex:1 1 100%; padding:4px 4px 6px;}
  .tab-plate{height:40px; font-size:13px;}
}


/* ============================================================
   LIFTING — dodatki: dostępność, motyw ciemny, druk, ruch
   (dopisane; nie zmieniają istniejących reguł powyżej)
   ============================================================ */

/* ---------- widoczny fokus klawiatury (a11y) ---------- */
a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible,
.tab-btn:focus-visible,
.chip:focus-visible,
.meal-card:focus-visible,
.recipe-card:focus-visible{
  outline:3px solid var(--rust);
  outline-offset:2px;
  border-radius:8px;
}
.tab-btn:focus-visible .tab-plate{ box-shadow:inset 0 0 0 3px rgba(255,255,255,.4), 0 0 0 3px var(--rust); }
/* nie pokazuj obrysu przy kliknięciu myszą, tylko dla klawiatury */
:focus:not(:focus-visible){ outline:none; }

/* ---------- link „przejdź do treści" ---------- */
.skip-link{
  position:absolute; left:12px; top:-60px; z-index:300;
  background:var(--cobalt-900); color:#fff; padding:10px 16px; border-radius:0 0 10px 10px;
  font-weight:700; font-size:13px; transition:top .18s; text-decoration:none;
}
.skip-link:focus{ top:0; }

/* ---------- przełącznik motywu jasny/ciemny ---------- */
.theme-toggle{
  background:var(--cobalt-100); border:1px solid var(--line); color:var(--cobalt-800);
  width:40px; height:40px; border-radius:10px; cursor:pointer; font-size:17px; line-height:1;
  display:inline-flex; align-items:center; justify-content:center; transition:.15s; flex-shrink:0;
}
.theme-toggle:hover{ border-color:var(--rust); }
.header-stats{ align-items:center; }

/* elementy klikalne oparte na roli (chipy) — kursor i brak zaznaczania */
.chip[role="button"]{ user-select:none; }

/* ============================================================
   MOTYW CIEMNY — ta sama tożsamość (głęboki kobalt + rdza)
   Działa automatycznie wg ustawień systemu ORAZ ręcznie
   (html[data-theme="dark"]). Wybór jasny wymusza html[data-theme="light"].
   ============================================================ */
:root[data-theme="dark"]{
  --cobalt-900:#dce8f7; --cobalt-800:#c3d6ef; --cobalt-700:#a9c4e8;
  --cobalt-600:#8fb2e0; --cobalt-500:#6f97cf; --cobalt-100:#1b2c44;
  --rust:#e0785b; --rust-dark:#ed9075;
  --bg:#0e1726; --paper:#152238; --cream:#1b2c44; --cream-2:#233450; --line:#2c3f5e;
  --ink:#eaf1fb; --ink-soft:#b4c4dc; --ink-faint:#8ea3c0;
  --red:#e0785b; --red-dark:#ed9075; --mustard:#6f97cf; --mustard-dark:#a9c4e8;
  --wood:#9fb98f; --wood-dark:#dce8f7; --green:#7fae79; --green-dark:#a7d09f;
  --shadow:0 8px 24px rgba(0,0,0,.35); --shadow-lg:0 16px 40px rgba(0,0,0,.5);
}
@media (prefers-color-scheme: dark){
  :root:not([data-theme="light"]){
    --cobalt-900:#dce8f7; --cobalt-800:#c3d6ef; --cobalt-700:#a9c4e8;
    --cobalt-600:#8fb2e0; --cobalt-500:#6f97cf; --cobalt-100:#1b2c44;
    --rust:#e0785b; --rust-dark:#ed9075;
    --bg:#0e1726; --paper:#152238; --cream:#1b2c44; --cream-2:#233450; --line:#2c3f5e;
    --ink:#eaf1fb; --ink-soft:#b4c4dc; --ink-faint:#8ea3c0;
    --red:#e0785b; --red-dark:#ed9075; --mustard:#6f97cf; --mustard-dark:#a9c4e8;
    --wood:#9fb98f; --wood-dark:#dce8f7; --green:#7fae79; --green-dark:#a7d09f;
    --shadow:0 8px 24px rgba(0,0,0,.35); --shadow-lg:0 16px 40px rgba(0,0,0,.5);
  }
}
/* nagłówek/kafle w ciemnym: białe tło zamień na papierowe */
:root[data-theme="dark"] .site-header,
:root:not([data-theme="light"]) .site-header{ background:var(--paper); }
@media (prefers-color-scheme: dark){
  :root:not([data-theme="light"]) .site-header{ background:var(--paper); }
}
:root[data-theme="dark"] .tab-plate{ color:#eaf1fb; }
:root[data-theme="dark"] .btn-primary,
:root[data-theme="dark"] .btn-secondary,
:root[data-theme="dark"] .setting-card,
:root[data-theme="dark"] .panel{ background:var(--paper); }
:root[data-theme="dark"] .theme-toggle .icon-sun{ display:inline; }
:root[data-theme="dark"] .theme-toggle .icon-moon{ display:none; }
.theme-toggle .icon-sun{ display:none; }
.theme-toggle .icon-moon{ display:inline; }

/* ---------- ograniczony ruch (a11y) ---------- */
@media (prefers-reduced-motion: reduce){
  *, *::before, *::after{
    animation-duration:.001ms !important; animation-iteration-count:1 !important;
    transition-duration:.001ms !important; scroll-behavior:auto !important;
  }
}

/* ============================================================
   STYLE DRUKU — drukuje się tylko aktywna sekcja (np. lista zakupów)
   ============================================================ */
@media print{
  :root{ --bg:#fff; --paper:#fff; --cream:#fff; --line:#bbb; --ink:#000; --ink-soft:#222; --ink-faint:#444; }
  html,body{ background:#fff !important; color:#000 !important; }
  .site-header::before,.site-header::after,.tabs,.theme-toggle,.header-stats,
  .action-bar,.week-toolbar .empty-note,.toast,.modal-overlay,.skip-link,
  .site-footer::before,.fact-banner,.btn{ display:none !important; }
  .site-header{ box-shadow:none; border-bottom:1px solid #000; padding:0 0 8px; }
  .brand-text h1{ font-size:20px; }
  .view{ display:none !important; }
  .view.active{ display:block !important; }
  .panel{ box-shadow:none; border:none; padding:0; margin:0 0 10px; }
  .shop-item{ break-inside:avoid; }
  a[href]::after{ content:""; }
  @page{ margin:14mm; }
}

/* ikona przełącznika w trybie automatycznym + ciemny system */
@media (prefers-color-scheme: dark){
  :root:not([data-theme="light"]) .theme-toggle .icon-sun{ display:inline; }
  :root:not([data-theme="light"]) .theme-toggle .icon-moon{ display:none; }
}

/* ============================================================
   POPRAWKI CZYTELNOŚCI — stopka + wartości kaloryczne
   ============================================================ */

/* Stopka: stały ciemny granat w OBU motywach (zmienna --cobalt-900
   odwraca się w trybie ciemnym, dlatego kolory podane wprost). */
footer.site-footer{ background:#12305c; color:#e7eefa; }
.footer-brand{ color:#ffffff; }
.footer-line{ color:#e7eefa; }
.footer-line b{ color:#ffd8a8; }
.footer-note{ opacity:1; color:#c6d6ec; }

/* Kalorie na kartach — mocniejszy kontrast i wyróżnienie liczby kcal.
   --cobalt-900 daje wysoki kontrast w obu motywach (ciemny w jasnym,
   jasny w ciemnym). */
.meal-kcal{ color:var(--cobalt-900); font-weight:800; font-size:12px; }
.kcal-badge{ color:var(--cobalt-900); font-weight:800; }
.spotlight-mini .meta{ color:var(--ink); }
.recipe-card .rc-meta{ color:var(--ink); }
.kcal-breakdown-item b{ color:var(--cobalt-900); }
.meallog-kcal{ color:var(--cobalt-900); }

/* ============================================================
   TRYB CIEMNY — tokeny pastelowe (plakietki/tagi): ciemne tło + jasny tekst.
   Powierzchnie markowe (zakładki, modal, baner, toast) zostają
   ciemno-kobaltowe w obu motywach, więc mają wysoki kontrast bez nadpisań.
   ============================================================ */
:root[data-theme="dark"]{
  --tag-bg:#3a2620;      --tag-fg:#f0b8a4;
  --pill-over-bg:#3a2620; --pill-over-fg:#f0b8a4;
  --pill-ok-bg:#22321f;   --pill-ok-fg:#a7d09f;
}
@media (prefers-color-scheme: dark){
  :root:not([data-theme="light"]){
    --tag-bg:#3a2620;      --tag-fg:#f0b8a4;
    --pill-over-bg:#3a2620; --pill-over-fg:#f0b8a4;
    --pill-ok-bg:#22321f;   --pill-ok-fg:#a7d09f;
  }
}
/* karta "danie dnia" ma jasny akcent u góry — w ciemnym delikatnie stonuj */
:root[data-theme="dark"] .spotlight-mini{ border-top-color:var(--cobalt-500); }

/* ============================================================
   GRAFIKA TŁA — subtelny, przezroczysty wzór "pawie oczko"
   (ceramika bolesławiecka). Siedzi za treścią, nie wpływa na czytelność.
   ============================================================ */
body::before{
  content:""; position:fixed; inset:0; z-index:-1; pointer-events:none;
  background-image:url("bg-pattern.svg");
  background-repeat:repeat; background-position:center;
  background-size:150px 150px;
  opacity:.055;
}
:root[data-theme="dark"] body::before{ opacity:.11; }
@media (prefers-color-scheme: dark){
  :root:not([data-theme="light"]) body::before{ opacity:.11; }
}
