/* Jolt: dark, phone-first. Colours come from the logo: green (calories, running), orange (protein, cycling),
   blue (water, swimming), purple (gym). Text in Inter; numbers in Barlow Semi Condensed. */
:root {
  --bg: #0b0e12;
  --surface: #141a21;
  --surface2: #10151b;
  --raised: #1b222b;
  --input: #0b0e12;
  --fg: #e8edf2;
  --muted: #8b96a3;
  --line: #232a33;
  --line2: #1d242c;
  --green: #5be16b;
  --orange: #ff7a2f;
  --blue: #3aa0ff;
  --purple: #a98bff;
  --yellow: #f0c04b;
  --red: #ff5f5f;
  --accent: var(--green);
  --accent-fg: #06210f;
  --water: var(--blue);
  --protein: var(--orange);
  --warn: var(--orange);
  --run: var(--green);
  --swim: var(--blue);
  --ride: var(--orange);
  --gym: var(--purple);
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --num: "Barlow Semi Condensed", "Inter", -apple-system, "Helvetica Neue", Arial, sans-serif;
  --tabbar: 64px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--fg); font: 15px/1.45 var(--font); -webkit-tap-highlight-color: transparent; }
/* paint the band behind the iPhone status bar */
body::before { content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); background: var(--bg); z-index: 19; }
.wrap {
  max-width: 1100px; margin: 0 auto; display: flex; flex-direction: column; gap: 12px;
  /* always at least a full screen tall: on an iPhone home-screen app a shorter page (like Ask) pushes
     the bottom tab bar up by the height of the status bar */
  min-height: 100vh; min-height: 100lvh;
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: calc(var(--tabbar) + 28px + env(safe-area-inset-bottom, 0px));
  padding-left: max(14px, env(safe-area-inset-left, 0px));
  padding-right: max(14px, env(safe-area-inset-right, 0px));
}
#app { display: flex; flex-direction: column; gap: 12px; }
#app[hidden], [hidden] { display: none !important; }

h1 { font-size: 1.3rem; font-weight: 700; margin: 0; text-wrap: balance; }
h2 { font-size: .95rem; font-weight: 600; margin: 0 0 10px; }
h3 { font-size: .95rem; font-weight: 600; }
.muted { color: var(--muted); }
.small { font-size: .82rem; }
.num { font-family: var(--num); font-variant-numeric: tabular-nums; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
code { font-size: .9em; }

/* ---------- cards ---------- */
.card { background: linear-gradient(160deg, var(--surface), var(--surface2)); border: 1px solid var(--line); border-radius: 18px; padding: 14px; min-width: 0; }
details.card > summary { cursor: pointer; font-weight: 600; list-style: none; display: flex; justify-content: space-between; align-items: center; }
details.card > summary::-webkit-details-marker { display: none; }
details.card > summary::after { content: "›"; color: var(--muted); font-size: 1.2rem; transition: transform .2s; }
details.card[open] > summary::after { transform: rotate(90deg); }
details.card[open] > summary { margin-bottom: 12px; }
.row-card { padding: 13px 14px; background: var(--surface2); }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 10px; }
.card-head h2 { margin: 0; }

/* ---------- header and tab bar ---------- */
.app-hdr { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 18; display: flex; align-items: center; gap: 10px; padding: 10px 0 8px;
  background: color-mix(in srgb, var(--bg) 92%, transparent); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); }
.brand { display: flex; align-items: center; gap: 9px; }
.brand-logo { width: 30px; height: 30px; border-radius: 9px; display: block; }
.brand b { font-family: var(--num); font-weight: 700; font-size: 1.3rem; letter-spacing: .08em; }
.big-brand { margin-bottom: 6px; } .big-brand .brand-logo { width: 44px; height: 44px; border-radius: 12px; } .big-brand b { font-size: 1.8rem; }
.hdr-ctx { margin-left: auto; display: flex; align-items: center; min-width: 0; }
.hdr-title { color: var(--muted); font-weight: 600; }
.hdr-seg { padding: 3px; border-radius: 11px; }
.hdr-seg .seg-btn { min-height: 32px; padding: 0 11px; font-size: .82rem; flex: 0 0 auto; }
.tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; display: flex; justify-content: space-around;
  padding: 7px max(10px, env(safe-area-inset-left, 0px)) calc(8px + env(safe-area-inset-bottom, 0px));
  background: color-mix(in srgb, #0e1217 96%, transparent); border-top: 1px solid var(--line); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); }
.tabbar .tab { flex: 0 1 90px; display: flex; flex-direction: column; align-items: center; gap: 3px; min-height: 48px; padding: 4px 0;
  font: inherit; font-size: .68rem; font-weight: 500; color: #6c7682; background: none; border: 0; cursor: pointer; border-radius: 12px; }
.tabbar .tab svg { width: 23px; height: 23px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.tabbar .tab[aria-pressed="true"] { color: var(--accent); box-shadow: none; background: none; }

/* ---------- day header (Nutrition) ---------- */
.day-row { display: flex; align-items: center; gap: 8px; }
.day { flex: 1; text-align: center; display: flex; flex-direction: column; }
.day h1 { font-size: 1.35rem; }
.day-ctx { margin: -4px 0 0; text-align: center; color: var(--accent); font-size: .82rem; font-weight: 500; }
.icon { width: 40px; height: 40px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); color: var(--fg); font-size: 1.35rem; line-height: 1; cursor: pointer; flex: none; }
.icon:disabled { opacity: .3; cursor: default; }

/* ---------- forms and buttons ---------- */
.row { display: flex; gap: 8px; align-items: center; }
.wrap-row { flex-wrap: wrap; }
.stack { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.fld { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.wide { grid-column: 1 / -1; }
label { font-size: .8rem; color: var(--muted); }
.check { display: flex; align-items: center; gap: 8px; color: var(--fg); font-size: .92rem; }
.check input { width: 20px; height: 20px; accent-color: var(--accent); }
input, select, textarea {
  font: inherit; width: 100%; min-height: 44px; padding: 8px 11px; border-radius: 11px;
  border: 1px solid var(--line); background: var(--input); color: var(--fg);
}
input[type=number] { font-family: var(--num); font-size: 1.05rem; font-weight: 600; }
input:focus-visible, select:focus-visible, textarea:focus-visible, button:focus-visible, summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn {
  font: inherit; font-weight: 600; min-height: 44px; padding: 8px 14px; border-radius: 12px; cursor: pointer;
  border: 1px solid var(--line); background: var(--raised); color: var(--fg); white-space: nowrap;
}
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-fg); }
.btn.ghost { background: transparent; }
.btn.full { width: 100%; }
.btn:disabled { opacity: .5; cursor: default; }
.small-btn { min-height: 34px; padding: 4px 12px; font-size: .85rem; border-radius: 10px; }
.link-btn { font: inherit; font-size: .8rem; color: var(--muted); background: none; border: 0; text-decoration: underline dotted; cursor: pointer; padding: 4px; }
.filebtn { position: relative; overflow: hidden; display: inline-flex; align-items: center; justify-content: center; }
.filebtn input { position: absolute; inset: 0; opacity: 0; cursor: pointer; font-size: 100px; }
.filebtn:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }
.busy { opacity: .5; pointer-events: none; }
.sync-status { margin: 10px 0 0; }
.sync-status.err { color: var(--warn); }
.msg { min-height: 1.2em; margin: 10px 0 0; color: var(--muted); }
.toast {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(var(--tabbar) + 22px + env(safe-area-inset-bottom, 0px));
  background: var(--fg); color: var(--bg); padding: 10px 16px; border-radius: 12px; font-weight: 600;
  max-width: calc(100% - 32px); z-index: 40; box-shadow: 0 8px 24px rgba(0,0,0,.4);
}

/* ---------- segmented switches and chips ---------- */
.seg { display: flex; gap: 3px; padding: 3px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); }
.seg-btn { flex: 1; font: inherit; font-weight: 600; min-height: 36px; border: 0; border-radius: 9px; cursor: pointer; background: transparent; color: var(--muted); }
.seg-btn[aria-pressed="true"] { background: #222a33; color: var(--fg); }
.small-seg { align-self: flex-start; }
.small-seg .seg-btn { min-height: 32px; padding: 0 12px; font-size: .85rem; flex: 0 0 auto; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip-btn {
  font: inherit; font-weight: 500; font-size: .88rem; padding: 6px 12px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--line); background: var(--surface); color: #c9d2db; display: inline-flex; align-items: center; gap: 6px;
}
.chip-btn[aria-pressed="true"] { background: var(--fg); border-color: var(--fg); color: var(--bg); }
.chip-btn span { font-weight: 400; opacity: .7; }
.chip-btn i { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }

/* ---------- views ---------- */
#signin, #setup, .narrow { width: 100%; max-width: 560px; margin-inline: auto; }
.signin { margin-top: 24px; }
.view { display: flex; flex-direction: column; gap: 12px; }
.fit-panel { display: flex; flex-direction: column; gap: 12px; }
.section-label { font-size: .72rem; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); margin: 6px 2px -2px; font-weight: 600; }
.label { font-size: .68rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 500; }

