/* ── Coach Karell ── Phone first: one column, thumbs-sized targets, the tab
   bar at the bottom. Colours are tokens, redefined for dark mode. */

:root {
  --bg: #f5f7fa;
  --card: #ffffff;
  --text: #14213d;
  --muted: #5c677d;
  --line: #e3e7ee;
  --primary: #2a9d8f;
  --primary-soft: #e3f4f1;
  --accent: #e76f51;
  --warm: #f4a261;
  --warm-soft: #fdf0e3;
  --gold: #e9c46a;
  --danger: #c0392b;
  --shadow: 0 1px 2px rgba(20, 33, 61, .06), 0 4px 16px rgba(20, 33, 61, .05);
  --radius: 16px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1420;
    --card: #182030;
    --text: #e8edf5;
    --muted: #97a3b6;
    --line: #273246;
    --primary: #3cc1b0;
    --primary-soft: #16332f;
    --warm-soft: #3a2a1a;
    --shadow: none;
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: Inter, system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 16px;
  line-height: 1.45;
  -webkit-tap-highlight-color: transparent;
}
button, input, textarea, select { font: inherit; color: inherit; }
a { color: var(--primary); }
[hidden] { display: none !important; }

.main {
  max-width: 560px;
  margin: 0 auto;
  padding: calc(16px + env(safe-area-inset-top, 0px)) 16px calc(96px + var(--safe-bottom));
}

h1 { font-size: 26px; font-weight: 800; letter-spacing: -.02em; }
h2 { font-size: 17px; font-weight: 700; margin-bottom: 12px; }
.pageTitle { margin: 8px 0 16px; }

.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
  margin-bottom: 14px;
}
.center { text-align: center; }
.loading { text-align: center; color: var(--muted); padding: 64px 0; }
.empty { color: var(--muted); font-size: 14px; padding: 8px 0; }
.hint { color: var(--muted); font-size: 13px; margin-top: 10px; }
.footnote { color: var(--muted); font-size: 13px; text-align: center; margin: 8px 0 16px; }
.opt { color: var(--muted); font-weight: 400; }
.row { display: flex; align-items: center; gap: 8px; }
.between { justify-content: space-between; }

/* ── Buttons & inputs ── */

