/* THARAN: ciemna, spokojna paleta premium. Jeden akcent turkusowy, bez tęczy kolorów. */
:root {
  color-scheme: dark;
  --bg: #071014;
  --card: #101B20;
  --card2: #16242a;
  --text: #F5F7F6;
  --text2: #8D9A9E;
  --line: rgba(245, 247, 246, 0.09);
  --accent: #18D5C5;
  --accent-soft: #A5F4ED;
  --on-accent: #04211f;
  --green: #34c759;
  --red: #ff5a4e;
  --orange: #ffb020;
  --purple: #b98cff;
  --radius: 18px;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 12px 32px rgba(0, 0, 0, 0.35);
  --tabbar-h: 49px;
  --sab: env(safe-area-inset-bottom, 0px);
  --sat: env(safe-area-inset-top, 0px);
  --bar-bg: rgba(7, 16, 20, 0.86);
}



* { margin: 0; padding: 0; box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
button, a { -webkit-tap-highlight-color: transparent; }

body {
  font-family: Inter, -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

.app { max-width: 860px; margin: 0 auto; padding: 32px 20px 80px; }

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

h1 { font-size: 30px; font-weight: 700; letter-spacing: -0.02em; }
.wordmark { font-family: Manrope, Inter, -apple-system, sans-serif; font-weight: 800; letter-spacing: 0.22em; text-transform: uppercase; }
.subtitle { color: var(--text2); font-size: 15px; margin-top: 2px; text-transform: capitalize; }

.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  background: var(--card);
  border-radius: 100px;
  padding: 7px 14px;
  font-size: 13px;
  font-weight: 600;
  box-shadow: var(--shadow);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.chip .dot { width: 8px; height: 8px; border-radius: 50%; }

.alert {
  background: var(--card);
  border-left: 4px solid var(--orange);
  border-radius: 14px;
  padding: 14px 18px;
  margin-bottom: 12px;
  box-shadow: var(--shadow);
  font-size: 14px;
  line-height: 1.45;
}
.alert strong { display: block; margin-bottom: 2px; }
.alert.purple { border-left-color: var(--purple); }

.segmented {
  display: flex;
  background: rgba(141, 154, 158, 0.12);
  border-radius: 12px;
  padding: 3px;
  margin: 20px 0 24px;
}
.seg {
  flex: 1;
  border: none;
  background: transparent;
  padding: 9px 0;
  font-size: 14px;
  font-weight: 600;
  color: var(--text2);
  border-radius: 9px;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s ease;
}
.seg.active {
  background: var(--card2);
  color: var(--text);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.12);
}

.view { display: none; }
.view.active { display: block; animation: fade 0.2s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

.card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
  margin-bottom: 16px;
}
.card h2 { font-size: 18px; font-weight: 700; margin-bottom: 4px; letter-spacing: -0.01em; }
.card .hint { color: var(--text2); font-size: 13px; margin-bottom: 18px; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; }

.field label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text2);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.field .unit { text-transform: none; letter-spacing: 0; font-weight: 500; }
input[type="number"], input[type="text"], input[type="date"], input[type="time"], select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  background: var(--bg);
  border-radius: 11px;
  padding: 11px 12px;
  font-size: 16px;
  font-family: inherit;
  color: var(--text);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(24, 213, 197, 0.18); }
select { appearance: none; -webkit-appearance: none; cursor: pointer; }
input::placeholder { color: var(--text2); opacity: 0.6; }

.bp-pair { display: flex; align-items: center; gap: 6px; }
.bp-pair span { color: var(--text2); font-weight: 600; }

.btn {
  border: none;
  background: var(--accent);
  color: #fff;
  font-family: inherit;
  font-size: 15px;
  font-weight: 600;
  padding: 12px 26px;
  border-radius: 100px;
  cursor: pointer;
  transition: transform 0.1s, opacity 0.15s;
}
@media (hover: hover) { .btn:hover { opacity: 0.9; } }
.btn:active { transform: scale(0.97); }
.btn { color: var(--on-accent); }
.btn.secondary { background: rgba(141, 154, 158, 0.16); color: var(--text); }
.btn.small { padding: 8px 16px; font-size: 13px; }
.btn.danger { background: transparent; color: var(--red); }

.actions { margin-top: 22px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.saved-note { color: var(--green); font-size: 14px; font-weight: 600; }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; grid-auto-flow: row dense; }
.stat-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
}
.stat-card .label { font-size: 12px; font-weight: 600; color: var(--text2); text-transform: uppercase; letter-spacing: 0.05em; }
.stat-card .big { font-size: 34px; font-weight: 700; letter-spacing: -0.02em; margin: 6px 0 2px; }
.stat-card .big small { font-size: 15px; font-weight: 500; color: var(--text2); margin-left: 3px; }
.stat-card svg { width: 100%; height: 44px; margin: 10px 0 8px; display: block; }
.deltas { display: flex; gap: 14px; flex-wrap: wrap; }
.delta { font-size: 12px; color: var(--text2); }
.delta b { display: block; font-size: 13px; font-weight: 600; color: var(--text); }
.delta b.down { color: var(--green); }
.delta b.up { color: var(--red); }