/* ---------- tiles ---------- */
.tiles { display: grid; gap: 8px; }
.tiles.two-up { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.tiles.three-up { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.tiles.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.tiles.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.tiles.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (min-width: 900px) { .tiles.two-up { grid-template-columns: repeat(4, minmax(0, 1fr)); } .tiles.three-up { grid-template-columns: repeat(6, minmax(0, 1fr)); } #bodyTiles { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 760px) { .tiles.three { grid-template-columns: 1fr 1fr; } .tiles.three .card:last-child { grid-column: 1 / -1; } }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 9px 11px; display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.tile .label { text-transform: none; letter-spacing: 0; font-size: .72rem; }
.tile .val { font-family: var(--num); font-size: 1.5rem; font-weight: 600; font-variant-numeric: tabular-nums; line-height: 1.15; overflow-wrap: anywhere; }
.tile .val small { font-family: var(--font); font-size: .74rem; font-weight: 400; color: var(--muted); }
.tile .sub { font-size: .72rem; color: var(--muted); line-height: 1.3; }
.tile .sub.good { color: var(--accent); font-weight: 500; }
.tile .sub.warn { color: var(--warn); font-weight: 500; }
.three-up .tile .val { font-size: 1.35rem; }
.inner-tiles .tile { background: var(--input); border-color: transparent; }
.pill { align-self: flex-start; font-size: .75rem; font-weight: 600; padding: 4px 10px; border-radius: 999px; background: var(--line); color: var(--fg); white-space: nowrap; }
.pill.warn { background: color-mix(in srgb, var(--warn) 16%, transparent); color: var(--warn); }
.pill.good { background: color-mix(in srgb, var(--accent) 16%, transparent); color: var(--accent); }

/* ---------- Nutrition: rings ---------- */
.rings-row { display: flex; align-items: center; gap: 16px; }
.rings { width: 132px; height: 132px; flex: none; }
.ring-bg, .ring { stroke-width: 12; }
.ring-bg.k, .ring.k { stroke: var(--green); } .ring-bg.p, .ring.p { stroke: var(--protein); } .ring-bg.w, .ring.w { stroke: var(--water); }
.ring-bg { stroke-opacity: .15; }
.ring { transition: stroke-dashoffset .6s ease; }
.ring.k.over { stroke: var(--red); }
.ring-legend { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.ring-legend div { display: flex; flex-direction: column; line-height: 1.15; }
.ring-legend .rl { font-size: .78rem; font-weight: 500; }
.ring-legend b { font-family: var(--num); font-size: 1.45rem; font-weight: 600; }
.ring-legend small { font-size: .74rem; color: var(--muted); }
.rl.k { color: var(--green); } .rl.p { color: var(--protein); } .rl.w { color: var(--water); }
.stat3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; margin-top: 12px; }
.st { background: var(--input); border-radius: 12px; padding: 7px 10px; display: flex; flex-direction: column; min-width: 0; }
.st .l { font-size: .7rem; color: var(--muted); }
.st .v { font-family: var(--num); font-size: 1.15rem; font-weight: 600; }
.st .v.good { color: var(--accent); } .st .v.warn { color: var(--warn); }
.eat-ideas { width: 100%; margin-top: 12px; background: color-mix(in srgb, var(--accent) 10%, var(--surface)); border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); color: var(--accent); }

/* week strip */
.week-days { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 5px; margin-bottom: 2px; }
.wd { display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: .7rem; color: var(--muted); }
.wd .col { width: 100%; height: 54px; border-radius: 8px; background: var(--input); display: flex; align-items: flex-end; overflow: hidden; }
.wd .col span { display: block; width: 100%; background: var(--green); border-radius: 8px; }
.wd .col span.over { background: var(--orange); }
.wd.today .col { outline: 1.5px solid var(--green); outline-offset: 1px; }
.wd b { font-family: var(--num); font-weight: 600; font-size: .8rem; color: #c9d2db; }
#wkNote { margin: 8px 0 0; }

/* water */
.water-t { color: var(--water); font-weight: 600; }
.water-row { gap: 8px; }
.water-btn { flex: 1; background: color-mix(in srgb, var(--water) 14%, var(--surface)); border-color: color-mix(in srgb, var(--water) 40%, var(--line)); color: var(--water); }
#waterForm { flex: 0 1 auto; }
#waterMl { width: 88px; }
.drops { display: flex; gap: 4px; margin-top: 10px; }
.drops i { flex: 1; height: 6px; border-radius: 3px; background: color-mix(in srgb, var(--water) 18%, var(--input)); }
.drops i.on { background: var(--water); }

/* scan */
.scan-tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.scan-tile { flex-direction: column; gap: 5px; padding: 12px 4px; border-radius: 14px; background: var(--input); border: 1px solid var(--line); font-size: .78rem; color: var(--fg); cursor: pointer; text-align: center; }
.scan-tile svg { width: 24px; height: 24px; fill: none; stroke: var(--green); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.scan-more { margin-top: 10px; }
.scan-more > summary { cursor: pointer; font-size: .82rem; color: var(--muted); }
#barcodeForm input { flex: 1; min-width: 0; }
.scan-note { margin: 10px 0; padding: 10px 12px; border-radius: 10px; background: var(--input); color: var(--fg); font-size: .88rem; }
.scan-item { border-top: 1px solid var(--line2); padding: 10px 0; display: grid; grid-template-columns: auto 1fr; gap: 8px 10px; align-items: start; }
.scan-item > input[type=checkbox] { width: 20px; height: 20px; margin-top: 12px; accent-color: var(--accent); }
.scan-fields { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; min-width: 0; }
.scan-fields .wide { grid-column: 1 / -1; }
.scan-fields input { min-height: 38px; padding: 6px 8px; }
.scan-fields label { font-size: .72rem; }
.scan-meta { grid-column: 2; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; font-size: .78rem; color: var(--muted); }
.conf { font-size: .7rem; font-weight: 600; padding: 2px 7px; border-radius: 999px; background: var(--line); }
.conf.low { color: var(--warn); } .conf.high { color: var(--accent); }
.scan-preview { display: block; max-height: 160px; max-width: 100%; border-radius: 12px; margin-top: 10px; }

/* quick add chips */
.chips.quick { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
.chips.quick::-webkit-scrollbar { display: none; }
.chip {
  flex: none; font: inherit; text-align: left; cursor: pointer; padding: 8px 12px; border-radius: 14px; max-width: 220px;
  border: 1px solid var(--line); background: var(--input); color: var(--fg); display: flex; flex-direction: column;
}
.chip b { font-weight: 500; font-size: .88rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chip span { font-size: .72rem; color: var(--muted); white-space: nowrap; }
.chip .tag { font-size: .62rem; text-transform: uppercase; letter-spacing: .06em; color: var(--orange); }

/* log */
.group + .group { margin-top: 12px; }
.group-head { display: flex; justify-content: space-between; font-size: .68rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin-bottom: 2px; font-weight: 600; }
.item { display: flex; align-items: center; gap: 8px; padding: 8px 0; border-top: 1px solid var(--line2); }
.item .dot { width: 8px; height: 8px; border-radius: 50%; flex: none; background: var(--green); }
.item .dot.drink { background: var(--orange); } .item .dot.water { background: var(--water); }
.item .what { flex: 1; min-width: 0; }
.item .what b { font-weight: 500; display: block; overflow-wrap: anywhere; }
.item .what span { font-size: .75rem; color: var(--muted); }
.item .amt { font-family: var(--num); font-weight: 600; font-size: 1rem; white-space: nowrap; }
.del, .edit-btn {
  width: 32px; height: 32px; border-radius: 10px; border: 1px solid var(--line); background: var(--input);
  color: var(--muted); cursor: pointer; font-size: 1rem; display: inline-flex; align-items: center; justify-content: center; flex: none;
}
button.what { font: inherit; color: inherit; background: none; border: 0; padding: 0; text-align: left; cursor: pointer; }
.list .item input[type="time"] { width: 116px; min-height: 36px; }
.src { font-size: .72rem; color: var(--muted); }

/* ---------- Trends ---------- */
#nutTrends .small-seg { align-self: flex-start; }
.legend { display: flex; align-items: center; gap: 6px; font-size: .75rem; color: var(--muted); flex-wrap: wrap; }
.key { display: inline-block; width: 12px; height: 3px; border-radius: 2px; margin-left: 4px; }
.key.kc { background: var(--green); height: 9px; width: 9px; border-radius: 3px; }
.key.tg { background: var(--fg); opacity: .6; }
.key.wt { background: var(--water); }
.key.ctl { background: var(--blue); } .key.atl { background: var(--orange); }
.protein-t { color: var(--protein); font-weight: 500; }
.chart-box { overflow: hidden; }
.chart-box svg { display: block; width: 100%; height: auto; }
.chart-box svg text { fill: var(--muted); font-size: 26px; font-family: var(--font); }
.chart-box .grid-line { stroke: var(--line2); }
.mt-legend { display: flex; flex-wrap: wrap; gap: 10px; font-size: .75rem; color: var(--muted); margin-top: 6px; }
.mt-key { display: inline-flex; align-items: center; gap: 5px; }
.mt-key .dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
#mtStrip svg text { font-size: 11px; }
.slot-bars { display: flex; flex-direction: column; gap: 9px; }
.slot-row { display: grid; grid-template-columns: 70px 1fr auto; gap: 10px; align-items: center; font-size: .85rem; }
.slot-bar { height: 10px; border-radius: 5px; background: var(--input); overflow: hidden; }
.slot-bar span { display: block; height: 100%; border-radius: 5px; }
.slot-val { color: var(--muted); font-size: .78rem; white-space: nowrap; }

/* weekly check-in */
.checkin { border-color: color-mix(in srgb, var(--accent) 35%, var(--line)); background: linear-gradient(160deg, color-mix(in srgb, var(--accent) 9%, var(--surface)), var(--surface2)); }
.checkin.ci-collapsed { background: var(--surface2); border-color: var(--line); }
.checkin.ci-collapsed .card-head { margin-bottom: 0; }
.checkin.ci-collapsed .card-head > span { margin-left: auto; }
.ci-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; margin-bottom: 10px; }
@media (min-width: 760px) { .ci-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.ci-tile { background: var(--input); border-radius: 12px; padding: 7px 10px; display: flex; flex-direction: column; min-width: 0; }
.ci-label { color: var(--muted); font-size: .7rem; }
.ci-val { font-family: var(--num); font-size: 1.2rem; font-weight: 600; }
.ci-val small { font-family: var(--font); font-size: .72rem; font-weight: 400; color: var(--muted); }
.ci-val.good { color: var(--accent); } .ci-val.warn { color: var(--warn); }
.ci-val small.good-t { color: var(--accent); font-weight: 600; } .ci-val small.warn-t { color: var(--warn); font-weight: 600; }
.ci-sub { color: var(--muted); font-size: .7rem; }
.ci-summary { margin: 0 0 10px; line-height: 1.5; color: #c9d2db; }
.ci-focus { border-left: 3px solid var(--accent); background: var(--input); padding: 8px 12px; margin-bottom: 10px; border-radius: 0 10px 10px 0; }
.ci-focus-label { color: var(--accent); font-size: .7rem; font-weight: 600; }
.ci-focus p { margin: 2px 0 0; line-height: 1.5; }
.ci-actions { display: flex; gap: 8px; }
.ci-actions .btn:first-child { flex: 1; border-color: color-mix(in srgb, var(--accent) 50%, var(--line)); color: var(--accent); background: transparent; }

/* ---------- Fitness: goals, readiness, sessions ---------- */
.goal-grid { display: grid; grid-template-columns: 1fr; gap: 0; }
@media (min-width: 760px) { .goal-grid { grid-template-columns: 1fr 1fr; gap: 18px; } }
.goal { display: flex; flex-direction: column; gap: 3px; min-width: 0; padding: 4px 0 12px; }
.goal + .goal { border-top: 1px solid var(--line2); padding-top: 12px; }
@media (min-width: 760px) { .goal + .goal { border-top: 0; padding-top: 4px; } }
.goal .label { font-size: .66rem; }
.goal-big { font-family: var(--num); font-size: 1.75rem; font-weight: 600; line-height: 1.1; }
.goal-line { font-weight: 600; font-size: .85rem; }
.goal-line.good { color: var(--accent); } .goal-line.warn { color: var(--warn); }
.goal-bar { height: 8px; border-radius: 4px; background: var(--input); overflow: hidden; margin: 5px 0 3px; }
.goal-bar span { display: block; height: 100%; border-radius: 4px; background: var(--accent); }
.goal-bar.race span { background: linear-gradient(90deg, var(--green), var(--orange)); }
.goal-sub { font-size: .75rem; color: var(--muted); }
.race-form { margin-top: 10px; padding-top: 12px; border-top: 1px solid var(--line2); }

.rd-row { display: flex; align-items: center; gap: 16px; }
.rd-ring { flex: none; width: 96px; height: 96px; }
.rd-ring svg { width: 100%; height: 100%; display: block; }
.rd-side { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.rd-label { font-size: .95rem; }
.rd-label.good { color: var(--accent); } .rd-label.warn { color: var(--warn); }
.rd-factors { display: flex; flex-direction: column; gap: 6px; }
.factor { display: grid; grid-template-columns: 1fr auto; gap: 2px 8px; font-size: .78rem; }
.factor .fl { color: var(--muted); }
.factor b { font-family: var(--num); font-weight: 600; font-size: .9rem; }
.factor b small { font-family: var(--font); font-weight: 400; color: var(--muted); font-size: .72rem; }
.factor .bar { grid-column: 1 / -1; height: 5px; border-radius: 3px; background: var(--input); overflow: hidden; }
.factor .bar span { display: block; height: 100%; border-radius: 3px; background: var(--yellow); }
.factor .bar.ok span { background: var(--accent); }
.rd-note { margin: 10px 0 0; }

.sess-list { display: flex; flex-direction: column; }
.sess { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-top: 1px solid var(--line2); width: 100%; font: inherit; color: inherit; background: none; border-left: 0; border-right: 0; border-bottom: 0; text-align: left; cursor: pointer; }
.sess:first-child { border-top: 0; }
.sess-ic { width: 34px; height: 34px; border-radius: 11px; display: grid; place-items: center; flex: none; }
.sess-ic svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.sess .w { flex: 1; min-width: 0; }
.sess .w b { display: block; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sess .w span { display: block; font-size: .74rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sess .r { text-align: right; flex: none; }
.sess .r b { font-family: var(--num); font-weight: 600; font-size: 1rem; display: block; }
.sess .r span { font-size: .68rem; color: var(--muted); }
.ic-run { background: color-mix(in srgb, var(--run) 14%, var(--input)); color: var(--run); }
.ic-swim { background: color-mix(in srgb, var(--swim) 14%, var(--input)); color: var(--swim); }
.ic-ride { background: color-mix(in srgb, var(--ride) 14%, var(--input)); color: var(--ride); }
.ic-gym { background: color-mix(in srgb, var(--gym) 16%, var(--input)); color: var(--gym); }
.ic-other { background: var(--raised); color: var(--muted); }

.mini-row .card { padding: 11px 12px; }
.mini { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.mini .label { font-size: .62rem; }
.mid { font-family: var(--num); font-size: 1.45rem; font-weight: 600; }
.mid.bb { color: var(--accent); }
.mid small { font-family: var(--font); font-size: .72rem; font-weight: 400; color: var(--muted); }
.spark { width: 100%; height: 40px; display: block; }
.kv { display: flex; flex-direction: column; gap: 6px; font-size: .85rem; }
.kv div { display: flex; justify-content: space-between; gap: 8px; }
.kv span { color: var(--muted); }
.kv b { font-family: var(--num); font-weight: 600; }
.zone-bar { display: flex; height: 12px; border-radius: 6px; overflow: hidden; background: var(--input); }
.zone-bar span { display: block; height: 100%; }
.zone-bar .easy { background: var(--green); } .zone-bar .mod { background: var(--blue); } .zone-bar .hard { background: var(--orange); }

/* Training */
.sport-chips { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; }
.sport-chips::-webkit-scrollbar { display: none; }
.sport-chips .chip-btn { flex: none; }
.wk-legend { margin-top: 6px; }
.wk-legend i, .heat-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; }
.heat-wrap { display: grid; gap: 3px; width: 100%; }
.heat-col { display: grid; grid-template-rows: repeat(7, auto); gap: 3px; min-width: 0; }
.heat-col span { width: 100%; aspect-ratio: 1; border-radius: 3px; background: var(--input); }
.heat-col span.l1, .heat-legend .h1 { background: #1f5a33; }
.heat-col span.l2, .heat-legend .h2 { background: #37a556; }
.heat-col span.l3, .heat-legend .h3 { background: var(--green); }
.heat-legend .h0 { background: var(--input); }
.heat-col span.future { background: transparent; }
.heat-legend { margin-top: 8px; gap: 5px; }
#heatNote { margin: 6px 0 0; }

/* session details sheet */
.sess-head { display: flex; align-items: center; gap: 10px; min-width: 0; }
.sess-head h2 { margin: 0; }
.sd-zones { display: flex; height: 12px; border-radius: 6px; overflow: hidden; background: var(--input); margin: 6px 0 4px; }
.sd-zones span { display: block; height: 100%; }
.sd-list { display: flex; flex-direction: column; margin-top: 10px; }
.sd-ex { padding: 8px 0; border-top: 1px solid var(--line2); }
.sd-ex b { display: block; font-weight: 500; }
.sd-ex span { font-family: var(--num); font-size: .95rem; color: #c9d2db; }
.sd-sec { margin: 14px 0 6px; font-size: .68rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 600; }

/* ---------- Coach ---------- */
#fitCoach { --sc: var(--run); }
#fitCoach[data-sport="Swim"] { --sc: var(--swim); }
#fitCoach[data-sport="Ride"] { --sc: var(--ride); }
#fitCoach[data-sport="Gym"] { --sc: var(--gym); }
.coach-nav { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.sport-btn { font: inherit; font-size: .74rem; font-weight: 600; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 8px 0 7px;
  border-radius: 14px; border: 1px solid var(--line); background: var(--surface); cursor: pointer; }
.sport-btn svg { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.sport-btn[data-cs="Run"] { color: var(--run); } .sport-btn[data-cs="Swim"] { color: var(--swim); }
.sport-btn[data-cs="Ride"] { color: var(--ride); } .sport-btn[data-cs="Gym"] { color: var(--gym); }
.sport-btn[aria-pressed="true"] { color: var(--bg); }
.sport-btn[aria-pressed="true"][data-cs="Run"] { background: var(--run); border-color: var(--run); }
.sport-btn[aria-pressed="true"][data-cs="Swim"] { background: var(--swim); border-color: var(--swim); }
.sport-btn[aria-pressed="true"][data-cs="Ride"] { background: var(--ride); border-color: var(--ride); }
.sport-btn[aria-pressed="true"][data-cs="Gym"] { background: var(--gym); border-color: var(--gym); }
.coach-hero { display: flex; justify-content: space-between; align-items: flex-end; gap: 10px; padding: 14px; border-radius: 18px;
  background: linear-gradient(135deg, color-mix(in srgb, var(--sc) 24%, var(--surface)), var(--surface)); border: 1px solid color-mix(in srgb, var(--sc) 35%, var(--line)); }
.coach-hero > div { display: flex; flex-direction: column; min-width: 0; }
.coach-hero .label { color: var(--sc); }
.level { font-family: var(--num); font-size: 2rem; font-weight: 600; line-height: 1.05; }
.hero-sub { font-size: .75rem; color: var(--muted); margin-top: 2px; }
.coach-hero .pill { background: color-mix(in srgb, var(--sc) 18%, transparent); color: var(--sc); }
.coach-hero .pill.warn { background: color-mix(in srgb, var(--warn) 16%, transparent); color: var(--warn); }
.coach-chart svg text { font-size: 22px; }
.pb-list { font-size: .9rem; }
.pb-list div { padding: 6px 0; border-top: 1px solid var(--line2); align-items: baseline; }
.pb-list div:first-child { border-top: 0; }
.pb-list span { color: var(--fg); }
.pb-list b { font-size: 1.02rem; text-align: right; }
.pb-list b small { font-family: var(--font); color: var(--muted); font-weight: 400; font-size: .7rem; margin-left: 4px; }
.insights-card h2 { margin-bottom: 6px; }
.insights-card .watch-h { margin-top: 12px; }
.good-h { color: var(--accent); } .watch-h { color: var(--warn); }
.insights { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 6px; font-size: .88rem; line-height: 1.45; }
.grid.three-col { grid-template-columns: repeat(3, minmax(0, 1fr)); margin-top: 10px; }
@media (max-width: 560px) { .grid.three-col { grid-template-columns: 1fr 1fr; } .grid.three-col .fld:first-child { grid-column: 1 / -1; } }
.plan-card .chips { margin-bottom: 4px; }
.plan-btn { margin-top: 12px; background: var(--run); border-color: var(--run); color: var(--accent-fg); }
#planHint { margin: 8px 0 0; }

/* ---------- Gym ---------- */
body.no-scroll { overflow: hidden; }
#gymCoach .coach-hero { --sc: var(--gym); }
.gy-routines { display: flex; flex-direction: column; gap: 8px; margin-bottom: 10px; }
.gy-routine { font: inherit; text-align: left; cursor: pointer; padding: 11px 13px; border-radius: 14px; border: 1px solid color-mix(in srgb, var(--gym) 45%, var(--line));
  background: linear-gradient(160deg, color-mix(in srgb, var(--gym) 18%, var(--surface)), var(--surface)); color: var(--fg); display: flex; flex-direction: column; gap: 2px; }
.gy-routine b { font-size: 1rem; }
.gy-routine span { font-size: .75rem; color: #b7b0d6; }
.gy-alt .btn { flex: 1; font-size: .85rem; min-height: 40px; }
.gy-muscles { display: flex; flex-direction: column; gap: 6px; margin-bottom: 8px; }
.gy-mrow { display: grid; grid-template-columns: 84px minmax(0, 1fr) 24px; gap: 8px; align-items: center; font-size: .82rem; }
.gy-mrow b { text-align: right; font-family: var(--num); font-weight: 600; }
.gy-track { position: relative; height: 10px; border-radius: 5px; background: var(--input); overflow: hidden; }
.gy-track .band { position: absolute; top: 0; bottom: 0; left: 40%; width: 40%; background: color-mix(in srgb, var(--gym) 22%, transparent); }
.gy-track .fillb { position: absolute; top: 2px; bottom: 2px; left: 0; border-radius: 4px; background: var(--gym); }
.gy-track .fillb.low { background: var(--orange); }
.lift-chips { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px; margin-bottom: 6px; scrollbar-width: none; }
.lift-chips::-webkit-scrollbar { display: none; }
.lift-chips .chip-btn { flex: none; }
.lift-chips .chip-btn[aria-pressed="true"] { background: var(--gym); border-color: var(--gym); color: #150f2a; }
.gy-hist { border-top: 1px solid var(--line2); padding: 8px 0; }
.gy-hist:first-child { border-top: 0; }
.gy-hist summary { cursor: pointer; list-style: none; display: flex; align-items: center; gap: 10px; }
.gy-hist summary::-webkit-details-marker { display: none; }
.gy-hist .what { flex: 1; min-width: 0; }
.gy-hist .what b { display: block; font-weight: 500; }
.gy-hist .what span { font-size: .74rem; color: var(--muted); }
.gy-hist .vol { font-family: var(--num); font-weight: 600; }
.gy-hist-ex { display: flex; justify-content: space-between; gap: 10px; font-size: .82rem; padding: 4px 0 4px 44px; }
.gy-hist-ex .muted { text-align: right; }
.gy-hist .btn { margin: 6px 0 0 44px; }
.gw-sync, .gy-sync { color: var(--warn); }
.gym-btn { background: var(--gym); border-color: var(--gym); color: #150f2a; }
.gym-ghost { background: transparent; border-color: color-mix(in srgb, var(--gym) 45%, var(--line)); color: var(--gym); }

/* full-screen logger and exercise picker */
.gym-sheet { position: fixed; inset: 0; z-index: 30; background: var(--bg); display: flex; flex-direction: column;
  padding-top: env(safe-area-inset-top, 0px); padding-bottom: env(safe-area-inset-bottom, 0px); }
.gx-sheet { z-index: 31; }
.gw-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 16px;
  background: linear-gradient(135deg, color-mix(in srgb, var(--gym) 24%, var(--surface)), var(--surface)); border-bottom: 1px solid color-mix(in srgb, var(--gym) 30%, var(--line)); }
.gx-sheet .gw-head { background: var(--surface); border-bottom-color: var(--line); }
.gw-head h2 { margin: 0; }
.gw-title { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.gw-title input { font-weight: 700; font-size: 1.2rem; border: 0; background: transparent; padding: 2px 0; min-height: 0; font-family: var(--font); }
.gw-meta { color: #b7b0d6; }
.gw-body { flex: 1; overflow-y: auto; padding: 12px 14px 130px; display: flex; flex-direction: column; gap: 12px; -webkit-overflow-scrolling: touch; }
.gw-foot { display: flex; justify-content: space-between; gap: 8px; padding: 10px 14px; border-top: 1px solid var(--line); background: #0e1217; }
.gw-add { flex: 1; background: color-mix(in srgb, var(--gym) 16%, var(--surface)); border-color: color-mix(in srgb, var(--gym) 40%, var(--line)); color: var(--gym); }
.gw-empty { text-align: center; margin-top: 30px; }
.gw-ex { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 10px 10px 8px; }
.gw-exh { display: flex; align-items: center; gap: 8px; }
.gw-exh .gw-ic { width: 30px; height: 30px; border-radius: 10px; display: grid; place-items: center; background: color-mix(in srgb, var(--gym) 18%, var(--input)); color: var(--gym); flex: none; }
.gw-exh .gw-ic svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.gw-exh b { flex: 1; font-size: 1rem; min-width: 0; }
.gw-rm { width: auto; min-width: 32px; height: 32px; padding: 0 8px; font-size: 1rem; }
.gw-rm.armed { font-size: .78rem; color: var(--warn); }
.gw-tip { margin: 8px 0 4px; font-size: .75rem; color: var(--gym); background: color-mix(in srgb, var(--gym) 10%, var(--input)); border-radius: 9px; padding: 6px 9px; }
.gw-row { display: grid; grid-template-columns: 32px minmax(0, 1fr) 66px 52px 44px; gap: 6px; align-items: center; padding: 4px; border-radius: 11px; position: relative; }
.gw-hd { font-size: .64rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding-bottom: 0; }
.gw-row input { min-height: 40px; padding: 5px 4px; text-align: center; font-size: 1.1rem; }
.gw-row input::placeholder { color: color-mix(in srgb, var(--muted) 70%, transparent); }
.gw-prev { color: var(--muted); font-size: .8rem; font-family: var(--num); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gw-kind { font: inherit; font-weight: 700; height: 34px; border-radius: 9px; border: 0; background: var(--input); color: var(--fg); cursor: pointer; }
.gw-kind.warmup { color: var(--orange); } .gw-kind.drop { color: var(--blue); } .gw-kind.failure { color: var(--red); }
.gw-ck { height: 40px; border-radius: 11px; border: 1px solid var(--line); background: var(--input); color: #6c7682; font-size: 1.05rem; cursor: pointer; }
.gw-row.done { background: color-mix(in srgb, var(--gym) 14%, transparent); }
.gw-row.done input { border-color: color-mix(in srgb, var(--gym) 35%, var(--line)); }
.gw-row.done .gw-ck { background: var(--gym); border-color: var(--gym); color: #150f2a; }
.gw-pr { position: absolute; right: 48px; top: -5px; font-size: .6rem; font-weight: 700; background: #3a3216; color: var(--yellow); border-radius: 5px; padding: 1px 5px; }
.gw-exf { margin-top: 4px; }
.gw-exf .btn { flex: 1; font-size: .8rem; min-height: 32px; }
.gw-rest { position: absolute; left: 12px; right: 12px; bottom: calc(68px + env(safe-area-inset-bottom, 0px)); display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; border-radius: 16px; background: linear-gradient(135deg, #2c2257, #1a1530); border: 1px solid var(--gym); box-shadow: 0 10px 28px rgba(0,0,0,.55); }
.gw-ring { width: 42px; height: 42px; flex: none; }
.gw-ring circle { fill: none; stroke-width: 4; stroke-linecap: round; }
.gw-ring .bg { stroke: color-mix(in srgb, var(--gym) 25%, transparent); } .gw-ring .fg { stroke: var(--gym); transition: stroke-dashoffset 1s linear; }
.gw-rest-t { flex: 1; display: flex; flex-direction: column; line-height: 1.1; }
.gw-rest-t .small { color: #b7b0d6; text-transform: uppercase; letter-spacing: .08em; font-size: .62rem; }
.gw-rest-t b { font-size: 1.7rem; }
.gw-rest .btn { background: transparent; border-color: #4b3b85; padding: 4px 9px; }
.gw-rest.ready { background: var(--green); border-color: var(--green); color: var(--accent-fg); }
.gw-rest.ready .gw-rest-t .small, .gw-rest.ready .btn { color: var(--accent-fg); border-color: color-mix(in srgb, var(--accent-fg) 30%, transparent); }
.gw-rest.ready .gw-ring { display: none; }
.gx-muscles { margin: 10px 0 4px; }
.gx-muscles .chip-btn[aria-pressed="true"] { background: var(--gym); border-color: var(--gym); color: #150f2a; }
.gx-list { display: flex; flex-direction: column; }
.gx-item { font: inherit; text-align: left; cursor: pointer; background: none; border: 0; border-top: 1px solid var(--line2); color: var(--fg); padding: 10px 2px; display: flex; flex-direction: column; }
.gx-item span { font-size: .75rem; color: var(--muted); }
.gx-create { border-top: 1px solid var(--line); padding-top: 10px; }
.gx-create input { flex: 1 1 180px; }
.gx-create select { flex: 0 1 140px; width: auto; }
.gym-resume { position: fixed; z-index: 21; left: 50%; transform: translateX(-50%); bottom: calc(var(--tabbar) + 22px + env(safe-area-inset-bottom, 0px));
  font: inherit; font-weight: 700; padding: 11px 18px; border-radius: 999px; border: 1px solid var(--gym); background: #1a1530; color: var(--gym); cursor: pointer; box-shadow: 0 8px 22px rgba(0,0,0,.5); white-space: nowrap; }

/* workout summary */
.gs-top { text-align: center; margin-bottom: 12px; display: flex; flex-direction: column; }
.gs-kicker { color: var(--gym); font-size: .7rem; letter-spacing: .1em; text-transform: uppercase; font-weight: 600; }
.gs-top h2 { margin: 2px 0; font-family: var(--num); font-size: 1.8rem; }
.gs-prs { margin-top: 10px; background: #211d10; border: 1px solid #5a4b1a; border-radius: 14px; padding: 10px 12px; }
.gs-prs b { color: var(--yellow); }
.gs-prs ul { margin: 4px 0 0; padding-left: 18px; font-size: .85rem; }
.gs-list { margin-top: 10px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 4px 12px; }
.gs-list div { display: flex; justify-content: space-between; gap: 10px; padding: 7px 0; border-top: 1px solid var(--line2); font-size: .85rem; }
.gs-list div:first-child { border-top: 0; }
.gs-actions { margin-top: 14px; } .gs-actions .btn { flex: 1; }

/* ---------- sheets (edit, session details, workout summary) ---------- */
.sheet-back { position: fixed; inset: 0; z-index: 24; background: rgba(0,0,0,.6); }
.sheet { position: fixed; z-index: 25; left: 0; right: 0; bottom: 0; max-height: 90vh; display: flex; flex-direction: column; background: var(--surface);
  border: 1px solid var(--line); border-radius: 22px 22px 0 0; box-shadow: 0 -10px 40px rgba(0,0,0,.6); padding-bottom: env(safe-area-inset-bottom, 0px); }
@media (min-width: 760px) { .sheet { left: 50%; right: auto; width: 520px; transform: translateX(-50%); } }
.sheet-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.sheet-head h2 { margin: 0; }
.sheet-head .icon { width: 36px; height: 36px; font-size: 1.2rem; }
.sheet-body { overflow-y: auto; padding: 14px 16px 22px; }
.left-box h3 { margin: 0 0 4px; }
.left-list { display: flex; flex-direction: column; margin-top: 8px; }
.left-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 10px; align-items: center; padding: 8px 0; border-top: 1px solid var(--line2); }
.left-name { grid-column: 1 / -1; overflow-wrap: anywhere; }
.left-pct { display: flex; align-items: center; gap: 6px; color: var(--fg); font-size: .92rem; }
.left-pct input { width: 76px; min-height: 38px; padding: 6px 8px; }
.left-kcal { color: var(--muted); font-family: var(--num); font-size: .95rem; white-space: nowrap; }
.left-total { font-weight: 600; margin: 8px 0 12px; }
.edit-h { margin: 18px 0 8px; padding-top: 14px; border-top: 1px solid var(--line); }

/* ---------- Body ---------- */
.body-hero { display: flex; align-items: center; gap: 16px; border-color: color-mix(in srgb, var(--water) 30%, var(--line));
  background: linear-gradient(150deg, color-mix(in srgb, var(--water) 14%, var(--surface)), var(--surface2)); }
.body-hero svg { width: 112px; height: 112px; flex: none; }
.bh-txt { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.bh-txt .goal-big { font-size: 1.7rem; }
#bodyTiles { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.key.avg { background: var(--fg); } .key.plan { background: var(--green); }
.dot-key { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--water); margin-left: 4px; }
#weightChart svg text { font-size: 19px; }
.weigh-form { display: grid; grid-template-columns: 1fr 1fr auto; gap: 8px; align-items: end; }
.body-btn { background: var(--water); border-color: var(--water); color: #04182c; }
.body-btn.ghost { background: transparent; color: var(--water); border-color: color-mix(in srgb, var(--water) 45%, var(--line)); }
.wi-kg { font-family: var(--num); font-weight: 600; font-size: 1.1rem; width: 54px; flex: none; }
.wi-chg { font-family: var(--num); font-size: .9rem; width: 40px; text-align: right; flex: none; }
.wi-chg.good { color: var(--accent); } .wi-chg.warn { color: var(--warn); }

/* ---------- Ask Claude (its own tab) ---------- */
.ask-view { position: fixed; z-index: 15; left: 0; right: 0; margin: 0 auto; max-width: 760px;
  top: calc(env(safe-area-inset-top, 0px) + 58px); bottom: calc(var(--tabbar) + 14px + env(safe-area-inset-bottom, 0px));
  display: flex; flex-direction: column; gap: 0; padding: 0 max(14px, env(safe-area-inset-left, 0px)); }
.ask-log { flex: 1; overflow-y: auto; padding: 8px 2px 12px; display: flex; flex-direction: column; gap: 12px; -webkit-overflow-scrolling: touch; }
.ask-intro { text-align: center; padding: 12px 8px 2px; display: flex; flex-direction: column; align-items: center; gap: 2px; }
.ask-intro b { font-size: 1.1rem; }
.ask-intro p { margin: 4px 0 0; }
.ask-spark { width: 50px; height: 50px; border-radius: 16px; display: grid; place-items: center; margin-bottom: 8px;
  background: linear-gradient(135deg, #1c2a3a, var(--surface)); border: 1px solid #2b3a4a; }
.ask-spark svg { width: 24px; height: 24px; fill: none; stroke: var(--green); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.ask-suggest { display: flex; flex-direction: column; gap: 7px; }
.ask-suggest .grp { font-size: .66rem; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); margin-top: 6px; font-weight: 600; }
.sg-btn { font: inherit; font-size: .9rem; text-align: left; display: flex; align-items: center; gap: 10px; padding: 11px 12px; border-radius: 14px;
  background: var(--surface); border: 1px solid var(--line); color: var(--fg); cursor: pointer; }
.sg-btn::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--green); flex: none; }
.sg-btn::after { content: "›"; margin-left: auto; color: #6c7682; }
.sg-btn[data-c="w"]::before { background: var(--water); } .sg-btn[data-c="r"]::before { background: var(--orange); } .sg-btn[data-c="g"]::before { background: var(--gym); }
.msg-user { align-self: flex-end; max-width: 84%; background: #1d2a38; border: 1px solid #2b3a4a; padding: 9px 12px; border-radius: 16px 16px 4px 16px; white-space: pre-wrap; overflow-wrap: anywhere; }
.msg-bot { align-self: stretch; display: flex; gap: 9px; line-height: 1.5; overflow-wrap: anywhere; }
.msg-bot .av { width: 26px; height: 26px; border-radius: 8px; flex: none; }
.msg-bot .ans { flex: 1; min-width: 0; }
.msg-bot p { margin: 0 0 8px; }
.msg-bot ul { margin: 0 0 8px; padding-left: 18px; }
.msg-bot li { margin-bottom: 3px; }
.msg-bot .tbl { overflow-x: auto; margin: 0 0 8px; }
.msg-bot table { border-collapse: collapse; font-size: .82rem; overflow-wrap: normal; word-break: normal; }
.msg-bot th, .msg-bot td { border-bottom: 1px solid var(--line); padding: 5px 7px; text-align: left; vertical-align: top; }
.msg-bot th { color: var(--muted); font-weight: 500; white-space: nowrap; }
.msg-bot td { min-width: 3.5em; }
.msg-bot h3 { font-size: .98rem; margin: 10px 0 6px; }
.msg-err .ans { color: var(--warn); }
.thinking .ans { color: var(--muted); font-style: italic; }
.followups { display: flex; gap: 6px; flex-wrap: wrap; padding-left: 35px; }
.followups .chip-btn { font-size: .8rem; padding: 5px 11px; }
.ask-form { display: flex; gap: 8px; align-items: flex-end; padding: 8px 0 0; border-top: 1px solid var(--line2); }
.ask-form textarea { flex: 1; min-width: 0; resize: none; min-height: 44px; max-height: 140px; padding: 11px 13px; border-radius: 16px; background: var(--surface); }
.send-btn { width: 44px; height: 44px; border-radius: 14px; border: 0; background: var(--green); display: grid; place-items: center; cursor: pointer; flex: none; }
.send-btn svg { width: 20px; height: 20px; fill: none; stroke: var(--accent-fg); stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.send-btn:disabled { opacity: .5; }

@media (prefers-reduced-motion: reduce) { .ring, .gw-ring .fg { transition: none; } }
.tile .val.c-blue { color: var(--blue); } .tile .val.c-orange { color: var(--orange); } .tile .val.c-yellow { color: var(--yellow); } .tile .val.c-green { color: var(--green); } .tile .val.c-purple { color: var(--purple); }
@media (max-width: 560px) { .tiles.four { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.inner-tiles .tile .val { font-size: 1.25rem; }
.scan-more > summary { list-style: none; } .scan-more > summary::-webkit-details-marker { display: none; }
.scan-more > summary::before { content: "+ "; } .scan-more[open] > summary::before { content: "− "; }
.pb-list div { gap: 12px; }
.pb-list b { white-space: nowrap; flex: none; }
.pb-list b small { display: block; margin: 0; }
.gy-alt { flex-wrap: wrap; }
.gy-alt .btn { flex: 1 1 140px; white-space: normal; line-height: 1.25; }
.weigh-form { grid-template-columns: minmax(0, .9fr) minmax(0, 1.5fr) auto; }
.weigh-form input[type=date] { font-size: .9rem; padding-inline: 8px; }

/* ---------- Goals (Overview) and plan cards (Coach) ---------- */
.goal-list { display: flex; flex-direction: column; }
.goal-row { display: flex; gap: 11px; align-items: flex-start; width: 100%; padding: 11px 0; border: 0; border-top: 1px solid var(--line2); background: none; color: inherit; font: inherit; text-align: left; cursor: pointer; }
.goal-row:first-child { border-top: 0; padding-top: 2px; }
.goal-row .sess-ic { margin-top: 2px; }
.gr-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.gr-top { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.gr-top b { font-weight: 600; font-size: .92rem; }
.gr-top span { font-family: var(--num); font-weight: 600; font-size: .92rem; color: #c9d2db; white-space: nowrap; }
.goal-row .goal-bar { margin: 4px 0 3px; }
.gr-line { font-size: .8rem; font-weight: 500; color: #c9d2db; }
.gr-line.good { color: var(--accent); } .gr-line.warn { color: var(--warn); }
.gr-sub { font-size: .72rem; color: var(--muted); }
.gr-empty { margin: 8px 0 0; }
.ic-body { background: color-mix(in srgb, var(--blue) 14%, var(--input)); color: var(--blue); }
.plan-card .goal-kinds { margin-bottom: 10px; }
.plan-card .goal-kinds .chip-btn[aria-pressed="true"] { background: var(--sc); border-color: var(--sc); color: var(--bg); font-weight: 600; }
.plan-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.plan-now { margin: 10px 0 0; padding: 8px 10px; border-radius: 10px; background: var(--input); font-size: .82rem; color: #c9d2db; }
.plan-acts { margin-top: 10px; }
.plan-acts .btn { flex: 1; white-space: normal; line-height: 1.2; }
.sc-btn { background: var(--sc); border-color: var(--sc); color: var(--bg); }
.sc-ghost { background: transparent; border-color: color-mix(in srgb, var(--sc) 50%, var(--line)); color: var(--sc); }
.plan-card .link-btn { margin-top: 8px; }
.plan-grid input:not([type=date]) { font-family: var(--num); font-weight: 600; font-size: 1.05rem; }

/* Body: weight goal card and flagged weigh-ins */
#goalForm { display: flex; flex-direction: column; gap: 10px; }
.pace-seg { width: 100%; }
.pace-seg .seg-btn { display: flex; flex-direction: column; align-items: center; gap: 1px; min-height: 48px; line-height: 1.15; }
.pace-seg .seg-btn small { font-family: var(--num); font-weight: 500; font-size: .74rem; color: var(--muted); }
.pace-seg .seg-btn[aria-pressed="true"] { background: color-mix(in srgb, var(--water) 22%, var(--raised)); color: var(--fg); }
.pace-seg .seg-btn[aria-pressed="true"] small { color: var(--water); }
.goal-explain { margin: 0; padding: 10px 12px; border-radius: 12px; background: color-mix(in srgb, var(--water) 9%, var(--input)); border: 1px solid color-mix(in srgb, var(--water) 25%, var(--line)); line-height: 1.5; font-size: .9rem; }
.goal-start { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }
.goal-adv > summary { cursor: pointer; font-size: .82rem; color: var(--muted); }
.goal-adv[open] > summary { margin-bottom: 8px; }
.item.unusual .what span { color: var(--warn); }
.item.ignored { opacity: .55; }
.item.ignored .wi-kg { text-decoration: line-through; }
.item .btn.small-btn { min-height: 30px; padding: 2px 10px; font-size: .78rem; }

/* Why these targets? */
.why-btn { display: block; margin: 10px auto 0; }
.why-box { margin-top: 10px; padding: 10px 12px; border-radius: 12px; background: var(--input); border: 1px solid var(--line2); }
.why-line { display: flex; justify-content: space-between; gap: 10px; padding: 3px 0; font-size: .88rem; }
.why-line b { font-family: var(--num); font-weight: 600; font-size: .98rem; white-space: nowrap; }
.why-line.total { border-top: 1px solid var(--line); margin-top: 4px; padding-top: 6px; }
.why-line.total b { color: var(--green); }
.why-note { margin: 0 0 4px; font-size: .74rem; color: var(--muted); line-height: 1.4; }
.why-note.warn { color: var(--warn); }
input.locked { opacity: .65; }

/* Pace slider (Body -> Your weight goal) */
.pace-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.pace-head b { color: var(--water); font-size: 1rem; }
#gRateRange { --fill: 50%; -webkit-appearance: none; appearance: none; width: 100%; min-height: 0; height: 8px; padding: 0; border: 0; border-radius: 4px; margin: 14px 0 6px;
  background: linear-gradient(90deg, var(--water) var(--fill), var(--raised) var(--fill)); }
#gRateRange::-webkit-slider-thumb { -webkit-appearance: none; width: 26px; height: 26px; border-radius: 50%; background: var(--fg); border: 3px solid var(--water); box-shadow: 0 2px 8px rgba(0,0,0,.5); cursor: pointer; }
#gRateRange::-moz-range-thumb { width: 22px; height: 22px; border-radius: 50%; background: var(--fg); border: 3px solid var(--water); cursor: pointer; }
.range-ends { display: flex; justify-content: space-between; font-size: .72rem; color: var(--muted); }
.warn-t { color: var(--warn); margin: 0; }

/* ---------- Settings (Body tab button, or tap the Jolt logo) ---------- */
.brand-btn { background: none; border: 0; padding: 0; margin: 0; color: inherit; font: inherit; cursor: pointer; border-radius: 10px; }
.brand-btn:active { opacity: .7; }
.set-open { display: inline-flex; align-items: center; gap: 6px; }
.set-open svg { width: 16px; height: 16px; fill: none; stroke: var(--green); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.set-h { margin: 2px 2px 0; }
.set-form { display: flex; flex-direction: column; gap: 12px; }
.set-card h2 { margin-bottom: 12px; }
.set-save { width: 100%; }
.danger-text { color: var(--red); margin-top: 10px; }
.data-rows { display: flex; flex-direction: column; }
.data-row { display: flex; justify-content: space-between; gap: 12px; padding: 9px 0; border-top: 1px solid var(--line2); font-size: .92rem; }
.data-row:first-child { border-top: 0; padding-top: 0; }
.data-row b { font-weight: 600; text-align: right; }
.data-row b.ok { color: var(--green); } .data-row b.warn { color: var(--orange); }
.set-sub { font-size: .8rem; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin: 0 0 8px; font-weight: 600; }
.set-list { display: flex; flex-direction: column; }
.set-row { display: flex; align-items: center; gap: 8px; padding: 8px 0; border-top: 1px solid var(--line2); }
.set-row:first-child { border-top: 0; }
.set-row input[type=text] { flex: 1; min-width: 0; }
.set-row select { width: 118px; flex: none; }
.set-row .n { font-size: .8rem; color: var(--muted); flex: none; text-align: right; white-space: nowrap; }
.ex-row { flex-wrap: wrap; }
.ex-row input[type=text] { flex: 1 1 100%; }
.ex-row select { flex: 1; width: auto; }
.set-row .del { flex: none; }
.set-more { margin-top: 12px; border-top: 1px solid var(--line2); padding-top: 10px; }
.set-more summary { cursor: pointer; font-weight: 600; padding: 4px 0; }
.hr-zones { margin-top: 10px; display: flex; flex-direction: column; gap: 4px; font-size: .88rem; }
.hr-zones .z { display: flex; align-items: center; gap: 8px; }
.hr-zones .z i { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.hr-zones .z b { margin-left: auto; font-family: var(--num); }
#setSync { margin-top: 10px; }
.gdel.sure { color: var(--red); border-color: var(--red); }

/* ---------- Jolt logo menu ---------- */
.brand-wrap { position: relative; }
.bm-caret { width: 14px; height: 14px; fill: none; stroke: var(--muted); stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; transition: transform .15s; margin-left: -3px; }
.brand-btn[aria-expanded="true"] .bm-caret { transform: rotate(180deg); }
.brand-menu { position: absolute; top: calc(100% + 8px); left: 0; z-index: 30; width: min(280px, calc(100vw - 28px)); padding: 6px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 16px; box-shadow: 0 16px 40px rgba(0,0,0,.55);
  display: flex; flex-direction: column; transform-origin: top left; animation: bm-in .14s ease-out; }
@keyframes bm-in { from { opacity: 0; transform: scale(.96) translateY(-4px); } to { opacity: 1; transform: none; } }
.bm-item { display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px; border: 0; border-radius: 11px; background: none; color: var(--fg); font: inherit; text-align: left; cursor: pointer; }
.bm-item:hover, .bm-item:focus-visible { background: var(--line); outline: none; }
.bm-item svg { width: 20px; height: 20px; flex: none; fill: none; stroke: var(--green); stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.bm-item span { display: flex; flex-direction: column; min-width: 0; }
.bm-item b { font-weight: 600; font-size: .95rem; }
.bm-item small { color: var(--muted); font-size: .78rem; }
.bm-sep { height: 1px; background: var(--line2); margin: 4px 8px; }
.flash { animation: flash 1.4s ease-out; }
@keyframes flash { 0%, 30% { box-shadow: 0 0 0 2px var(--green); } 100% { box-shadow: 0 0 0 2px transparent; } }

/* ---------- Sleep card ---------- */
.sl-stages { display: flex; height: 10px; border-radius: 6px; overflow: hidden; margin-top: 12px; background: var(--line2); }
.sl-stages span { display: block; height: 100%; }
.sl-stages .deep, .sl-legend .deep { background: #5b6cff; }
.sl-stages .light, .sl-legend .light { background: #3aa0ff; }
.sl-stages .rem, .sl-legend .rem { background: #a98bff; }
.sl-stages .awake, .sl-legend .awake { background: #ff8fb1; }
.sl-legend { display: flex; flex-wrap: wrap; gap: 4px 12px; margin-top: 6px; font-size: .75rem; color: var(--muted); }
.sl-legend i { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 5px; }
.sl-chart { margin: 18px 0 6px; padding-bottom: 16px; }
.sl-area { position: relative; display: flex; align-items: flex-end; gap: 4px; height: 80px; }
.sl-col { flex: 1; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; position: relative; }
.sl-col i { display: block; width: 100%; max-width: 18px; border-radius: 4px 4px 2px 2px; min-height: 2px; }
.sl-col i.ok { background: var(--green); } .sl-col i.short { background: var(--orange); } .sl-col i.none { background: var(--line2); }
.sl-col span { position: absolute; bottom: -16px; font-size: .68rem; color: var(--muted); }
.sl-need { position: absolute; left: 0; right: 0; border-top: 1px dashed #4a5563; z-index: 1; pointer-events: none; }
.sl-need span { position: absolute; right: 0; top: -15px; font-size: .68rem; color: var(--muted); }

/* ---------- Reminders ---------- */
.rem-btns { flex-wrap: wrap; gap: 8px; margin: 8px 0 4px; }
.rem-list { display: flex; flex-direction: column; margin-top: 8px; }
.rem-row { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-top: 1px solid var(--line2); }
.rem-row:first-child { border-top: 0; }
.rem-row label { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; cursor: pointer; }
.rem-row input[type=checkbox] { width: 20px; height: 20px; accent-color: var(--green); flex: none; }
.rem-row span { display: flex; flex-direction: column; min-width: 0; }
.rem-row small { color: var(--muted); font-size: .78rem; }
.rem-row input[type=time] { width: 128px; flex: none; }

/* ---------- Your week (plan) ---------- */
.week-plan .card-head { flex-wrap: wrap; }
.wp-summary { color: var(--fg); opacity: .85; margin: 0 0 10px; line-height: 1.45; }
.wp-list { display: flex; flex-direction: column; gap: 10px; }
.wp-day { display: flex; flex-direction: column; gap: 6px; }
.wp-day.past { opacity: .7; }
.wp-dh { font-size: .75rem; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.wp-day.today .wp-dh { color: var(--green); }
.wp-s { border: 1px solid var(--line); border-radius: 12px; background: var(--surface2); overflow: hidden; }
.wp-s.open { border-color: #2c3742; }
.wp-main { display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px; background: none; border: 0; color: var(--fg); font: inherit; text-align: left; cursor: pointer; }
.wp-t { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.wp-t b { font-weight: 600; font-size: .95rem; }
.wp-t span { color: var(--muted); font-size: .8rem; }
.wp-st { font-size: .75rem; font-weight: 600; flex: none; }
.wp-st.done { color: var(--green); } .wp-st.skipped { color: var(--muted); } .wp-st.planned { color: var(--orange); }
.wp-s.done .wp-t b { color: var(--muted); }
.wp-s.skipped .wp-t b { text-decoration: line-through; color: var(--muted); }
.wp-body { padding: 0 12px 12px 12px; }
.wp-details { white-space: pre-line; margin: 0 0 10px; font-size: .88rem; line-height: 1.5; }
.wp-acts, .wp-move { flex-wrap: wrap; gap: 8px; }
.wp-move select { flex: 1; min-width: 110px; } .wp-move input[type=time] { width: 120px; }
.wp-build { width: 100%; margin-top: 12px; }

/* ---------- Settings: training times and calendar ---------- */
.tt-rows { display: flex; flex-direction: column; }
.tt-row { display: flex; align-items: center; gap: 8px; padding: 7px 0; border-top: 1px solid var(--line2); }
.tt-row:first-child { border-top: 0; }
.tt-d { width: 34px; flex: none; font-weight: 600; font-size: .9rem; }
.tt-w { display: flex; flex-direction: column; gap: 6px; flex: 1; min-width: 0; }
.tt-pair { display: flex; align-items: center; gap: 6px; }
.tt-pair input[type=time] { width: 94px; min-width: 0; flex: none; padding: 7px 6px; font-size: .9rem; min-height: 0; }
.tt-to { color: var(--muted); font-size: .85rem; }
.tt-w .hidden { display: none; }
.tt-add { flex: none; font-size: .8rem; }
.tt-notes { margin-top: 10px; }
.tt-notes textarea { width: 100%; resize: vertical; }
.cal-btns { flex-wrap: wrap; gap: 8px; margin: 6px 0; }
#calNew.sure { color: var(--red); }
.cal-steps { margin: 12px 0 6px; padding-left: 20px; display: flex; flex-direction: column; gap: 6px; font-size: .88rem; line-height: 1.45; }
.cal-url { word-break: break-all; user-select: all; -webkit-user-select: all; background: var(--surface2); border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; font-family: ui-monospace, Menlo, monospace; font-size: .75rem; }
#calTry { display: inline-block; margin-top: 4px; }

/* ---------- Today card ---------- */
.td-list { display: flex; flex-direction: column; gap: 10px; }
.td-s { border: 1px solid var(--line); border-radius: 12px; background: var(--surface2); padding: 10px 12px; }
.td-top { display: flex; align-items: center; gap: 10px; }
.td-s .wp-details { margin: 8px 0 8px; }
.td-s.done .wp-t b, .td-s.skipped .wp-t b { color: var(--muted); }
.td-rest { margin: 0 0 4px; font-weight: 600; }
.td-btn { width: 100%; margin-top: 6px; }

/* ---------- Settings groups ---------- */
.set-group { border: 1px solid var(--line); border-radius: 18px; background: var(--surface); }
.set-group > summary { list-style: none; cursor: pointer; display: flex; flex-direction: column; gap: 2px; padding: 14px 44px 14px 16px; position: relative; }
.set-group > summary::-webkit-details-marker { display: none; }
.set-group > summary::after { content: ""; position: absolute; right: 18px; top: 50%; width: 8px; height: 8px; margin-top: -6px;
  border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(45deg); transition: transform .15s; }
.set-group[open] > summary::after { transform: rotate(225deg); margin-top: -2px; }
.set-group > summary b { font-size: 1.02rem; font-weight: 600; }
.set-group > summary small { color: var(--muted); font-size: .8rem; }
.set-group-body { display: flex; flex-direction: column; gap: 10px; padding: 0 6px 8px; }
.set-group-body .set-card { background: var(--surface2); }
