/* Kalorie — trzy motywy: A Emalia, B Etykieta, C Karnet.
   Motyw: <html data-theme="a|b|c" data-scheme="light|dark"> (ustawia boot.js przed pierwszym malowaniem). */

@font-face { font-family: "Rubik"; src: url("/fonts/Rubik.ttf") format("truetype"); font-weight: 300 900; font-display: swap; }
@font-face { font-family: "Archivo"; src: url("/fonts/Archivo.ttf") format("truetype"); font-weight: 100 900; font-stretch: 62% 125%; font-display: swap; }
@font-face { font-family: "Barlow"; src: url("/fonts/Barlow-Regular.ttf") format("truetype"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Barlow"; src: url("/fonts/Barlow-Medium.ttf") format("truetype"); font-weight: 500 700; font-display: swap; }
@font-face { font-family: "Barlow Condensed"; src: url("/fonts/BarlowCondensed-SemiBold.ttf") format("truetype"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Barlow Condensed"; src: url("/fonts/BarlowCondensed-Bold.ttf") format("truetype"); font-weight: 700 900; font-display: swap; }

/* ---------- A · Emalia ---------- */
:root, [data-theme="a"] {
  color-scheme: light;
  --font: "Rubik", system-ui, sans-serif;
  --font-display: "Rubik", system-ui, sans-serif;
  --display-weight: 700; --display-tt: none; --display-ls: -0.01em; --display-stretch: 100%;
  --ground: #eef1f5; --surface: #ffffff; --surface-2: #f1f3f7;
  --line: #161a23; --line-w: 2.5px; --radius: 22px; --btn-radius: 14px; --input-radius: 12px;
  --hair: #c5ccd8; --hair-style: dashed;
  --ink: #12151c; --ink-2: #464e5e; --num: #12151c;
  --accent: #1d4bb8; --accent-ink: #ffffff; --accent-soft: #dfe7fa; --link: #1d4bb8;
  --shell: #1d4bb8; --shell-ink: #ffffff; --shell-ink-2: #e3e9f8; --shell-edge: #161a23;
  --tab-bg: #ffffff; --tab-ink: #464e5e; --tab-on: #1d4bb8; --tab-edge: #161a23;
  --fab-bg: #1d4bb8; --fab-ink: #ffffff; --fab-ring: #161a23;
  --protein: #1d4bb8; --fat: #e3a008; --carbs: #23935a;
  --over: #c8331e; --gain: #8a5d00; --gain-fill: #e3a008; --gain-soft: #fbefcc;
  --bar: #1d4bb8; --grid: #dde2ea; --target: #464e5e;
  --shadow: 0 6px 14px -8px rgba(10, 20, 50, .35);
  --danger: #c8331e;
}
[data-theme="a"][data-scheme="dark"] {
  color-scheme: dark;
  --ground: #0b1120; --surface: #141c30; --surface-2: #1b2540;
  --line: #3a4868; --hair: #33405c;
  --ink: #f3f5fa; --ink-2: #b4bdd0; --num: #f3f5fa;
  --accent: #2f5bd0; --accent-ink: #ffffff; --accent-soft: #1c2d58; --link: #9db7ff;
  --shell: #17306e; --shell-ink: #ffffff; --shell-ink-2: #c9d6f5; --shell-edge: #3a4868;
  --tab-bg: #141c30; --tab-ink: #b4bdd0; --tab-on: #9db7ff; --tab-edge: #3a4868;
  --fab-bg: #2f5bd0; --fab-ink: #ffffff; --fab-ring: #3a4868;
  --protein: #6f94ff; --fat: #f0b429; --carbs: #3fbf7f;
  --over: #f0624c; --gain: #f0b429; --gain-fill: #f0b429; --gain-soft: #3a2f12;
  --bar: #6f94ff; --grid: #26304a; --target: #b4bdd0;
  --shadow: 0 6px 16px -8px rgba(0, 0, 0, .6);
  --danger: #f0624c;
}

/* ---------- B · Etykieta ---------- */
[data-theme="b"] {
  color-scheme: light;
  --font: "Archivo", system-ui, sans-serif;
  --font-display: "Archivo", system-ui, sans-serif;
  --display-weight: 900; --display-tt: uppercase; --display-ls: 0; --display-stretch: 72%;
  --ground: #e9ebee; --surface: #ffffff; --surface-2: #f1f2f4;
  --line: #0e0f12; --line-w: 2px; --radius: 2px; --btn-radius: 2px; --input-radius: 2px;
  --hair: #c9cdd4; --hair-style: solid;
  --ink: #0e0f12; --ink-2: #4a4f59; --num: #0e0f12;
  --accent: #15213b; --accent-ink: #ffffff; --accent-soft: #e4e8f1; --link: #1f5fd1;
  --shell: #15213b; --shell-ink: #ffffff; --shell-ink-2: #c9d3ea; --shell-edge: #15213b;
  --tab-bg: #15213b; --tab-ink: #c9d3ea; --tab-on: #ffffff; --tab-edge: #15213b;
  --fab-bg: #ffffff; --fab-ink: #0e0f12; --fab-ring: #0e0f12;
  --protein: #1f5fd1; --fat: #c4570a; --carbs: #0b7f70;
  --over: #c21f1f; --gain: #0a7d45; --gain-fill: #0a7d45; --gain-soft: #dcf2e6;
  --bar: #1f5fd1; --grid: #dfe1e5; --target: #0e0f12;
  --shadow: none;
  --danger: #c21f1f;
}
[data-theme="b"][data-scheme="dark"] {
  color-scheme: dark;
  --ground: #08090c; --surface: #121419; --surface-2: #1b1e25;
  --line: #f2f3f5; --hair: #343943;
  --ink: #f2f3f5; --ink-2: #b3b8c3; --num: #f2f3f5;
  --accent: #e9edf5; --accent-ink: #0e0f12; --accent-soft: #1d2433; --link: #8fb2ff;
  --shell: #0f1830; --shell-edge: #0f1830;
  --tab-bg: #0f1830; --tab-edge: #0f1830;
  --fab-bg: #121419; --fab-ink: #ffffff; --fab-ring: #f2f3f5;
  --protein: #6c9bff; --fat: #ff9a52; --carbs: #36c2ad;
  --over: #ff6b6b; --gain: #4fd08f; --gain-fill: #4fd08f; --gain-soft: #113322;
  --bar: #6c9bff; --grid: #262a33; --target: #f2f3f5;
  --danger: #ff6b6b;
}

/* ---------- C · Karnet ---------- */
[data-theme="c"] {
  color-scheme: light;
  --font: "Barlow", system-ui, sans-serif;
  --font-display: "Barlow Condensed", "Barlow", system-ui, sans-serif;
  --display-weight: 700; --display-tt: uppercase; --display-ls: .03em; --display-stretch: 100%;
  --ground: #ecebe6; --surface: #ffffff; --surface-2: #f4f3ef;
  --line: #c7cbd6; --line-w: 1.5px; --radius: 10px; --btn-radius: 8px; --input-radius: 8px;
  --hair: #c7cbd6; --hair-style: solid;
  --ink: #0d1b3d; --ink-2: #4c5670; --num: #4b2e83;
  --accent: #c8202a; --accent-ink: #ffffff; --accent-soft: #fbe3e4; --link: #b51d26;
  --shell: #0d1b3d; --shell-ink: #ffffff; --shell-ink-2: #c3cbe0; --shell-edge: #0d1b3d;
  --tab-bg: #0d1b3d; --tab-ink: #b9c2da; --tab-on: #ffffff; --tab-edge: #c8202a;
  --fab-bg: #c8202a; --fab-ink: #ffffff; --fab-ring: #0d1b3d;
  --protein: #4b2e83; --fat: #b7791f; --carbs: #1f7a8c;
  --over: #c8202a; --gain: #8a5a12; --gain-fill: #b7791f; --gain-soft: #f6ead6;
  --bar: #4b2e83; --grid: #dedfe4; --target: #0d1b3d;
  --shadow: 0 3px 10px -6px rgba(13, 27, 61, .35);
  --danger: #c8202a;
}
[data-theme="c"][data-scheme="dark"] {
  color-scheme: dark;
  --ground: #070d1f; --surface: #111c3d; --surface-2: #17244b;
  --line: #2a3760; --hair: #2a3760;
  --ink: #eef1f8; --ink-2: #aeb7cf; --num: #c4b2ff;
  --accent: #d92f37; --accent-ink: #ffffff; --accent-soft: #3a1520; --link: #ff8a8f;
  --shell: #050a18; --shell-edge: #050a18;
  --tab-bg: #050a18;
  --fab-bg: #d92f37; --fab-ring: #050a18;
  --protein: #c4b2ff; --fat: #f2b950; --carbs: #5cc8d8;
  --over: #ff6b6b; --gain: #f2b950; --gain-fill: #f2b950; --gain-soft: #3a2c10;
  --bar: #c4b2ff; --grid: #22305a; --target: #eef1f8;
  --shadow: 0 4px 12px -6px rgba(0, 0, 0, .6);
  --danger: #ff6b6b;
}

/* ---------- podstawa ---------- */
* { box-sizing: border-box; }
html, body { margin: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font: 400 16px/1.45 var(--font); background: var(--ground); color: var(--ink);
  font-variant-numeric: tabular-nums; -webkit-tap-highlight-color: transparent;
}
::selection { background: var(--accent); color: var(--accent-ink); }
:focus-visible { outline: 3px solid var(--link); outline-offset: 2px; }
a { color: var(--link); text-underline-offset: 3px; }
h1, h2, h3, .display {
  font-family: var(--font-display); font-weight: var(--display-weight); text-transform: var(--display-tt);
  letter-spacing: var(--display-ls); font-stretch: var(--display-stretch); line-height: 1.1;
}
h1 { font-size: 30px; margin: 4px 0 16px; }
h2 { font-size: 22px; margin: 0; }
h3 { font-size: 18px; margin: 0 0 8px; }
[data-theme="a"] h1, [data-theme="a"] h2, [data-theme="a"] h3 { letter-spacing: -0.015em; }
.muted { color: var(--ink-2); }
.small { font-size: 15px; }
.num { font-variant-numeric: tabular-nums; }
[hidden] { display: none !important; }
svg.i { width: 24px; height: 24px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
main { max-width: 640px; margin: 0 auto; padding: 16px 14px 128px; }

/* ---------- pasek górny ---------- */
.topbar {
  position: sticky; top: 0; z-index: 10; background: var(--shell); color: var(--shell-ink);
  padding: calc(env(safe-area-inset-top) + 10px) 14px 12px; overflow: hidden;
  border-bottom: 3px solid var(--shell-edge);
}
.tb-row { max-width: 640px; margin: 0 auto; display: flex; align-items: center; gap: 12px; position: relative; z-index: 1; }
.tb-logo { width: 42px; height: 42px; border-radius: 50%; flex: none; object-fit: cover; }
[data-theme="a"] .tb-logo { border: 2px solid var(--shell-edge); }
.tb-title { min-width: 0; flex: 1; background: none; border: 0; color: inherit; text-align: left; padding: 0; font: inherit; min-height: 44px; display: block; border-radius: 0; }
.tb-title h1 { margin: 0; font-size: 22px; color: var(--shell-ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
[data-theme="c"] .tb-title h1 { font-size: 26px; }
.tb-sub { font-size: 15px; color: var(--shell-ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tb-actions { display: flex; gap: 6px; }
.tb-btn {
  width: 44px; height: 44px; padding: 0; display: grid; place-items: center; color: var(--shell-ink); background: transparent; cursor: pointer;
  border: 1.5px solid color-mix(in srgb, var(--shell-ink) 45%, transparent); border-radius: 50%;
}
[data-theme="b"] .tb-btn { border-radius: 4px; }
[data-theme="c"] .tb-btn { border-radius: 8px; background: var(--shell); }
.stripes { display: none; }
[data-theme="c"] .stripes { display: flex; position: absolute; right: -24px; top: 0; bottom: 0; width: 170px; gap: 8px; transform: skewX(-24deg); pointer-events: none; }
[data-theme="c"] .stripes i { width: 14px; background: #c8202a; }
[data-theme="c"] .stripes i:last-child { width: 64px; }
#daypick { position: absolute; opacity: 0; pointer-events: none; width: 1px; height: 1px; }

/* ---------- dolna nawigacja w strefie kciuka ---------- */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; background: var(--tab-bg);
  border-top: var(--line-w) solid var(--tab-edge); padding: 6px 6px calc(8px + env(safe-area-inset-bottom));
}
[data-theme="c"] .tabbar { border-top-width: 3px; }
.tabbar-in { max-width: 640px; margin: 0 auto; display: grid; grid-template-columns: repeat(5, 1fr); align-items: end; }
.tabbar a {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: 52px;
  font-size: 13px; color: var(--tab-ink); text-decoration: none;
}
[data-theme="c"] .tabbar a { font: 600 14px/1 "Barlow Condensed", sans-serif; text-transform: uppercase; letter-spacing: .05em; }
.tabbar a.active { color: var(--tab-on); font-weight: 700; }
.tabbar a.active svg { stroke-width: 2.5; }
[data-theme="c"] .tabbar a.active svg { color: #ff5a5f; }
.fab {
  justify-self: center; width: 66px; height: 66px; margin-top: -30px; padding: 0; border-radius: 50%; cursor: pointer;
  background: var(--fab-bg); color: var(--fab-ink); border: 3px solid var(--fab-ring);
  display: grid; place-items: center; box-shadow: 0 8px 16px -6px rgba(0, 0, 0, .35);
}
[data-theme="b"] .fab { border-color: var(--tab-bg); outline: 2px solid var(--fab-ring); }
[data-theme="c"] .fab { border-width: 4px; }
.fab svg { width: 32px; height: 32px; stroke-width: 2.5; }

/* ---------- karta: talerz / etykieta / kupon ---------- */
.card {
  position: relative; background: var(--surface); border: var(--line-w) solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 16px; margin-bottom: 14px;
}
.card-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.card-head .val { font-family: var(--font-display); font-weight: 700; font-size: 18px; color: var(--num); white-space: nowrap; }
[data-theme="b"] .card-head { padding-bottom: 8px; border-bottom: 4px solid var(--line); margin-bottom: 4px; }
[data-theme="b"] .card-head .val { font-weight: 800; font-stretch: 80%; font-size: 20px; }
[data-theme="c"] .card-head .val { font-size: 22px; }
.ctabs { display: none; }
[data-theme="c"] .ctabs { display: flex; gap: 6px; margin: -6px 0 10px; }
[data-theme="c"] .ctabs span {
  font: 700 13px/1 "Barlow Condensed", sans-serif; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-2);
  border: 1.5px solid var(--hair); border-bottom: 0; border-radius: 6px 6px 0 0; padding: 5px 8px 4px;
}
[data-theme="c"] .ctabs span.on { color: var(--accent); border-color: var(--accent); }
[data-theme="c"][data-scheme="dark"] .ctabs span.on { color: var(--link); border-color: var(--link); }

/* ---------- przyciski i formularze ---------- */
button, .btn {
  font: inherit; color: var(--ink); background: var(--surface-2); border: 1.5px solid var(--hair); border-radius: var(--btn-radius);
  padding: 10px 16px; min-height: 44px; cursor: pointer; text-decoration: none;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
}
button:disabled { opacity: .5; cursor: default; }
button.primary, .btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
[data-theme="a"] button.primary { border: 2px solid var(--line); }
[data-theme="b"] button.primary, [data-theme="c"] button.primary { font-family: var(--font-display); text-transform: uppercase; letter-spacing: .04em; font-weight: 700; }
[data-theme="b"] button.primary { font-stretch: 80%; }
button.ghost { background: transparent; border-color: transparent; }
button.danger { color: var(--danger); }
button.small, .btn.small { min-height: 36px; padding: 6px 12px; font-size: 15px; }
button.block { width: 100%; }
.icon-btn { background: transparent; border: none; min-width: 44px; min-height: 44px; padding: 8px; color: var(--ink-2); }
.add {
  width: 100%; min-height: 48px; margin-top: 10px; font-weight: 600;
  background: var(--accent-soft); border: 2px solid var(--accent); color: var(--ink);
}
.add svg { color: var(--accent); }
[data-theme="a"][data-scheme="dark"] .add svg { color: var(--link); }
[data-theme="b"] .add { background: transparent; border-color: var(--line); font-family: var(--font-display); font-weight: 800; font-stretch: 80%; text-transform: uppercase; letter-spacing: .03em; }
[data-theme="b"] .add svg { color: var(--ink); }
[data-theme="c"] .add { background: transparent; border: 1.5px solid var(--ink); font-family: "Barlow Condensed", sans-serif; font-weight: 700; font-size: 17px; text-transform: uppercase; letter-spacing: .05em; }
[data-theme="c"] .add svg { color: var(--ink); }
.linkbtn { background: none; border: none; color: var(--link); font-weight: 600; padding: 8px 4px; min-height: 44px; }

label { display: block; font-size: 15px; color: var(--ink-2); margin-bottom: 12px; }
input, select, textarea {
  font: inherit; font-size: 16px; width: 100%; margin-top: 4px; padding: 10px 12px; min-height: 46px;
  border: 1.5px solid var(--hair); border-radius: var(--input-radius); background: var(--surface); color: var(--ink);
}
[data-theme="a"] input, [data-theme="a"] select { border-width: 2px; border-color: var(--line); }
[data-theme="b"] input, [data-theme="b"] select { border-color: var(--line); }
input:focus, select:focus { outline: 3px solid color-mix(in srgb, var(--link) 45%, transparent); outline-offset: 0; border-color: var(--link); }
input::placeholder { color: var(--ink-2); opacity: .8; }
.error { color: var(--danger); font-size: 15px; min-height: 1.2em; margin: 4px 0 8px; }
.row { display: flex; gap: 10px; align-items: center; }
.row.between { justify-content: space-between; }
.grow { flex: 1; min-width: 0; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0 10px; }
details summary { cursor: pointer; color: var(--link); font-weight: 600; margin: 4px 0 10px; min-height: 32px; }
hr.sep { border: none; border-top: 1px var(--hair-style) var(--hair); margin: 16px 0; }

/* ---------- bilans dnia ---------- */
.summary-a { display: grid; grid-template-columns: 112px 1fr; gap: 16px; }
.jug svg { width: 112px; height: 236px; display: block; }
.jug text { font: 400 11px var(--font); fill: var(--ink-2); }
.sum-big { font-family: var(--font-display); font-size: 44px; font-weight: 800; line-height: 1; letter-spacing: -0.03em; color: var(--num); }
.sum-big small { font-size: 18px; font-weight: 600; letter-spacing: 0; }
.sum-big.over { color: var(--over); }
.sum-lead { color: var(--ink-2); margin: 4px 0 12px; }
.kv { display: flex; justify-content: space-between; gap: 12px; padding: 3px 0; }
.kv b { font-weight: 600; white-space: nowrap; }
.kv .gain { color: var(--gain); }
.gauge-row { margin-top: 10px; }
.gauge-row .top { display: flex; justify-content: space-between; font-size: 15px; color: var(--ink-2); }
.gauge-row .top b { color: var(--ink); font-weight: 600; }
.gauge { position: relative; height: 12px; border-radius: 6px; border: 2px solid var(--line); background: var(--ground); overflow: hidden; margin-top: 4px; }
.gauge i { position: absolute; inset: 0 auto 0 0; }
.gauge i.over { background: var(--over) !important; }
.gauge::after { content: ""; position: absolute; inset: 0; opacity: .35; background: repeating-linear-gradient(90deg, transparent 0 calc(25% - 1px), var(--line) calc(25% - 1px) 25%); }

.label-title { font-size: 30px; line-height: 1; }
.label-per { font-size: 15px; color: var(--ink-2); margin-top: 4px; }
.rule-xl { height: 10px; background: var(--line); margin: 10px 0 8px; }
.rule-m { height: 4px; background: var(--line); margin: 8px 0; }
.lrow { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 7px 0; border-top: 1px solid var(--hair); }
.lrow:first-child { border-top: 0; }
.lrow b { font-weight: 700; white-space: nowrap; }
.lrow .gain { color: var(--gain); }
.lrow.big { border-top: 0; padding: 2px 0 6px; }
.lrow.big span { font: 800 20px/1 var(--font-display); font-stretch: 75%; text-transform: uppercase; }
.lrow.big b { font: 900 40px/1 var(--font-display); font-stretch: 75%; }
.lrow.big.over b, .lrow.big.over span { color: var(--over); }
.gda { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-top: 4px; }
.keg { border: 2px solid var(--line); border-radius: 18px 18px 22px 22px / 14px 14px 26px 26px; text-align: center; padding: 8px 2px 10px; }
.keg span { display: block; font: 700 13px/1.2 var(--font-display); font-stretch: 75%; text-transform: uppercase; letter-spacing: .02em; }
.keg b { display: block; font: 800 19px/1.2 var(--font-display); font-stretch: 80%; }
.keg em { display: block; font-style: normal; font-size: 13px; color: var(--ink-2); }
.keg .pct { margin: 6px 8px 0; height: 24px; border-radius: 12px; display: grid; place-items: center; color: #fff; font-weight: 800; font-size: 14px; background: var(--ink); }
[data-scheme="dark"] .keg .pct { color: #08090c; }
.keg.over { border-width: 4px; border-color: var(--over); }
.keg.over .pct { background: var(--over) !important; }
.gda-note { font-size: 14px; color: var(--ink-2); margin: 8px 0 0; }

.route { display: grid; grid-template-columns: 1fr auto 1fr; align-items: end; gap: 8px; }
.route .lbl, .fare .lbl, .stub .lbl { display: block; font: 700 14px/1 "Barlow Condensed", sans-serif; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-2); margin-bottom: 4px; }
.route .val { font: 700 46px/1 "Barlow Condensed", sans-serif; color: var(--ink); }
.route .val.rem { color: var(--num); }
.route .val.over { color: var(--over); }
.route .to { text-align: right; }
.route .arrow { color: var(--accent); padding-bottom: 8px; }
[data-scheme="dark"] .route .arrow { color: var(--link); }
.route .arrow svg { width: 30px; height: 30px; stroke-width: 2.5; }
.fare { display: grid; grid-template-columns: repeat(3, 1fr); border: 1.5px solid var(--hair); border-radius: 6px; margin-top: 14px; }
.fare > div { padding: 8px 10px; border-left: 1.5px solid var(--hair); min-width: 0; }
.fare > div:first-child { border-left: 0; }
.fare b { font: 700 22px/1 "Barlow Condensed", sans-serif; color: var(--num); }
.fare small { color: var(--ink-2); font-size: 14px; }
.fare .fbar { height: 5px; background: var(--hair); margin-top: 6px; border-radius: 3px; overflow: hidden; }
.fare .fbar i { display: block; height: 100%; background: var(--num); }
.fare .fbar i.over { background: var(--over); }
.perf { position: relative; height: 0; border-top: 2px dashed var(--hair); margin: 14px -16px 0; }
.perf::before, .perf::after { content: ""; position: absolute; top: -10px; width: 18px; height: 18px; border-radius: 50%; background: var(--ground); border: 1.5px solid var(--line); }
.perf::before { left: -10px; clip-path: inset(0 0 0 50%); }
.perf::after { right: -10px; clip-path: inset(0 50% 0 0); }
.stub { display: flex; justify-content: space-between; padding-top: 12px; }
.stub > div:nth-child(2) { text-align: center; }
.stub > div:last-child { text-align: right; }
.stub b { font: 700 22px/1 "Barlow Condensed", sans-serif; }
.stub .gain { color: var(--gain); }

/* ---------- szybkie dodawanie ---------- */
.rail-head { display: flex; justify-content: space-between; align-items: center; margin: 4px 2px 8px; }
.rail-head h2 { font-size: 20px; }
.rail { display: flex; gap: 10px; overflow-x: auto; scroll-snap-type: x mandatory; margin: 0 -14px 10px; padding: 2px 14px 10px; scrollbar-width: none; }
.rail::-webkit-scrollbar { display: none; }
.qchip {
  position: relative; flex: none; scroll-snap-align: start; min-height: 58px; max-width: 230px; text-align: left; justify-content: flex-start;
  background: var(--surface); border: var(--line-w) solid var(--line); border-radius: 16px; padding: 8px 16px 8px 10px; gap: 10px;
}
.qchip .qp { width: 32px; height: 32px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; flex: none; }
.qchip .qp svg { width: 18px; height: 18px; stroke-width: 2.5; }
.qchip b { display: block; font-weight: 600; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 160px; }
.qchip span.qs { font-size: 14px; color: var(--ink-2); }
[data-theme="b"] .qchip { border-radius: 999px; min-height: 48px; padding: 6px 18px 6px 8px; }
[data-theme="b"] .qchip .qp { background: transparent; color: var(--ink); width: 28px; height: 28px; }
[data-theme="c"] .qchip { border-radius: 8px; border-left: 0; padding-left: 18px; min-width: 150px; }
[data-theme="c"] .qchip::before { content: ""; position: absolute; left: 0; top: 6px; bottom: 6px; border-left: 2px dashed var(--hair); }
[data-theme="c"] .qchip .qp { display: none; }
[data-theme="c"] .qchip span.qs { color: var(--num); font: 700 15px/1.2 "Barlow Condensed", sans-serif; }

/* ---------- posiłki i wpisy ---------- */
.entries { list-style: none; margin: 6px 0 0; padding: 0; }
.entries li + li .entry { border-top: 1.5px var(--hair-style) var(--hair); }
.entry {
  width: 100%; display: flex; align-items: center; gap: 10px; min-height: 54px; padding: 8px 0; text-align: left;
  background: transparent; border: 0; border-radius: 0; color: inherit;
}
.entry .en { flex: 1; min-width: 0; }
.entry .en b { display: block; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.entry .meta { font-size: 14px; color: var(--ink-2); }
.entry .k { font-weight: 600; color: var(--num); white-space: nowrap; }
[data-theme="c"] .entry .k { font: 700 20px/1 "Barlow Condensed", sans-serif; }
.entry .m { display: none; }
.cols { display: none; }
[data-theme="b"] .cols, [data-theme="b"] .entry.food { display: grid; grid-template-columns: 1fr 34px 34px 40px 52px; gap: 0 6px; align-items: center; }
[data-theme="b"] .cols { font: 700 13px/1 var(--font-display); font-stretch: 80%; text-transform: uppercase; color: var(--ink-2); padding: 6px 0; }
[data-theme="b"] .cols span:not(:first-child), [data-theme="b"] .entry .m, [data-theme="b"] .entry .k { text-align: right; }
[data-theme="b"] .entry .m { display: block; }
[data-theme="b"] .entry .mfull { display: none; }
[data-theme="b"] .entry .k { font-weight: 800; }
[data-theme="b"] .entries li .entry { border-top: 1px solid var(--hair); }
.empty-meal { color: var(--ink-2); margin: 8px 0 0; }
.meal-actions { display: flex; flex-direction: column; }
.meal-actions .linkbtn { align-self: center; }

/* ---------- treningi ---------- */
.t-ico { width: 48px; height: 48px; border-radius: 50%; display: grid; place-items: center; flex: none; }
[data-theme="a"] .t-ico { background: var(--gain-fill); color: #1a1300; border: 2.5px solid var(--line); }
[data-theme="b"] .t-ico { border: 2px solid var(--line); }
[data-theme="c"] .t-ico { background: #0d1b3d; color: #fff; }
[data-theme="c"][data-scheme="dark"] .t-ico { background: #26355f; }
.entry .tk { text-align: right; font-weight: 700; color: var(--gain); white-space: nowrap; }
.entry .tk small { display: block; font-weight: 400; font-size: 13px; color: var(--ink-2); }
[data-theme="c"] .entry .tk { font: 700 22px/1 "Barlow Condensed", sans-serif; color: var(--num); }
.stamp { display: none; }
[data-theme="c"] .stamp {
  display: block; position: absolute; right: 16px; top: 10px; transform: rotate(-9deg); pointer-events: none;
  border: 3px solid var(--accent); color: var(--accent); border-radius: 6px; padding: 3px 10px 2px;
  font: 700 18px/1 "Barlow Condensed", sans-serif; letter-spacing: .12em; text-transform: uppercase; opacity: .9;
}
[data-theme="c"][data-scheme="dark"] .stamp { border-color: var(--link); color: var(--link); }
.hint { font-size: 15px; color: var(--ink-2); margin: 8px 0 0; }

/* ---------- woda ---------- */
.water-row { display: flex; align-items: center; gap: 10px; margin-top: 10px; }
.cups { display: flex; gap: 5px; flex: 1; }
.cups i { flex: 1; height: 34px; border-radius: 5px 5px 10px 10px; border: 2px solid var(--line); background: var(--ground); }
.cups i.f { background: var(--protein); }
[data-theme="c"] .cups i { border-color: var(--num); }
[data-theme="c"] .cups i.f { background: var(--num); }
.round { width: 48px; height: 48px; padding: 0; border-radius: 50%; border: 2px solid var(--line); background: var(--surface); }
[data-theme="b"] .round { border-radius: 4px; }

/* ---------- arkusz dolny ---------- */
.sheet { position: fixed; inset: 0; z-index: 30; display: flex; align-items: flex-end; justify-content: center; }
.sheet-backdrop { position: absolute; inset: 0; background: rgba(5, 10, 25, .5); }
.sheet-panel {
  position: relative; width: 100%; max-width: 640px; max-height: 92vh; overflow-y: auto; background: var(--ground);
  border-radius: 20px 20px 0 0; border-top: var(--line-w) solid var(--line); padding: 14px 16px calc(20px + env(safe-area-inset-bottom));
}
[data-theme="b"] .sheet-panel { border-radius: 0; border-top-width: 4px; }
@media (min-width: 760px) { .sheet { align-items: center; } .sheet-panel { border-radius: var(--radius); border: var(--line-w) solid var(--line); max-height: 86vh; } }
.sheet-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.sheet-head h2 { font-size: 22px; }
.stabs { display: flex; gap: 6px; overflow-x: auto; margin: 0 -16px 12px; padding: 0 16px 4px; scrollbar-width: none; }
.stabs button { flex: none; min-height: 40px; padding: 6px 12px; font-size: 15px; white-space: nowrap; background: var(--surface); }
.stabs button svg { width: 18px; height: 18px; }
.stabs button.on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.results { list-style: none; margin: 0; padding: 0; }
.results li { display: flex; gap: 10px; align-items: center; padding: 12px 6px; min-height: 56px; border-bottom: 1px var(--hair-style) var(--hair); cursor: pointer; }
.results li:hover { background: var(--surface-2); }
.results .name { font-weight: 500; }
.results .meta { font-size: 14px; color: var(--ink-2); }
.results .fav { color: var(--gain-fill); width: 16px; height: 16px; vertical-align: -2px; fill: currentColor; }
.badge { font-size: 12px; padding: 2px 7px; border-radius: 6px; background: var(--surface-2); color: var(--ink-2); border: 1px solid var(--hair); white-space: nowrap; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin: 6px 0 12px; }
.chips button { min-height: 40px; padding: 6px 12px; font-size: 15px; background: var(--surface); }
.preview { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; text-align: center; margin: 12px 0 16px; }
.preview div { background: var(--surface); border: 1.5px solid var(--hair); border-radius: 10px; padding: 8px 4px; }
.preview b { display: block; font-size: 19px; color: var(--num); }
.preview span { font-size: 13px; color: var(--ink-2); }
video.scan { width: 100%; border-radius: 12px; background: #000; max-height: 280px; object-fit: cover; margin-top: 10px; }
.empty { text-align: center; color: var(--ink-2); padding: 20px 8px; }

/* akcje przycisku „+” */
.actions { display: grid; gap: 8px; }
.action {
  justify-content: flex-start; gap: 14px; min-height: 60px; padding: 10px 14px; text-align: left; width: 100%;
  background: var(--surface); border: var(--line-w) solid var(--line); border-radius: var(--radius);
}
[data-theme="a"] .action { border-radius: 16px; }
.action .ai { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; background: var(--accent-soft); color: var(--ink); flex: none; }
.action b { display: block; font-weight: 600; }
.action small { display: block; color: var(--ink-2); font-size: 14px; }
.action.suggested { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
[data-scheme="dark"] .action.suggested { border-color: var(--link); box-shadow: inset 0 0 0 1px var(--link); }
.actions-sep { font: 700 14px/1 var(--font-display); text-transform: uppercase; letter-spacing: .05em; color: var(--ink-2); margin: 12px 2px 2px; }

/* ---------- logowanie ---------- */
.auth { max-width: 420px; margin: 6vh auto 0; }
.auth .logo { text-align: center; margin-bottom: 20px; }
.auth .logo img { width: 120px; height: 120px; object-fit: contain; }
.auth .logo h1 { margin: 8px 0 4px; font-size: 34px; }
.auth .alt { text-align: center; margin: 16px 0 0; color: var(--ink-2); }

/* ---------- wybór wyglądu ---------- */
.themes { display: grid; gap: 12px; }
.theme-opt {
  display: grid; grid-template-columns: 112px 1fr; gap: 14px; align-items: center; text-align: left; padding: 10px; width: 100%;
  background: var(--surface); border: var(--line-w) solid var(--line); border-radius: var(--radius); color: var(--ink);
}
.theme-opt img { width: 112px; height: 150px; object-fit: cover; object-position: top; border-radius: 10px; border: 1px solid var(--hair); }
.theme-opt b { display: block; font-size: 20px; font-family: var(--font-display); font-weight: 700; }
.theme-opt span { display: block; color: var(--ink-2); font-size: 15px; margin-top: 2px; }
.theme-opt .tick { display: inline-flex; align-items: center; gap: 4px; margin-top: 8px; font-weight: 700; color: var(--link); font-size: 15px; visibility: hidden; }
.theme-opt.on { border-color: var(--accent); box-shadow: inset 0 0 0 2px var(--accent); }
[data-scheme="dark"] .theme-opt.on { border-color: var(--link); box-shadow: inset 0 0 0 2px var(--link); }
.theme-opt.on .tick { visibility: visible; }
.seg { display: flex; border: 1.5px solid var(--line); border-radius: var(--btn-radius); overflow: hidden; }
.seg button { flex: 1; border: none; border-radius: 0; min-height: 44px; padding: 6px 10px; background: var(--surface); }
.seg button + button { border-left: 1.5px solid var(--line); }
.seg button.on { background: var(--accent); color: var(--accent-ink); font-weight: 600; }

/* ---------- wywiad ---------- */
.wizard { max-width: 540px; margin: 2vh auto 0; }
.wiz-top { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; }
.wiz-top img { border-radius: 50%; object-fit: cover; }
.progress { flex: 1; height: 8px; border-radius: 4px; background: var(--surface-2); border: 1px solid var(--hair); overflow: hidden; }
.progress > i { display: block; height: 100%; background: var(--accent); transition: width .25s cubic-bezier(.2, .8, .2, 1); }
[data-theme="b"][data-scheme="dark"] .progress > i { background: var(--link); }
.wizard h1 { margin-bottom: 6px; }
.wizard #wb { margin-top: 18px; }
.wiz-nav { margin-top: 20px; }
.choices { display: flex; flex-direction: column; gap: 8px; margin-bottom: 10px; }
.choices.grid { display: grid; grid-template-columns: repeat(2, 1fr); }
.choices.tight { grid-template-columns: repeat(3, 1fr); gap: 6px; margin-bottom: 12px; }
.choice {
  justify-content: flex-start; text-align: left; gap: 12px; padding: 12px 14px; min-height: 56px; width: 100%;
  background: var(--surface); border: var(--line-w) solid var(--hair); border-radius: var(--btn-radius);
}
[data-theme="a"] .choice { border-color: var(--line); border-radius: 14px; }
[data-theme="b"] .choice { border-color: var(--line); }
.choice b { display: block; font-weight: 600; }
.choice small { display: block; color: var(--ink-2); font-size: 14px; margin-top: 1px; }
.choice .ci { color: var(--ink); display: grid; place-items: center; }
.choice.on { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, var(--surface)); box-shadow: inset 0 0 0 1px var(--accent); }
[data-scheme="dark"] .choice.on { border-color: var(--link); box-shadow: inset 0 0 0 1px var(--link); background: color-mix(in srgb, var(--link) 14%, var(--surface)); }
.choices.tight .choice { flex-direction: column; align-items: center; text-align: center; gap: 4px; padding: 10px 4px; font-size: 14px; }
.choices.tight .choice b { font-weight: 500; }
.hero { text-align: center; }
.hero b { display: block; font: 800 40px/1.1 var(--font-display); color: var(--num); margin: 4px 0; }
.note { display: flex; gap: 8px; align-items: flex-start; background: var(--gain-soft); border-radius: 10px; padding: 10px 12px; font-size: 15px; margin: 10px 0 0; }
.note svg { color: var(--gain); margin-top: 1px; }
.pills { display: flex; flex-wrap: wrap; gap: 6px; margin: -4px 0 14px; }
.pills label { margin: 0; }
.pills input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.pills span { display: inline-flex; align-items: center; min-height: 40px; padding: 6px 14px; border-radius: 999px; border: 1.5px solid var(--hair); background: var(--surface); color: var(--ink); font-size: 15px; cursor: pointer; }
.pills input:checked + span { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.pills input:focus-visible + span { outline: 3px solid var(--link); outline-offset: 2px; }
label.check { display: flex; gap: 10px; align-items: center; color: var(--ink); font-size: 16px; min-height: 44px; }
label.check input { width: 22px; height: 22px; min-height: 0; margin: 0; flex: none; accent-color: var(--accent); }

/* ---------- statystyki, waga ---------- */
.stat-tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 14px; }
.stat-tiles .card { margin: 0; text-align: center; padding: 12px 6px; }
.stat-tiles b { display: block; font: 800 24px/1.1 var(--font-display); color: var(--num); }
.stat-tiles span { font-size: 13px; color: var(--ink-2); }
.chart { width: 100%; height: auto; display: block; }
.chart text { fill: var(--ink-2); font-size: 11px; font-family: var(--font); }
.chart .grid { stroke: var(--grid); stroke-width: 1; }
.chart .target { stroke: var(--target); stroke-width: 1.5; stroke-dasharray: 4 4; }
.chart .bar { fill: var(--bar); }
.chart .bar.over { fill: var(--over); }
.chart .line { fill: none; stroke: var(--bar); stroke-width: 2; }
.chart .dot { fill: var(--bar); stroke: var(--surface); stroke-width: 2; }
.chart .hit { fill: transparent; }
.chart .cross { stroke: var(--ink-2); stroke-width: 1; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 14px; color: var(--ink-2); margin-top: 8px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }
.legend i.dash { height: 0; border-top: 2px dashed var(--target); border-radius: 0; width: 14px; vertical-align: 3px; }
.stack { display: flex; height: 14px; gap: 2px; border-radius: 4px; overflow: hidden; margin: 8px 0 4px; }
.stack > i { display: block; height: 100%; }
table.data { width: 100%; border-collapse: collapse; font-size: 15px; }
table.data td, table.data th { padding: 8px 4px; border-bottom: 1px var(--hair-style) var(--hair); text-align: right; }
table.data td:first-child, table.data th:first-child { text-align: left; }
table.data th { font-size: 13px; color: var(--ink-2); font-weight: 600; }

.toast {
  position: fixed; left: 50%; bottom: calc(96px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 40;
  background: var(--ink); color: var(--surface); padding: 8px 16px; border-radius: 12px; font-size: 15px; max-width: 92vw;
  display: flex; align-items: center; gap: 12px; box-shadow: 0 8px 20px -8px rgba(0, 0, 0, .45); min-height: 44px;
}
.toast button { background: transparent; border: 1.5px solid currentColor; color: inherit; min-height: 36px; padding: 4px 12px; font-weight: 700; margin-right: -8px; }
.tip { position: fixed; z-index: 40; pointer-events: none; background: var(--surface); color: var(--ink); border: 1px solid var(--hair); border-radius: 8px; padding: 6px 10px; font-size: 14px; box-shadow: 0 4px 14px rgba(0, 0, 0, .18); }
.list-link { display: flex; align-items: center; justify-content: space-between; min-height: 52px; color: var(--ink); text-decoration: none; font-weight: 500; }
.list-link + .list-link { border-top: 1px var(--hair-style) var(--hair); }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

.byline { text-align: center; color: var(--ink-2); font-size: 15px; margin: 18px 0 8px; }
.byline b { font-family: var(--font-display); color: var(--ink); }
.byline a { font-weight: 700; }
a.btn.block { width: 100%; }