.btn {
  border: 0;
  border-radius: 12px;
  padding: 13px 18px;
  font-weight: 600;
  cursor: pointer;
  background: var(--line);
  min-height: 46px;
}
.btn.primary { background: var(--primary); color: #fff; }
.btn.ghost { background: transparent; border: 1.5px solid var(--line); }
.btn.danger { background: transparent; color: var(--danger); margin-top: 8px; }
.btn.link { background: none; color: var(--primary); padding: 10px 4px; min-height: 0; }
.btn.block { display: block; width: 100%; margin-top: 12px; }
.btn:disabled { opacity: .5; cursor: default; }
.iconBtn {
  border: 0; background: none; cursor: pointer;
  width: 44px; height: 44px; border-radius: 50%;
  font-size: 22px; color: var(--muted);
  display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.iconBtn:disabled { opacity: .3; }

label { display: block; font-size: 14px; font-weight: 600; margin: 14px 0 6px; }
label:first-child { margin-top: 0; }
label.inline { display: flex; align-items: center; gap: 8px; font-weight: 500; color: var(--muted); margin: 10px 0 0; }
label.inline input { width: 90px; }
input, textarea, select {
  width: 100%;
  border: 1.5px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
  background: var(--card);
  font-size: 16px; /* 16px keeps iOS from zooming in */
  outline: none;
}
input:focus, textarea:focus { border-color: var(--primary); }
textarea { resize: vertical; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.segmented { display: flex; background: var(--bg); border-radius: 12px; padding: 4px; gap: 4px; }
.segmented button {
  flex: 1; border: 0; background: none; border-radius: 9px;
  padding: 9px 6px; font-weight: 600; font-size: 14px; color: var(--muted); cursor: pointer;
}
.segmented button.on { background: var(--card); color: var(--text); box-shadow: var(--shadow); }
.segmented.small button { padding: 7px 10px; font-size: 13px; white-space: nowrap; }

.choices { display: grid; gap: 8px; }
.choice {
  text-align: left; border: 1.5px solid var(--line); background: var(--card);
  border-radius: 12px; padding: 10px 14px; cursor: pointer;
}
.choice strong { display: block; font-size: 15px; }
.choice span { color: var(--muted); font-size: 13px; }
.choice.on { border-color: var(--primary); background: var(--primary-soft); }

/* ── Sign in & setup ── */

.signin { padding-top: 8vh; }
.brand { text-align: center; margin-bottom: 24px; }
.brandMark {
  width: 64px; height: 64px; border-radius: 20px; margin: 0 auto 14px;
  background: var(--primary); color: #fff; font-size: 32px; font-weight: 800;
  display: flex; align-items: center; justify-content: center;
}
.tagline { color: var(--muted); margin-top: 6px; }
.codeInput { font-size: 28px; letter-spacing: 10px; text-align: center; font-weight: 700; }
.setup h1 { margin-bottom: 6px; }
.step { color: var(--primary); font-weight: 700; font-size: 13px; text-transform: uppercase; letter-spacing: .06em; margin: 8px 0 4px; }
.lead { color: var(--muted); margin-bottom: 16px; }

/* ── Day header ── */

.dayNav { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.dayTitle { text-align: center; }
.dayTitle p { color: var(--muted); font-size: 14px; }

/* ── Hero ── */

.hero { display: flex; gap: 16px; align-items: center; }
.ring { width: 96px; height: 96px; flex-shrink: 0; }
.ringBg { fill: none; stroke: var(--line); stroke-width: 10; }
.ringFg {
  fill: none; stroke: var(--primary); stroke-width: 10; stroke-linecap: round;
  transform: rotate(-90deg); transform-origin: 50% 50%;
  transition: stroke-dashoffset .5s ease;
}
.ringNum { font-size: 22px; font-weight: 800; text-anchor: middle; fill: var(--text); }
.ringLbl { font-size: 11px; text-anchor: middle; fill: var(--muted); }
.heroText { flex: 1; min-width: 0; }
.headline { font-weight: 600; font-size: 15px; }
.heroStats { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: 8px; font-size: 13px; color: var(--muted); }
.heroStats strong { color: var(--text); }
.tone-big { color: var(--primary); }
.tone-nudge { color: #b5651d; }
@media (prefers-color-scheme: dark) { .tone-nudge { color: var(--warm); } }
.why { font-style: italic; color: var(--muted); text-align: center; margin: -4px 12px 14px; font-size: 14px; }
.bigScore { width: 96px; height: 96px; flex-shrink: 0; border-radius: 50%; background: var(--primary-soft); display: flex; flex-direction: column; align-items: center; justify-content: center; }
.bigScore strong { font-size: 26px; font-weight: 800; color: var(--primary); line-height: 1; }
.bigScore span { font-size: 11px; color: var(--muted); }

/* ── Priorities ── */

.prios { display: grid; gap: 10px; margin-bottom: 14px; }
.prio {
  display: flex; align-items: center; gap: 14px;
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 14px; cursor: pointer; user-select: none;
  transition: background .2s;
}
.prio .check {
  width: 44px; height: 44px; flex-shrink: 0; border-radius: 50%;
  border: 2.5px solid var(--line); background: none; cursor: pointer;
  font-size: 20px; font-weight: 800; color: transparent;
  display: flex; align-items: center; justify-content: center;
  transition: transform .15s, background .2s, border-color .2s;
}
.prio:active .check { transform: scale(.9); }
.prio.done .check { background: var(--primary); border-color: var(--primary); color: #fff; animation: pop .3s ease; }
.prioBody { flex: 1; min-width: 0; }
.prioTitle { font-weight: 600; }
.prio.done .prioTitle { color: var(--muted); }
.prioSub { font-size: 13px; color: var(--muted); margin-top: 2px; }
.prioSub.over { color: #b5651d; }
.weekDots { display: flex; align-items: center; gap: 4px; margin-top: 6px; }
.weekDots i, .weekRow i { width: 10px; height: 10px; border-radius: 50%; background: var(--line); display: inline-block; }
.weekDots i.on, .weekRow i.on { background: var(--primary); }
.weekDots i.cur { outline: 2px solid var(--warm); outline-offset: 1px; }
.count { font-size: 12px; font-weight: 700; color: var(--muted); margin-left: 6px; }
.count.met { color: var(--primary); }
.total { font-size: 12px; color: var(--muted); font-weight: 600; background: var(--bg); border-radius: 20px; padding: 3px 8px; }
@keyframes pop { 50% { transform: scale(1.18); } }

/* ── Calories ── */

.kcalHead { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.kcalHead h2 { margin: 0; }
.kcalHead p { color: var(--muted); font-size: 14px; }
.kcalHead strong { color: var(--text); font-size: 20px; }
.kcalBar { margin-top: 10px; }
.kcalBar.over div { background: linear-gradient(90deg, var(--warm), var(--accent)); }
.kcalLeft { font-size: 13px; color: var(--primary); font-weight: 600; margin-top: 6px; }
.kcalLeft.over { color: #b5651d; }
.kcalBtns { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 14px 0 6px; }
.slotChips { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-top: 8px; }
.slotChip {
  border: 1.5px solid var(--line); background: var(--card); border-radius: 12px;
  padding: 8px 10px; font-size: 13px; cursor: pointer; display: flex; justify-content: space-between; gap: 6px;
}
.slotChip strong { color: var(--primary); }
.mealCardHead { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.mealCardHead h2 { margin-bottom: 8px; }
.mealCardKcal { font-weight: 800; color: var(--primary); }
.mealCardKcal.over { color: #b5651d; }
.mealCardKcal small { color: var(--muted); font-weight: 500; }
.mealList { list-style: none; }
.mealList li { display: flex; justify-content: space-between; gap: 10px; padding: 8px 0; border-top: 1px solid var(--line); }
.mealList li span { min-width: 0; overflow-wrap: anywhere; }
.mealList small { display: block; color: var(--muted); font-size: 12px; }
.mealCard .btn.block { margin-top: 10px; }
.noVit { color: #b5651d; }
.mealSlots { margin-bottom: 10px; }
.mealSlots button { padding: 8px 4px; }
label.inline select { width: auto; padding: 8px 10px; }

.kcalWeek { position: relative; display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; height: 140px; align-items: end; margin-top: 6px; }
.kcalDay { height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 3px; padding-bottom: 18px; position: relative; }
.kcalDay div { width: 70%; background: var(--primary); border-radius: 4px 4px 0 0; min-height: 0; }
.kcalDay div.over { background: var(--warm); }
.kcalDay span { font-size: 9px; color: var(--muted); }
.kcalDay small { position: absolute; bottom: 0; font-size: 11px; color: var(--muted); font-weight: 700; }
.kcalTarget { position: absolute; left: 0; right: 0; border-top: 1.5px dashed var(--gold); z-index: 1; pointer-events: none; }

/* ── Nutrition ── */

.nGroup { margin-top: 14px; display: grid; gap: 10px; }
.nBarHead { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; }
.nBarHead small { color: var(--muted); }
.nBarTrack { position: relative; height: 8px; background: var(--line); border-radius: 6px; margin-top: 4px; overflow: hidden; }
.nBarTrack div { height: 100%; background: var(--muted); opacity: .45; border-radius: 6px; transition: width .4s; }
.nBarTrack i { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--card); }
.nBar.ok .nBarTrack div { background: var(--primary); opacity: 1; }
.nBar.low .nBarTrack div { background: var(--gold); opacity: 1; }
.nBar.high .nBarTrack div { background: var(--warm); opacity: 1; }
.nBar.high .nBarHead strong { color: #b5651d; }
.nMicros { margin-top: 14px; }
.nMicros summary { font-weight: 600; font-size: 14px; cursor: pointer; padding: 6px 0; }
.nMicros .nBar { margin-top: 10px; }
.nTips { display: grid; gap: 8px; margin-top: 14px; }
.nTip { font-size: 13px; line-height: 1.45; background: var(--bg); border-radius: 12px; padding: 10px 12px; color: var(--text); }
.nTip.tone-nudge { background: var(--warm-soft); }
.nTip.tone-good { background: var(--primary-soft); }
.kcal > .nTip { margin-top: 10px; }
.nLine { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 13px; color: var(--muted); margin-top: 10px; }
.nLine strong { color: var(--text); }
.nLine .high strong { color: #b5651d; }
.mealMacros, .mealCardMacros { font-size: 12px; color: var(--muted); }
.mealCardMacros { margin: -4px 0 6px; }

/* ── Settings ── */

.setMenu { padding: 4px 0; }
.setRow {
  display: flex; align-items: center; gap: 14px; padding: 14px 16px;
  color: var(--text); text-decoration: none; border-top: 1px solid var(--line);
}
.setRow:first-child { border-top: 0; }
.setRow:active { background: var(--bg); }
.setIcon { font-size: 22px; width: 32px; height: 32px; border-radius: 9px; background: var(--primary-soft); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.setText { flex: 1; min-width: 0; }
.setText strong { display: block; font-size: 15px; }
.setText small { display: block; color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.setChevron { color: var(--muted); font-size: 22px; }
.backLink { display: inline-block; color: var(--primary); text-decoration: none; font-weight: 600; padding: 6px 0; margin-top: 4px; }
.card.danger { border: 1.5px solid #f3c4bd; }
.card.danger h2 { color: var(--danger); }

/* ── Shared ── */

.shareMine { border-top: 1px solid var(--line); padding: 10px 0; }
.shareMine:first-of-type { border-top: 0; }
.shareMine summary { cursor: pointer; list-style: none; }
.shareMine summary::-webkit-details-marker { display: none; }
.shareMine summary strong { display: block; }
.shareMine summary small { color: var(--muted); font-size: 13px; }
.shareEdit { margin-top: 6px; }
.shareWhat { font-size: 14px; font-weight: 600; margin: 14px 0 0; }
label.check.always { color: var(--muted); }
label.check .opt { display: block; font-size: 12px; }
label.check > span { display: block; }
.setupLinks { text-align: center; color: var(--muted); font-size: 14px; margin-top: 16px; }
.setupLinks .btn.link { padding: 0; font-size: 14px; }
.readOnly { text-align: center; color: var(--muted); font-size: 13px; margin: -4px 0 12px; }
.prio.ro { cursor: default; }
.prio.ro .check { display: flex; }
.roMeal { padding: 8px 0; border-top: 1px solid var(--line); }
.roMeal p:first-child { display: flex; justify-content: space-between; }
.roMeal .hint { margin-top: 2px; }
.roBody p { padding: 4px 0; }
.roNote { white-space: pre-wrap; }

/* ── What to see ── */

.features { display: grid; gap: 8px; margin-bottom: 4px; }
.feature {
  display: flex; align-items: center; gap: 12px; margin: 0; cursor: pointer;
  border: 1.5px solid var(--line); border-radius: 14px; padding: 10px 12px; font-weight: 400;
}
.feature.on { border-color: var(--primary); background: var(--primary-soft); }
.feature input { width: 20px; height: 20px; flex-shrink: 0; accent-color: var(--primary); }
.featIcon { font-size: 22px; width: 28px; text-align: center; flex-shrink: 0; }
.feature strong { display: block; font-size: 15px; }
.feature small { display: block; color: var(--muted); font-size: 13px; }

/* ── Training days ── */

.dayChips { display: flex; gap: 6px; margin-bottom: 8px; }
.dayChips button { width: 40px; height: 40px; border-radius: 50%; border: 1.5px solid var(--line); background: var(--card); font-weight: 700; cursor: pointer; }
.dayChips button.on { background: var(--primary); border-color: var(--primary); color: #fff; }
.trainTag { font-size: 12px; font-weight: 600; color: var(--primary); }

/* ── Insights ── */

.insHead { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }
.insHead h2 { margin: 0; }
.insTitle { font-size: 14px; margin: 18px 0 6px; }
.insTitle small { color: var(--muted); font-weight: 500; }
.lgW { color: #219ebc; font-weight: 600; font-size: 12px; }
.chart.bars rect { fill: var(--primary); opacity: .8; }
.chart.bars rect.over { fill: var(--warm); }
.chart .wLine { fill: none; stroke: #219ebc; stroke-width: 2; }
.chart .wDot { fill: #219ebc; }
.avgTable { display: grid; gap: 2px; }
.avgRow { display: grid; grid-template-columns: 1fr auto; gap: 0 10px; padding: 6px 0; border-top: 1px solid var(--line); font-size: 14px; }
.avgRow small { grid-column: 1 / 3; color: var(--muted); font-size: 12px; }
.avgRow.low strong { color: #b5651d; }
.avgRow.high strong { color: #b5651d; }
.avgRow.ok strong { color: var(--primary); }
.oracle { padding: 8px 0; border-top: 1px solid var(--line); }
.oracle .hint { margin-top: 2px; }

/* ── Next small win & habits ── */

.win { border: 2px solid var(--primary); background: linear-gradient(135deg, var(--primary-soft), var(--card) 70%); }
.winLabel { font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; color: var(--primary); }
.winText { font-weight: 600; margin-top: 4px; }
.win .btn.block { margin-top: 10px; }
.habHead { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.habHead h2 { margin-bottom: 8px; }
.habHead span { color: var(--muted); font-size: 14px; }
.habHead strong { color: var(--text); }
.moveHead { margin-top: 16px; }
.glasses { display: flex; flex-wrap: wrap; gap: 6px; }
.glass {
  width: 34px; height: 42px; border-radius: 4px 4px 10px 10px; cursor: pointer;
  border: 2px solid #8ecae6; background: transparent; position: relative; overflow: hidden;
}
.glass.on { background: linear-gradient(to top, #219ebc 0 75%, transparent 75%); border-color: #219ebc; }
.exRow { display: flex; align-items: center; gap: 8px; padding: 6px 0; border-top: 1px solid var(--line); font-size: 14px; }
.exRow span:first-child { flex: 1; }
.exKcal { color: var(--muted); font-size: 13px; }
.exRow .iconBtn { width: 32px; height: 32px; font-size: 14px; }
.exAdd { margin-top: 8px; }
.exKinds, .exMinutes { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 6px; }
.exKind, .exMin {
  flex-shrink: 0; border: 1.5px solid var(--line); background: var(--card); border-radius: 20px;
  padding: 7px 11px; font-size: 13px; cursor: pointer; white-space: nowrap;
}
.exKind.on { border-color: var(--primary); background: var(--primary-soft); font-weight: 600; }
.exMin { border-color: var(--primary); color: var(--primary); font-weight: 700; }
.body summary { font-weight: 700; cursor: pointer; }
.body summary small { color: var(--primary); font-weight: 600; margin-left: 6px; }
.body .grid2 { margin-top: 10px; }
.bp { display: flex; align-items: center; gap: 4px; }
.bp input { padding: 10px 8px; }
.moods { display: flex; gap: 2px; }
.mood { font-size: 22px; background: none; border: 2px solid transparent; border-radius: 10px; cursor: pointer; padding: 2px; opacity: .55; }
.mood.on { border-color: var(--primary); opacity: 1; }
.fast .row { gap: 12px; margin-top: 8px; flex-wrap: wrap; }
label.check { display: flex; align-items: center; gap: 10px; font-weight: 500; margin-top: 14px; }
label.check input { width: 20px; height: 20px; flex-shrink: 0; accent-color: var(--primary); }

/* ── Library & quick adds ── */

.quickAdds { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; margin-bottom: 4px; }
.quickAdds:empty { display: none; }
.quick {
  flex-shrink: 0; border: 1.5px solid var(--primary); color: var(--primary); background: var(--primary-soft);
  border-radius: 20px; padding: 7px 12px; font-size: 13px; font-weight: 600; cursor: pointer; white-space: nowrap;
}
.quick small { color: var(--muted); font-weight: 500; }
.recipeFields { margin-bottom: 10px; }
.btn.small { font-size: 13px; padding: 6px 0; min-height: 0; }
.libTitle { font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; margin: 12px 0 4px; }
.libItem { display: flex; align-items: center; gap: 8px; padding: 8px 0; border-top: 1px solid var(--line); }
.libItem span { flex: 1; min-width: 0; }
.libItem small { display: block; color: var(--muted); font-size: 12px; }
.libItem .iconBtn { width: 36px; height: 36px; font-size: 15px; }
.libNew { display: grid; gap: 8px; margin-top: 10px; }
.libNew .btn { text-align: left; padding: 10px 14px; }
.libNew .btn small { display: block; font-weight: 500; font-size: 12px; color: var(--muted); }
.ingredient.serving .ingName { background: transparent; border-color: transparent; font-weight: 600; padding-left: 0; }
.servingUnit { color: var(--muted); font-weight: 600; font-size: 14px; }

/* ── Weigh-in & note ── */

.weighin { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.weighin label { margin: 0; }
.paceLine { font-size: 13px; margin-top: 2px; }
.weightInput { display: flex; align-items: center; gap: 6px; }
.weightInput input { width: 92px; text-align: right; font-weight: 700; font-size: 18px; }
.weightInput span { color: var(--muted); font-weight: 600; }
.note textarea { margin-top: 2px; }
.saved { font-size: 12px; color: var(--muted); text-align: right; min-height: 16px; margin-top: 4px; }

/* ── Week ── */

.weekHead, .weekRow { display: grid; grid-template-columns: 1fr repeat(7, 18px) 40px; gap: 4px; align-items: center; }
.weekHead { font-size: 11px; color: var(--muted); font-weight: 700; text-align: center; margin-bottom: 4px; }
.weekRow { padding: 10px 0; border-top: 1px solid var(--line); }
.weekRow i { width: 14px; height: 14px; justify-self: center; }
.weekTitle { font-weight: 600; font-size: 14px; min-width: 0; overflow-wrap: anywhere; }
.weekTitle small { display: block; font-weight: 400; color: var(--muted); }
.weekRow .count { text-align: right; margin: 0; }

/* ── Progress ── */

.goalBar, .achBar { height: 12px; background: var(--line); border-radius: 8px; overflow: hidden; }
.goalBar div, .achBar div { height: 100%; background: linear-gradient(90deg, var(--primary), var(--gold)); border-radius: 8px; transition: width .6s; }
.achBar { height: 6px; margin-top: 8px; }
.goalBarText { margin: 8px 0 12px; font-size: 14px; color: var(--muted); }
.goalBarText strong { color: var(--text); }
.chart { width: 100%; height: auto; display: block; margin-top: 4px; }
.chart .goalLine { stroke: var(--gold); stroke-dasharray: 4 4; stroke-width: 1.5; }
.chart .planLine { stroke: var(--muted); stroke-dasharray: 2 4; stroke-width: 1.5; }
.chart .actualLine { fill: none; stroke: var(--primary); stroke-width: 2.5; stroke-linejoin: round; }
.chart .actualDot { fill: var(--primary); }
.chart .axis { font-size: 10px; fill: var(--muted); }
.chart .axis.end { text-anchor: end; }
.chart .axis.endR { text-anchor: end; }
.legend { font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 6px; margin-top: 4px; }
.lg { display: inline-block; width: 16px; height: 0; border-top: 2px dashed var(--muted); }
.lg.actual { border-top: 3px solid var(--primary); margin-left: 8px; }
.kv { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 14px; }
.kv div { background: var(--bg); border-radius: 12px; padding: 10px; text-align: center; }
.kv span { display: block; font-size: 11px; color: var(--muted); }
.kv strong { font-size: 16px; }
.bars { display: grid; grid-template-columns: repeat(12, 1fr); gap: 4px; height: 90px; align-items: end; }
.bar { height: 100%; display: flex; align-items: flex-end; }
.bar i { width: 100%; background: var(--primary); opacity: .55; border-radius: 4px 4px 0 0; }
.bar i.perfect { background: var(--gold); opacity: 1; }
.bar:last-child i { opacity: 1; }
.ach { padding: 12px 0; border-top: 1px solid var(--line); }
.ach:first-of-type { border-top: 0; padding-top: 0; }
.achTop { display: flex; justify-content: space-between; gap: 8px; }
.achCount { font-weight: 800; color: var(--primary); }
.achBadges { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.badge { font-size: 12px; background: var(--warm-soft); border-radius: 20px; padding: 3px 9px; font-weight: 600; }
.badge.streak { background: var(--primary-soft); }

/* ── Priorities editor ── */

.prioEdit { border: 1.5px solid var(--line); border-radius: 14px; padding: 10px; margin-bottom: 10px; }
.prioEditTop { display: flex; align-items: center; gap: 6px; }
.prioEditTop input { padding: 10px 12px; }
.prioEditTop .iconBtn { width: 36px; height: 36px; font-size: 16px; }
.prioNum { width: 24px; text-align: center; font-weight: 800; color: var(--primary); flex-shrink: 0; }
.prioEditBottom { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.stepper { display: flex; align-items: center; gap: 4px; font-size: 13px; color: var(--muted); }
.stepper button { width: 34px; height: 34px; border-radius: 50%; border: 1.5px solid var(--line); background: var(--card); font-size: 18px; cursor: pointer; }
.stepper strong { color: var(--text); font-size: 16px; }
.ideasTitle { font-size: 15px; margin: 20px 0 10px; }
.ideas { display: grid; gap: 8px; }
.idea { text-align: left; border: 1.5px dashed var(--line); background: none; border-radius: 12px; padding: 10px 12px; cursor: pointer; }
.idea strong { color: var(--primary); }
.idea small { color: var(--muted); }
.idea span { display: block; color: var(--muted); font-size: 13px; margin-top: 2px; }

/* ── Tab bar ── */

.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  display: flex; justify-content: space-around;
  background: var(--card); border-top: 1px solid var(--line);
  padding: 6px 8px calc(6px + var(--safe-bottom));
}
.tabbar a {
  flex: 1; max-width: 120px; text-align: center; text-decoration: none;
  color: var(--muted); font-size: 10.5px; font-weight: 600; padding: 4px 0; min-width: 0;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
}
.tabbar a span { font-size: 20px; line-height: 1.2; }
.tabbar a.active { color: var(--primary); }

/* ── Sheets ── */

.sheet {
  position: fixed; inset: 0; z-index: 20;
  background: rgba(10, 16, 28, .45);
  display: flex; align-items: flex-end; justify-content: center;
  opacity: 0; transition: opacity .2s;
}
.sheet.open { opacity: 1; }
.sheetBody {
  background: var(--card); width: 100%; max-width: 560px;
  border-radius: 20px 20px 0 0; padding: 16px 16px calc(16px + var(--safe-bottom));
  max-height: 92vh; overflow-y: auto;
  transform: translateY(30px); transition: transform .2s;
}
.sheet.open .sheetBody { transform: none; }
.sheetHead { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.sheetHead h2 { margin: 0; }

.foodAdd { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; margin: 10px 0 4px; }
.foodAdd .btn { padding-left: 8px; padding-right: 8px; }
.foodAdd.two { grid-template-columns: 1fr 1fr; }
.mealItems { margin-top: 4px; }
.ingredient { position: relative; padding: 12px 0; border-top: 1px solid var(--line); }
.ingredient:first-child { border-top: 0; }
.ingTop { display: flex; gap: 6px; align-items: center; }
.ingName { padding: 10px 12px; font-weight: 600; }
.ingRemove { width: 36px; height: 36px; font-size: 16px; }
.ingAmount { display: grid; grid-template-columns: 84px 1fr auto; gap: 8px; align-items: center; margin-top: 8px; }
.ingAmount input, .ingAmount select { padding: 9px 10px; }
.ingAmount select { appearance: auto; background: var(--card); }
.ingKcal { font-weight: 800; white-space: nowrap; text-align: right; min-width: 72px; }
.ingMeta { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: 6px; font-size: 12px; color: var(--muted); }
.ingK100 { display: flex; align-items: center; gap: 6px; margin: 0; font-size: 12px; font-weight: 500; color: var(--muted); }
.ingK100 input { width: 76px; padding: 5px 8px; font-size: 14px; border-radius: 8px; }
.suggest {
  position: absolute; left: 0; right: 42px; top: 58px; z-index: 5;
  background: var(--card); border: 1.5px solid var(--line); border-radius: 12px;
  box-shadow: 0 8px 24px rgba(20, 33, 61, .18); max-height: 300px; overflow-y: auto; padding: 4px 0;
}
.suggestion {
  display: flex; width: 100%; justify-content: space-between; gap: 10px; text-align: left;
  border: 0; background: none; padding: 10px 12px; cursor: pointer; border-top: 1px solid var(--line);
}
.suggestion:first-child { border-top: 0; }
.suggestion:active { background: var(--primary-soft); }
.suggest .empty { padding: 8px 12px; }
.foodName { min-width: 0; overflow-wrap: anywhere; }
.foodName small { color: var(--muted); }
.foodKcal { color: var(--muted); font-size: 12px; white-space: nowrap; text-align: right; }
.mealFoot {
  display: flex; justify-content: space-between; align-items: flex-end; gap: 12px;
  border-top: 2px solid var(--line); margin-top: 8px; padding-top: 12px;
  position: sticky; bottom: calc(-16px - var(--safe-bottom)); background: var(--card); padding-bottom: 4px;
}
.mealTotalLbl { font-size: 12px; color: var(--muted); }
.mealTotal { font-size: 24px; font-weight: 800; }
.mealVs { font-size: 13px; color: var(--muted); max-width: 220px; }
.mealVs.good { color: var(--primary); }
.mealVs.nudge { color: #b5651d; }
.mealBtns { display: flex; flex-direction: column; gap: 6px; }

.scanView { position: relative; border-radius: 14px; overflow: hidden; background: #000; aspect-ratio: 4 / 3; }
.scanView video { width: 100%; height: 100%; object-fit: cover; display: block; }
.scanFrame {
  position: absolute; left: 12%; right: 12%; top: 30%; bottom: 30%;
  border: 3px solid rgba(255, 255, 255, .85); border-radius: 12px;
  box-shadow: 0 0 0 999px rgba(0, 0, 0, .25);
}
.scanStatus { text-align: center; color: var(--muted); margin: 10px 0; font-size: 14px; }
.scanManual { display: flex; gap: 8px; margin-top: 12px; }

/* ── Dialog ── */

.dialog {
  position: fixed; inset: 0; z-index: 50; background: rgba(10, 16, 28, .5);
  display: flex; align-items: center; justify-content: center; padding: 24px;
}
.dialogBody { background: var(--card); border-radius: 20px; padding: 22px 20px 14px; width: 100%; max-width: 380px; box-shadow: 0 12px 40px rgba(0, 0, 0, .25); }
.dialogBody h2 { margin-bottom: 6px; }
.dialogBody p { color: var(--muted); font-size: 14px; }
.dialogBody input { margin-top: 12px; }
.dialogBtns { display: grid; gap: 8px; margin-top: 16px; }
.dialogBody { max-height: calc(100vh - 48px); overflow-y: auto; }
.dialogPoints { margin: 10px 0 0; }
.dialogPoints dt { font-weight: 700; font-size: 15px; margin-top: 12px; }
.dialogPoints dt:first-child { margin-top: 0; }
.dialogPoints dd { margin: 2px 0 0; color: var(--muted); font-size: 14px; line-height: 1.4; }
/* ⓘ — what something means, one tap away. */
.info {
  display: inline-flex; align-items: center; justify-content: center; vertical-align: middle;
  width: 22px; height: 22px; margin-left: 6px; border-radius: 50%; border: 1.5px solid var(--primary);
  color: var(--primary); background: transparent; font: italic 700 13px/1 Georgia, serif; cursor: pointer; padding: 0;
}
.labelRow { display: flex; align-items: center; justify-content: space-between; }
.labelRow label { margin-bottom: 0; }
.dialogBtns .btn.danger { background: var(--danger); color: #fff; margin: 0; }

/* ── Toast & confetti ── */

.toast {
  position: fixed; left: 50%; bottom: calc(84px + var(--safe-bottom)); z-index: 30;
  transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  width: calc(100% - 32px); max-width: 520px;
  background: var(--text); color: var(--bg);
  border-radius: 14px; padding: 13px 16px; font-weight: 600; font-size: 14px; text-align: center;
  transition: opacity .25s, transform .25s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.tone-big { background: var(--primary); color: #fff; }
.toast.tone-nudge { background: var(--warm); color: #14213d; }

.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 40; overflow: hidden; }
.confetti i { position: absolute; top: -12px; width: 8px; height: 14px; border-radius: 2px; animation: fall 1.6s ease-in forwards; }
@keyframes fall { to { transform: translateY(105vh) rotate(540deg); opacity: .6; } }

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

/* ── Workouts ── */

.workoutRow.done .setText strong { color: var(--muted); }
.workoutRow .setText small, .person .setText small, .linkCard .setText small { white-space: normal; }
.person .btn.small { padding: 8px 12px; }
.todayWorkouts h2 { margin-bottom: 4px; }
.todayWorkouts .setRow { padding: 12px 0; }
.trainersLink { padding: 14px 16px; }
.bigIcon { font-size: 40px; margin: 4px 0; }
.invite { border: 1.5px solid var(--primary); }
.invite p { margin-bottom: 10px; }
.trainerNote p { white-space: pre-wrap; }
.doneBanner { background: var(--primary-soft); }
.wEx { border-top: 1px solid var(--line); padding: 12px 0; }
.wEx:first-child { border-top: 0; }
.wExTop { display: flex; gap: 12px; align-items: center; }
.wExTop .hint { margin: 2px 0 0; }
.wName { font-weight: 700; }
.wEx .check {
  width: 36px; height: 36px; flex-shrink: 0; border-radius: 50%;
  border: 2.5px solid var(--line); background: none; font-size: 16px; font-weight: 800; color: transparent;
  display: flex; align-items: center; justify-content: center; cursor: pointer;
}
.wEx.on .check { background: var(--primary); border-color: var(--primary); color: #fff; }
.wEx .check:disabled { cursor: default; }
.wEx:not(.on) .wName { color: var(--muted); text-decoration: line-through; }
.wNums { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; padding-left: 48px; }
.wNum { display: flex; flex-direction: column; gap: 2px; font-size: 12px; color: var(--muted); font-weight: 600; margin: 0; }
.wNum input { width: 68px; padding: 8px; }
.exFrom { text-decoration: none; width: 36px; text-align: center; }

/* ── Trainers & clients ── */

.linkCard .linkHead { display: flex; gap: 12px; align-items: center; margin-bottom: 8px; }
.linkCard details summary { cursor: pointer; color: var(--primary); font-weight: 600; margin: 6px 0; }
.person { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-top: 1px solid var(--line); }
.person:first-child { border-top: 0; }
.tag { font-size: 12px; font-weight: 700; color: var(--primary); background: var(--primary-soft); border-radius: 10px; padding: 4px 8px; white-space: nowrap; }
#trainerHits, #clientHits { margin-top: 10px; }
.atInput { display: flex; align-items: center; gap: 6px; }
.atInput span { color: var(--muted); font-weight: 700; font-size: 18px; }
.coachTabs { margin-bottom: 12px; }
.coachTabs button { flex: 1; }
.bExTitle { margin-top: 18px; }
.bEx { border-top: 1px solid var(--line); padding: 12px 0; }
.bExTop { display: flex; gap: 6px; align-items: center; }
.bExTop input { flex: 1; font-weight: 600; }
.bEx .wNums { padding-left: 0; }
.bEx > input { margin-top: 8px; font-size: 14px; }
.weekdays { display: flex; gap: 6px; }
.weekdays button {
  flex: 1; height: 40px; border-radius: 10px; border: 1.5px solid var(--line); background: var(--card);
  color: var(--text); font-weight: 700; cursor: pointer;
}
.weekdays button.on { background: var(--primary); border-color: var(--primary); color: #fff; }
.assigned { border-top: 1px solid var(--line); padding: 10px 0; }
.assigned:first-of-type { border-top: 0; }
.assigned summary { display: flex; gap: 10px; align-items: center; cursor: pointer; list-style: none; }
.assigned summary::-webkit-details-marker { display: none; }
.assigned summary strong, .assigned summary small { display: block; }
.assigned summary small { color: var(--muted); font-size: 13px; }
.results { margin: 8px 0 0 30px; padding: 0; font-size: 14px; color: var(--muted); }
.results li.skipped { text-decoration: line-through; }
.clientNote { margin: 8px 0 0 30px; font-size: 14px; }
#bKind { display: grid; grid-template-columns: 1fr 1fr; }
.bEx .wNums { display: grid; grid-template-columns: repeat(3, 1fr); }
.bEx .wNum input { width: 100%; }