.progress-row { margin-bottom: 20px; }
.progress-row .head { display: flex; justify-content: space-between; font-size: 14px; font-weight: 600; margin-bottom: 8px; }
.progress-row .head span:last-child { color: var(--text2); font-weight: 500; }
.bar { height: 8px; background: rgba(120, 120, 128, 0.16); border-radius: 100px; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--accent); border-radius: 100px; transition: width 0.4s ease; }
.bar i.done { background: var(--green); }

.switch-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.switch { position: relative; width: 51px; height: 31px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .track {
  position: absolute; inset: 0;
  background: rgba(120, 120, 128, 0.24);
  border-radius: 100px;
  cursor: pointer;
  transition: background 0.2s;
}
.switch .track::after {
  content: "";
  position: absolute; top: 2px; left: 2px;
  width: 27px; height: 27px;
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
  transition: transform 0.2s;
}
.switch input:checked + .track { background: var(--green); }
.switch input:checked + .track::after { transform: translateX(20px); }

.treatment {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 18px;
  margin-bottom: 14px;
}
.treatment .t-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.treatment .t-head h3 { font-size: 16px; font-weight: 700; }
.treatment .t-week { font-size: 13px; color: var(--accent); font-weight: 600; }
.treatment .t-meta { font-size: 13px; color: var(--text2); margin-top: 2px; }
.milestones { margin-top: 12px; display: flex; flex-direction: column; gap: 6px; }
.milestone {
  display: flex; gap: 10px; align-items: baseline;
  font-size: 14px;
  padding: 8px 12px;
  border-radius: 10px;
  background: var(--bg);
}
.milestone.now { background: rgba(255, 159, 10, 0.14); }
.milestone.past { opacity: 0.5; }
.milestone .wk { font-weight: 700; font-size: 12px; color: var(--text2); white-space: nowrap; }
.milestone.now .wk { color: var(--orange); }
.milestone .m-del { margin-left: auto; background: none; border: none; color: var(--text2); cursor: pointer; font-size: 15px; }
.t-actions { margin-top: 12px; display: flex; gap: 8px; }

.add-milestone { display: flex; gap: 8px; margin-top: 10px; }
.add-milestone input:first-child { width: 90px; flex-shrink: 0; }

.card-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.mini-seg {
  display: flex;
  background: rgba(120, 120, 128, 0.12);
  border-radius: 9px;
  padding: 2px;
}
.mini-seg button {
  border: none;
  background: transparent;
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  color: var(--text2);
  padding: 6px 12px;
  border-radius: 7px;
  cursor: pointer;
}
.mini-seg button.active {
  background: var(--card);
  color: var(--text);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
}

.preset-chips { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.preset {
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  padding: 8px 14px;
  border-radius: 100px;
  cursor: pointer;
  transition: all 0.15s;
}
@media (hover: hover) { .preset:hover { border-color: var(--accent); color: var(--accent); } }
.preset.active { background: var(--accent); border-color: var(--accent); color: #fff; }

.dose-row { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.dose-row input { width: 90px; }
.dose-row select { width: auto; min-width: 130px; }

.timeline { margin-top: 14px; }
.timeline input[type="range"] {
  width: 100%;
  accent-color: var(--accent);
  cursor: pointer;
}
.timeline-label {
  text-align: center;
  font-size: 13px;
  font-weight: 600;
  color: var(--text2);
  margin-top: 4px;
}

.empty { color: var(--text2); font-size: 14px; text-align: center; padding: 24px 0; }

.body3d-wrap {
  position: relative;
  background: linear-gradient(180deg, transparent, rgba(120, 120, 128, 0.07));
  border-radius: 14px;
  overflow: hidden;
}
.body3d-wrap canvas {
  width: 100%;
  height: 430px;
  display: block;
  cursor: grab;
  touch-action: pan-y;
}
.body3d-wrap canvas:active { cursor: grabbing; }
.fig-labels {
  position: absolute;
  bottom: 10px; left: 0; right: 0;
  display: flex;
  pointer-events: none;
}
.fig-labels div {
  flex: 1;
  text-align: center;
  font-size: 13px;
}
.fig-labels b { display: block; font-weight: 700; }
.fig-labels span { color: var(--text2); font-size: 12px; }
.legend {
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
  margin-top: 14px;
  font-size: 12px;
  color: var(--text2);
}
.legend i {
  display: inline-block;
  width: 10px; height: 10px;
  border-radius: 3px;
  margin-right: 6px;
  vertical-align: -1px;
}

.toast {
  position: fixed;
  bottom: 28px; left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: var(--text);
  color: var(--bg);
  padding: 12px 22px;
  border-radius: 100px;
  font-size: 14px;
  font-weight: 600;
  opacity: 0;
  transition: all 0.25s ease;
  pointer-events: none;
  z-index: 10;
}
.toast.show { transform: translateX(-50%); opacity: 1; }



.rating { display: flex; gap: 6px; }
.rating button {
  flex: 1;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--text2);
  font-family: inherit;
  font-size: 15px;
  font-weight: 600;
  padding: 10px 0;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.12s;
}
@media (hover: hover) { .rating button:hover { border-color: var(--accent); } }
.rating button.on { background: var(--accent); border-color: var(--accent); color: #fff; }

.lag-card { border-left: 4px solid var(--accent); }
.status-strip { display: flex; gap: 12px; }
.status {
  flex: 1;
  background: var(--bg);
  border-radius: 14px;
  padding: 14px;
  text-align: center;
}
.status b { display: block; font-size: 28px; font-weight: 700; letter-spacing: -0.02em; }
.status span { font-size: 12px; color: var(--text2); font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; }
.status.alert b { color: var(--red); }
.status.uwaga b { color: var(--orange); }
.status.ok b { color: var(--green); }
.insights { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.insight {
  background: var(--card);
  border-radius: 16px;
  padding: 16px 18px;
  box-shadow: var(--shadow);
  border-left: 4px solid var(--text2);
}
.insight.alert { border-left-color: var(--red); }
.insight.uwaga { border-left-color: var(--orange); }
.insight.ok { border-left-color: var(--green); }
.insight-head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.insight-head b { font-size: 15px; }
.insight-head .lvl { margin-left: auto; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text2); }
.insight-head .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--text2); }
.insight.alert .dot { background: var(--red); }
.insight.uwaga .dot { background: var(--orange); }
.insight.ok .dot { background: var(--green); }
.insight p { font-size: 14px; line-height: 1.5; color: var(--text); }


.lab-group { font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text2); margin: 20px 0 10px; }
.lab-row {
  display: grid;
  grid-template-columns: 10px minmax(160px, 1.4fr) minmax(120px, 1fr) minmax(120px, 1fr) 90px;
  gap: 12px;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
}
.lab-row:last-child { border-bottom: none; }
.lab-row .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--green); }
.lab-row.high .dot, .lab-row.low .dot, .lab-row.uwaga .dot { background: var(--orange); }
.lab-row.alert .dot { background: var(--red); }
.lab-row small { display: block; color: var(--text2); font-size: 12px; }
.lab-row .lab-val b { font-size: 16px; }
.lab-row .lab-delta { color: var(--text2); font-size: 13px; }
.lab-row .lab-status { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text2); text-align: right; }
.lab-row.alert .lab-status { color: var(--red); }
.lab-row.high .lab-status, .lab-row.low .lab-status { color: var(--orange); }
.lab-row input[type="date"] { padding: 8px 10px; font-size: 14px; }


.order-row { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.order-row:last-child { border-bottom: none; }
.order-row b { white-space: nowrap; }

.routine { border-left: 4px solid var(--accent); }
.dose-box { background: rgba(255, 159, 10, 0.12); border-radius: 12px; padding: 12px 14px; margin-top: 14px; }
.dose-box b { display: block; font-size: 13px; margin-bottom: 6px; }
.check { display: flex; align-items: center; gap: 10px; font-size: 14px; padding: 6px 0; cursor: pointer; }
.check input { width: 20px; height: 20px; accent-color: var(--green); }
.chips-select { display: flex; gap: 8px; flex-wrap: wrap; }
.dose-cal { margin-top: 12px; }
.dose-cal-head { font-size: 12px; color: var(--text2); margin-bottom: 6px; }
.dose-days { display: flex; gap: 4px; flex-wrap: wrap; }
.dose-day { width: 30px; height: 30px; border-radius: 8px; display: inline-flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 600; background: var(--bg); color: var(--text2); }
.dose-day.off { opacity: 0.35; }
.dose-day.due { background: rgba(10, 132, 255, 0.15); color: var(--accent); }
.dose-day.today { background: var(--accent); color: #fff; }
.dose-day.taken { background: var(--green); color: #fff; }
.dose-day.missed { background: var(--red); color: #fff; }

textarea { resize: vertical; line-height: 1.45; }
.food-table { margin-top: 10px; }
.food-row { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.food-row:last-child { border-bottom: none; }
.food-row small { display: block; color: var(--text2); font-size: 12px; }
.food-row.unknown { color: var(--orange); }
.food-row > span:last-child { text-align: right; white-space: nowrap; }
.bar i.over { background: var(--orange); }

.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 14px; margin-top: 16px; }
.photo-grid.compare { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.photo-slot { display: flex; flex-direction: column; gap: 8px; align-items: stretch; }
.photo-label { font-size: 12px; font-weight: 600; color: var(--text2); text-transform: uppercase; letter-spacing: 0.04em; }
.photo-slot img { width: 100%; aspect-ratio: 3 / 4; object-fit: cover; border-radius: 12px; background: var(--bg); }
.photo-empty { aspect-ratio: 3 / 4; border-radius: 12px; background: var(--bg); display: flex; align-items: center; justify-content: center; color: var(--text2); font-size: 13px; }
.photo-btn { text-align: center; cursor: pointer; }
.photo-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }

.report-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; }
.report-item { background: var(--bg); border-radius: 12px; padding: 12px; border-left: 3px solid var(--text2); }
.report-item.good { border-left-color: var(--green); }
.report-item.bad { border-left-color: var(--red); }
.report-item span { display: block; font-size: 12px; color: var(--text2); font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; }
.report-item b { font-size: 15px; }
.tasks { padding-left: 22px; font-size: 14px; line-height: 1.6; }
.actions-list { margin: 10px 0 0 18px; font-size: 13px; line-height: 1.55; color: var(--text); }
.actions-list li { margin-bottom: 2px; }
.corr-row { display: flex; justify-content: space-between; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.corr-row:last-child { border-bottom: none; }
.corr-row small { color: var(--text2); white-space: nowrap; }
.cmp-table { overflow-x: auto; }
.cmp-row { display: grid; grid-template-columns: 1.5fr repeat(5, minmax(80px, 1fr)); gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 14px; min-width: 520px; }
.cmp-row.head { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text2); }
.cmp-row b.down { color: var(--green); }
.cmp-row b.up { color: var(--red); }

.lab-spark { width: 100%; max-width: 140px; height: 28px; display: block; margin-top: 4px; }
details summary { list-style: none; }
details summary::before { content: '▸ '; }
details[open] summary::before { content: '▾ '; }

.readiness { display: flex; align-items: center; gap: 14px; background: var(--bg); border-radius: 12px; padding: 12px 14px; margin-top: 14px; border-left: 4px solid var(--green); }
.readiness.uwaga { border-left-color: var(--orange); }
.readiness.alert { border-left-color: var(--red); }
.readiness b { font-size: 28px; font-weight: 700; letter-spacing: -0.02em; }
.readiness span { display: block; font-size: 14px; font-weight: 600; }
.readiness small { color: var(--text2); font-size: 12px; }

.modal { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.5); display: flex; align-items: center; justify-content: center; padding: 16px; z-index: 20; }
.modal-box { background: var(--card); border-radius: 18px; padding: 22px; width: 100%; max-width: 520px; max-height: 90vh; overflow: auto; box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3); }
.modal-box h2 { font-size: 18px; margin-bottom: 4px; }
.food-row.scanned .m-del { margin-left: 8px; }
/* Jakosc jedzenia: badge 0 do 100, szczegoly pozycji, podpowiedzi, karta produktu */
.q-badge { display: inline-flex; align-items: center; justify-content: center; min-width: 30px; height: 30px; padding: 0 6px; border-radius: 15px; color: #fff; font-weight: 700; font-size: 13px; vertical-align: middle; margin-right: 8px; flex-shrink: 0; }
.q-badge.big { min-width: 46px; height: 46px; font-size: 19px; border-radius: 23px; }
.food-row[data-food-row] { cursor: pointer; align-items: center; }
.food-row > span:first-child { display: flex; flex-wrap: wrap; align-items: center; gap: 0 4px; min-width: 0; }
.food-row > span:first-child small { flex-basis: 100%; }
.food-details { padding: 6px 4px 12px 42px; font-size: 13px; color: var(--text2); border-bottom: 1px solid var(--line); line-height: 1.45; }
.food-details .q-head { display: flex; align-items: center; gap: 6px; color: var(--text); flex-wrap: wrap; }
.food-details .q-head small { color: var(--text2); }
.food-details ul { margin: 6px 0 0 16px; }
.food-details .ingr { margin-top: 8px; font-size: 12px; }
.food-details > small { display: block; margin-top: 6px; }
.q-parts { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 6px; font-size: 12px; }
.q-parts b { color: var(--text); }
.additives { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.additive-chip { font-size: 12px; padding: 3px 9px; border-radius: 100px; background: rgba(120, 120, 128, 0.12); color: var(--text2); }
.additive-chip.r2 { background: rgba(255, 159, 10, 0.16); color: var(--orange); }
.additive-chip.r3 { background: rgba(255, 59, 48, 0.14); color: var(--red); }
.suggest { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; flex-basis: 100%; }
.suggest .sug { border: 1px solid var(--line); background: var(--card); color: var(--accent); border-radius: 100px; padding: 6px 12px; font-family: inherit; font-size: 13px; font-weight: 600; cursor: pointer; }
.suggest .sug.ask { color: var(--text2); }
.day-quality { display: flex; gap: 12px; align-items: center; margin-top: 12px; padding: 12px 14px; border-radius: 14px; background: rgba(120, 120, 128, 0.08); }
.day-quality b { display: block; font-size: 14px; }
.day-quality small { color: var(--text2); font-size: 12px; }
.link-btn { background: none; border: none; color: var(--accent); font-family: inherit; font-size: 14px; font-weight: 600; padding: 10px 0 0; cursor: pointer; }
.product-list .btns { display: flex; gap: 6px; align-items: center; }
.stepper { margin: 12px 0 4px; }
.stepper .step { display: flex; gap: 10px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
.stepper .step > div { flex: 1; min-width: 0; }
.stepper .step b { display: block; font-size: 14px; }
.stepper .step small { color: var(--text2); font-size: 12px; }
.stepper .num { width: 26px; height: 26px; border-radius: 50%; background: rgba(120, 120, 128, 0.16); display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px; flex-shrink: 0; }
.stepper .step.done .num { background: var(--green); color: #fff; }
.photo-btn { position: relative; overflow: hidden; display: inline-flex; align-items: center; white-space: nowrap; }
.photo-btn input { position: absolute; inset: 0; opacity: 0; cursor: pointer; font-size: 0; }
.score-preview { display: flex; gap: 12px; align-items: flex-start; margin: 4px 0 8px; padding: 12px 14px; border-radius: 14px; background: rgba(120, 120, 128, 0.08); }
.score-preview b { display: block; font-size: 14px; }
.score-preview small { display: block; color: var(--text2); font-size: 12px; }
.score-preview ul { margin: 6px 0 0 16px; font-size: 13px; color: var(--text2); }
.missing { color: var(--orange); font-size: 13px; margin-top: 8px; min-height: 1em; }
.btn:disabled { opacity: 0.45; cursor: default; }

.stat-card[data-key] { cursor: pointer; transition: transform 0.1s; }
.stat-card[data-key]:active { transform: scale(0.98); }
.stat-card.open { grid-column: 1 / -1; }
.stat-details { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); font-size: 14px; line-height: 1.5; }
.big-spark { width: 100%; height: 120px; display: block; margin: 10px 0 14px; }
.history { max-height: 50vh; overflow: auto; }
.history-row { display: grid; grid-template-columns: 1fr auto auto; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.history-row small { color: var(--text2); min-width: 48px; text-align: right; }
.change-list { margin-top: 10px; }
.change-row { display: grid; grid-template-columns: 1.2fr 1.4fr auto; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 14px; align-items: center; }
.change-row:last-child { border-bottom: none; }
.change-row .change-vals { color: var(--text2); }
.change-row .change-diff { color: var(--text2); }
.change-row.good .change-diff, .change-diff.good { color: var(--green); }
.change-row.bad .change-diff, .change-diff.bad { color: var(--red); }
.photo-grid.compact { grid-template-columns: repeat(4, 1fr); gap: 8px; }
.photo-slot.small { cursor: pointer; }
.photo-slot.small .photo-label { font-size: 10px; }
.photo-slot.small .photo-empty { font-size: 22px; color: var(--accent); }



/* ===== Nawigacja: pasek dolny, arkusz Więcej, foldy (baza, oba układy) ===== */
h1 .view-name { display: none; }
.seg-divider { width: 1px; height: 18px; background: var(--line); margin: 0 4px; align-self: center; }
.tab-icon, .row-icon { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.tab-icon .dot, .row-icon .dot { fill: currentColor; stroke: none; }
.native-only { display: none; }
html.is-native .native-only { display: block; }
.tabbar, .sheet { display: none; }
.lifts { display: contents; }
.fold-head { all: unset; -webkit-tap-highlight-color: transparent; touch-action: manipulation; display: flex; width: 100%; justify-content: space-between; align-items: center; gap: 12px; min-height: 44px; cursor: default; pointer-events: none; }
.fold-title { display: flex; flex-direction: column; gap: 2px; }
.fold-title h2 { font-size: 18px; font-weight: 700; letter-spacing: -0.01em; }
.fold-status { font-size: 13px; color: var(--text2); }
.fold-status.ok { color: var(--green); font-weight: 600; }
.fold-chevron { display: none; }
.sub-toggle { display: none; }
.fold-body { margin-top: 14px; }
.card-hero > :first-child { margin-top: 0; }
.card-hero .readiness + .dose-box { margin-top: 12px; }
.readiness.muted { border-left-color: var(--text2); }
.readiness[data-nav] { cursor: pointer; }
.alerts-toggle { margin-bottom: 12px; }
.fold { scroll-margin-top: 12px; }

/* ===== Desktop ===== */
@media (min-width: 601px) {
  .tabbar, .sheet, .fold-chevron, .fold-status, .alerts-toggle { display: none; }
  .sub-toggle { display: block; pointer-events: none; }
}

/* ===== Telefon ===== */
@media (max-width: 600px) {
  .app { padding: calc(var(--sat) + 8px) 14px calc(var(--tabbar-h) + var(--sab) + 24px); }
  html { scroll-padding-bottom: calc(var(--tabbar-h) + var(--sab) + 20px); }
  .segmented { display: none; }

  .tabbar {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 15;
    display: grid; grid-template-columns: repeat(4, 1fr);
    height: calc(var(--tabbar-h) + var(--sab)); padding-bottom: var(--sab);
    background: var(--bar-bg); -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px);
    border-top: 0.5px solid var(--line); user-select: none; -webkit-user-select: none;
    transition: transform 0.18s;
  }
  .tab { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: 49px; border: 0; background: none; font: 500 10px -apple-system, BlinkMacSystemFont, "SF Pro Text", sans-serif; color: var(--text2); touch-action: manipulation; cursor: pointer; }
  .tab.active { color: var(--accent); }
  .tab.active .tab-icon { stroke-width: 2.2; }
  .tab:active { opacity: 0.6; }
  body.kb-open .tabbar { transform: translateY(120%); }

  .sheet { display: block; position: fixed; inset: 0; z-index: 30; }
  .sheet-backdrop { position: absolute; inset: 0; background: rgba(0, 0, 0, 0.35); opacity: 0; transition: opacity 0.25s; touch-action: none; }
  .sheet-panel { position: absolute; left: 0; right: 0; bottom: 0; background: var(--bg); border-radius: 20px 20px 0 0; padding: 8px 16px calc(16px + var(--sab)); max-height: 85vh; max-height: 85dvh; overflow-y: auto; overscroll-behavior: contain; transform: translateY(100%); transition: transform 0.3s cubic-bezier(0.2, 0.8, 0.2, 1); }
  .sheet.open .sheet-backdrop { opacity: 1; }
  .sheet.open .sheet-panel { transform: none; }
  .sheet-grabber { width: 36px; height: 5px; border-radius: 3px; background: rgba(120, 120, 128, 0.4); margin: 4px auto 12px; }
  .sheet-title { font-size: 22px; font-weight: 700; margin: 0 0 12px; }
  .sheet-cancel { width: 100%; min-height: 50px; border: 0; border-radius: 14px; background: var(--card); font-family: inherit; font-size: 17px; font-weight: 600; color: var(--accent); cursor: pointer; }
  .list { background: var(--card); border-radius: 14px; overflow: hidden; margin-bottom: 16px; }
  .row { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 50px; padding: 10px 16px; border: 0; background: none; font: inherit; font-size: 17px; color: var(--text); text-align: left; text-decoration: none; cursor: pointer; position: relative; }
  .row + .row::before { content: ''; position: absolute; left: 52px; right: 0; top: 0; border-top: 0.5px solid var(--line); }
  .row small { display: block; font-size: 13px; color: var(--text2); }
  .row b { font-weight: 600; }
  .row.active { color: var(--accent); background: rgba(0, 113, 227, 0.08); }
  .row:active { background: rgba(120, 120, 128, 0.12); }
  .row-icon { color: var(--accent); flex-shrink: 0; }
  .chev { margin-left: auto; width: 8px; height: 8px; border-right: 2px solid var(--text2); border-bottom: 2px solid var(--text2); transform: rotate(-45deg); opacity: 0.5; flex-shrink: 0; }

  .topbar { flex-direction: column; align-items: stretch; gap: 8px; margin-bottom: 12px; }
  .topbar > div:first-child { display: flex; flex-direction: column; }
  #today-label { order: -1; font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 2px; }
  h1 { font-size: 34px; }
  h1 .app-name { display: none; }
  h1 .view-name { display: inline; }
  body:not([data-view="today"]) #today-label, body:not([data-view="today"]) #chips, body:not([data-view="today"]) #alerts { display: none; }
  .chips { flex-wrap: nowrap; overflow-x: auto; margin: 0 -14px; padding: 0 14px 4px; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
  .chips::-webkit-scrollbar { display: none; }
  .chip { flex: 0 0 auto; white-space: nowrap; }
  .alert { padding: 12px 14px; font-size: 13px; }

  .card { padding: 16px 14px; border-radius: 16px; margin-bottom: 12px; box-shadow: none; }
  .card h2 { font-size: 17px; }
  .card .hint { font-size: 13px; margin-bottom: 12px; }
  .lab-group { margin: 14px 0 8px; font-size: 12px; }
  .field label { font-size: 11px; }

  .fold-head { cursor: pointer; pointer-events: auto; }
  .fold-chevron { display: block; width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; color: var(--text2); transition: transform 0.2s; flex-shrink: 0; }
  .fold-status { display: block; }
  .fold.collapsed .fold-body, .sub.collapsed > :not(.sub-toggle) { display: none; }
  .fold.collapsed .fold-chevron { transform: rotate(-90deg); }
  .sub-toggle { display: block; cursor: pointer; }
  .sub-toggle::after { content: ' ▸'; }
  .sub:not(.collapsed) .sub-toggle::after { content: ' ▾'; }
  #open-weekly { display: none; }

  #view-today.active { display: flex; flex-direction: column; }
  .card-hero { order: 0; }
  [data-fold="morning"] { order: 1; }
  [data-fold="weekly"].due { order: 2; }
  [data-fold="food"] { order: 3; }
  [data-fold="evening"] { order: 4; }
  [data-fold="weekly"] { order: 5; }
  body[data-phase="evening"] [data-fold="evening"] { order: 2; }
  .fold[data-training="none"] #training-fields { display: none; }
  .fold:not([data-training="strength"]) .lifts { display: none; }

  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .field-wide { grid-column: 1 / -1; }
  .bp-pair input { min-width: 0; }
  input[type="number"], input[type="text"], input[type="date"], input[type="time"], select, textarea { font-size: 17px; min-height: 44px; padding: 10px 12px; border-radius: 10px; }
  .btn { min-height: 44px; }
  .actions { flex-direction: column; align-items: stretch; gap: 8px; }
  .actions .btn { width: 100%; }
  .actions.sticky { position: sticky; bottom: calc(var(--tabbar-h) + var(--sab) + 6px); z-index: 2; margin: 14px -14px -16px; padding: 10px 14px 16px; background: linear-gradient(to bottom, transparent, var(--card) 35%); }
  .actions.sticky { border-radius: 0 0 16px 16px; }
  .routine .actions.sticky { border-bottom-left-radius: 12px; }
  body.kb-open .actions.sticky { position: static; margin: 14px 0 0; padding: 0; background: none; }
  .actions.sticky.food-actions { display: grid; grid-template-columns: 1fr 1fr; }
  .actions.sticky.food-actions .btn:not(.secondary) { grid-column: 1 / -1; }
  .rating button { min-height: 44px; font-size: 16px; }
  .preset { min-height: 40px; padding: 8px 12px; }
  .check { min-height: 44px; }
  .check input { width: 22px; height: 22px; }
  .status-strip { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
  .status b { font-size: 20px; }
  .readiness b { font-size: 34px; }
  .readiness span { font-size: 17px; }

  .mini-seg button { min-height: 36px; padding: 8px 12px; font-size: 13px; }
  .m-del { min-width: 40px; min-height: 40px; padding: 0 10px; }
  .toast { bottom: calc(var(--tabbar-h) + var(--sab) + 12px); z-index: 40; max-width: calc(100% - 28px); }
  .modal { align-items: flex-end; padding: 0; }
  .modal-box { border-radius: 20px 20px 0 0; max-width: none; max-height: 90vh; max-height: 90dvh; padding: 20px 16px calc(20px + var(--sab)); }

  .stat-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .stat-card { padding: 14px; }
  .stat-card .big { font-size: 24px; }
  .stat-card .big small { font-size: 12px; }
  .stat-card svg { height: 34px; }
  .deltas { gap: 8px; }
  .delta { font-size: 11px; }
  .lab-row { grid-template-columns: 10px 1fr; }
  .lab-row .lab-val, .lab-row .lab-delta, .lab-row .lab-status { grid-column: 2; text-align: left; }
  .cmp-row { min-width: 480px; }
}

@media (prefers-reduced-motion: reduce) {
  .sheet-panel, .sheet-backdrop, .fold-chevron, .tabbar { transition: none; }
  .view.active { animation: none; }
}

/* Ekrany startowe: jezyk, konto, onboarding */
#gate { position: fixed; inset: 0; z-index: 60; background: var(--bg); overflow-y: auto; display: none; }
#gate.on { display: block; }
.gate-wrap { max-width: 460px; margin: 0 auto; padding: calc(var(--sat) + 40px) 20px calc(var(--sab) + 32px); min-height: 100%; display: flex; flex-direction: column; }
.gate-brand { text-align: center; margin-bottom: 26px; }
.gate-brand .wordmark { font-size: 27px; color: var(--text); }
.gate-brand .tag { color: var(--text2); font-size: 15px; margin-top: 8px; }
.gate-brand img { width: 62px; height: 62px; border-radius: 18px; margin-bottom: 16px; }
.gate h2 { font-size: 26px; font-weight: 700; letter-spacing: -0.02em; margin-bottom: 6px; }
.gate .hint { color: var(--text2); font-size: 15px; line-height: 1.45; margin-bottom: 20px; }
.gate .actions { margin-top: auto; padding-top: 24px; flex-direction: column; align-items: stretch; }
.gate .actions .btn { width: 100%; padding: 15px 26px; font-size: 16px; }
.gate .field { margin-bottom: 14px; }
.gate .field input { padding: 14px 14px; font-size: 16px; }
.gate .err { color: var(--red); font-size: 14px; min-height: 1.2em; margin-top: 4px; }
.gate .link { background: none; border: none; color: var(--accent); font-family: inherit; font-size: 15px; font-weight: 600; cursor: pointer; padding: 14px 0; }
.gate .foot { text-align: center; color: var(--text2); font-size: 13px; line-height: 1.5; margin-top: 16px; }

.pick { display: grid; gap: 10px; }
.pick button {
  display: flex; align-items: center; gap: 14px; text-align: left; width: 100%;
  background: var(--card); border: 1.5px solid var(--line); border-radius: 16px; padding: 15px 16px;
  font-family: inherit; color: var(--text); cursor: pointer; transition: border-color 0.15s, background 0.15s;
}
.pick button .em { font-size: 22px; line-height: 1; flex-shrink: 0; }
.pick button b { display: block; font-size: 15px; font-weight: 600; }
.pick button small { display: block; color: var(--text2); font-size: 13px; margin-top: 2px; line-height: 1.35; }
.pick button .tick { margin-left: auto; width: 22px; height: 22px; border-radius: 50%; border: 1.5px solid var(--line); flex-shrink: 0; }
.pick button.on { border-color: var(--accent); background: var(--card2); }
.pick button.on .tick { background: var(--accent); border-color: var(--accent); position: relative; }
.pick button.on .tick::after { content: "✓"; position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: var(--on-accent); font-size: 13px; font-weight: 800; }

.steps { display: flex; gap: 6px; margin-bottom: 24px; }
.steps i { flex: 1; height: 4px; border-radius: 100px; background: rgba(141, 154, 158, 0.22); }
.steps i.on { background: var(--accent); }
.gate-back { background: none; border: none; color: var(--text2); font-size: 22px; cursor: pointer; padding: 0 0 12px; font-family: inherit; }

/* Ekran glowny: podsumowanie dnia, trendy, szybki wpis */
.summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(96px, 1fr)); gap: 10px; }
.summary .cell { background: var(--card2); border-radius: 14px; padding: 12px; }
.summary .cell .em { font-size: 15px; }
.summary .cell b { display: block; font-size: 19px; font-weight: 700; margin-top: 4px; letter-spacing: -0.01em; }
.summary .cell span { display: block; color: var(--text2); font-size: 12px; margin-top: 2px; }
.trend-row { display: flex; gap: 16px; flex-wrap: wrap; }
.trend-row .t { font-size: 13px; color: var(--text2); }
.trend-row .t b { display: block; font-size: 15px; color: var(--text); }
.trend-row .t b.good { color: var(--green); }
.trend-row .t b.bad { color: var(--orange); }
.quick { display: flex; gap: 8px; flex-wrap: wrap; }
.quick button { background: var(--card2); border: 1px solid var(--line); border-radius: 100px; padding: 10px 16px; color: var(--text); font-family: inherit; font-size: 14px; font-weight: 600; cursor: pointer; }
.quick button:active { transform: scale(0.97); }

/* Zgody, stopka prawna i szybkie logowanie */
.consent { display: flex; gap: 10px; align-items: flex-start; margin: 12px 0; cursor: pointer; }
.consent input { width: 22px; height: 22px; margin: 1px 0 0; flex-shrink: 0; accent-color: var(--accent); }
.consent span { font-size: 13.5px; color: var(--text2); line-height: 1.45; }
.consent a { color: var(--accent); }
.consent i { color: var(--accent); font-style: normal; margin-left: 3px; }
.gate .foot a { color: var(--text2); text-decoration: underline; }
.social { display: grid; gap: 10px; margin-bottom: 18px; }
.social-btn { display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; padding: 14px 18px; font-size: 15px; }
.social-btn .g { font-weight: 800; font-size: 16px; }
.or { display: flex; align-items: center; gap: 12px; color: var(--text2); font-size: 13px; margin: 0 0 16px; }
.or::before, .or::after { content: ""; flex: 1; height: 1px; background: var(--line); }

/* Nakladka z regulaminem i polityka prywatnosci */
.legal-sheet { position: fixed; inset: 0; z-index: 80; background: var(--bg); display: none; flex-direction: column; }
.legal-sheet.on { display: flex; }
.legal-top { display: flex; justify-content: flex-end; padding: calc(var(--sat) + 10px) 16px 10px; background: var(--bar-bg); border-bottom: 1px solid var(--line); flex-shrink: 0; }
.legal-close { background: none; border: none; color: var(--accent); font-family: inherit; font-size: 16px; font-weight: 600; cursor: pointer; padding: 8px 4px; min-height: 44px; }
.legal-body { overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 8px 20px calc(var(--sab) + 40px); max-width: 720px; margin: 0 auto; width: 100%; }
.legal-body h1 { font-size: 26px; letter-spacing: -0.02em; margin: 14px 0 6px; }
.legal-body h2 { font-size: 17px; margin: 24px 0 6px; }
.legal-body p, .legal-body li { color: var(--text2); font-size: 15px; line-height: 1.6; }
.legal-body ul { padding-left: 20px; margin: 6px 0; }
.legal-body a { color: var(--accent); }
.legal-body .brand { font-family: Manrope, Inter, sans-serif; font-weight: 800; letter-spacing: 0.22em; font-size: 13px; color: var(--accent); text-transform: uppercase; }
.legal-body .meta { color: var(--text2); font-size: 13px; margin-bottom: 18px; }
.legal-body .note { background: var(--card); border-radius: 14px; padding: 14px 16px; margin: 16px 0; font-size: 14px; }

/* Ekran powitalny przed zalozeniem konta */
.gate-lang { display: flex; justify-content: flex-end; margin-bottom: 4px; }
.gate-lang button { background: none; border: 1px solid var(--line); color: var(--text2); border-radius: 100px; padding: 8px 13px; font-family: inherit; font-size: 13px; font-weight: 600; cursor: pointer; min-height: 36px; }
.welcome-lead { color: var(--text2); font-size: 16px; line-height: 1.5; margin: 4px 0 26px; }
.welcome-list { display: grid; gap: 16px; }
.wrow { display: flex; gap: 14px; align-items: flex-start; }
.wrow .em { font-size: 22px; line-height: 1.2; flex-shrink: 0; }
.wrow b { display: block; font-size: 15px; font-weight: 600; }
.wrow small { display: block; color: var(--text2); font-size: 13.5px; line-height: 1.45; margin-top: 3px; }

/* Onboarding: wybor z listy, wyszukiwarka, nawyki, ilustracja Apple Health */
.search input { width: 100%; border: 1px solid var(--line); background: var(--card); border-radius: 12px; padding: 12px 14px; font-size: 16px; font-family: inherit; color: var(--text); outline: none; margin-bottom: 14px; }
.search input:focus { border-color: var(--accent); }
.chip-group { margin-bottom: 14px; }
.chip-group h4 { font-size: 12px; font-weight: 600; color: var(--text2); text-transform: uppercase; letter-spacing: 0.05em; margin: 0 0 8px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips.custom:empty { display: none; }
.chips.custom { margin-bottom: 14px; }
.chips.none { margin-top: 6px; padding-top: 12px; border-top: 1px solid var(--line); }
.chip-btn { display: inline-flex; align-items: center; gap: 8px; background: var(--card); border: 1.5px solid var(--line); border-radius: 100px; padding: 9px 12px 9px 14px; color: var(--text); font-family: inherit; font-size: 14px; font-weight: 500; cursor: pointer; min-height: 40px; transition: border-color 0.15s, background 0.15s; }
.chip-btn i { font-style: normal; width: 20px; height: 20px; border-radius: 50%; border: 1.5px solid var(--line); display: inline-flex; align-items: center; justify-content: center; font-size: 12px; color: var(--text2); flex-shrink: 0; }
.chip-btn.on { border-color: var(--accent); background: var(--card2); }
.chip-btn.on i { background: var(--accent); border-color: var(--accent); color: var(--on-accent); font-weight: 800; }
.chip-btn.add { border-style: dashed; color: var(--accent); }
.count { min-height: 1.2em; margin: 4px 0 0; }
.tips { display: grid; gap: 12px; }
.tip { display: flex; gap: 12px; align-items: flex-start; font-size: 15px; line-height: 1.45; }
.tip .num { width: 26px; height: 26px; border-radius: 50%; background: var(--card2); border: 1px solid var(--line); display: inline-flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 700; color: var(--accent); flex-shrink: 0; }
.health-art { display: flex; gap: 14px; justify-content: center; font-size: 34px; margin: 10px 0 22px; }
.health-art span { width: 64px; height: 64px; border-radius: 18px; background: var(--card); border: 1px solid var(--line); display: inline-flex; align-items: center; justify-content: center; }
.gate .actions a.btn { text-align: center; }
.social-btn.apple { background: #F5F7F6; color: #071014; }
.social-btn.apple .g::before { content: ""; }
