:root {
  --bg: #1a1917;
  --card: #232120;
  --line: #333029;
  --text: #f0ede6;
  --text2: #8a857c;
  --danger: #c96a5a;
  --good: #8aa86a;
  --num: "Oswald", system-ui, sans-serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

* {
  box-sizing: border-box;
}
html,
body {
  margin: 0;
  padding: 0;
}
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}
button {
  font-family: inherit;
  cursor: pointer;
  color: inherit;
}
input {
  font-family: inherit;
}
.num {
  font-family: var(--num);
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
  letter-spacing: -0.01em;
}

/* ---- app shell ---- */
#app {
  max-width: 640px;
  margin: 0 auto;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  padding-top: env(safe-area-inset-top);
}
.view {
  flex: 1;
  padding: 14px 18px 134px;
}

/* ---- bottom nav + raised capture ---- */
.bottomnav {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: 0;
  width: 100%;
  max-width: 640px;
  z-index: 20;
  background: var(--card);
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.nav-tabs {
  display: flex;
  align-items: flex-end;
  height: 58px;
  padding-bottom: 9px;
}
.navtab {
  flex: 1;
  background: none;
  border: 0;
  color: var(--text2);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.02em;
  padding: 6px 0;
}
.navtab.on {
  color: var(--text);
}
.fab-snap {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  top: -26px;
  width: 62px;
  height: 62px;
  border-radius: 31px;
  border: 4px solid var(--bg);
  background: var(--text);
  color: var(--bg);
  display: grid;
  place-items: center;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.5);
}
.fab-snap svg {
  width: 27px;
  height: 27px;
}
.fab-snap:active {
  transform: translateX(-50%) scale(0.95);
}
.nav-spacer {
  flex: 1;
}
.fab-gallery {
  flex: 1;
  background: none;
  border: 0;
  color: var(--text2);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 6px 0 11px;
}
.fab-gallery svg {
  width: 24px;
  height: 24px;
}
.fab-gallery:active {
  color: var(--text);
}
/* On Progress the camera shoots you, not your dinner. Colour it, and badge it
   with a figure, so the change of target is obvious before you tap. */
.bottomnav.body-mode .fab-snap {
  background: var(--good);
  color: var(--bg);
}
.bottomnav.body-mode .fab-snap::after,
.bottomnav.body-mode .fab-gallery::after {
  content: "🧍";
  position: absolute;
  font-size: 11px;
  line-height: 1;
  background: var(--bg);
  border-radius: 8px;
  padding: 2px 3px;
}
.bottomnav.body-mode .fab-snap::after {
  right: -2px;
  bottom: 0;
}
.bottomnav.body-mode .fab-gallery {
  position: relative;
  color: var(--good);
}
.bottomnav.body-mode .fab-gallery::after {
  right: 14px;
  bottom: 8px;
}

/* ---- today ---- */
.hero {
  padding: 22px 0 26px;
  text-align: center;
}
.hero .total {
  font-family: var(--num);
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  font-size: clamp(72px, 26vw, 128px);
  line-height: 0.9;
  letter-spacing: -0.02em;
}
.hero .unit {
  color: var(--text2);
  font-size: 15px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  margin-top: 6px;
}
.macros {
  display: flex;
  justify-content: center;
  gap: 22px;
  margin-top: 16px;
}
.macro {
  color: var(--text2);
  font-size: 13px;
}
.macro b {
  display: block;
  color: var(--text);
  font-family: var(--num);
  font-variant-numeric: tabular-nums;
  font-weight: 500;
  font-size: 22px;
}

.meal-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 8px;
}
.meal {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 10px;
  text-align: left;
  width: 100%;
}
.thumb {
  width: 56px;
  height: 56px;
  border-radius: 10px;
  object-fit: cover;
  background: var(--line);
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  color: var(--text2);
}
.meal .meta {
  flex: 1;
  min-width: 0;
}
.meal .name {
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.meal .sub {
  color: var(--text2);
  font-size: 13px;
}
.meal .kcal {
  font-family: var(--num);
  font-variant-numeric: tabular-nums;
  font-weight: 500;
  font-size: 22px;
}
.empty {
  color: var(--text2);
  text-align: center;
  padding: 40px 0;
}

/* ---- capture button ---- */
.capture-bar {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: calc(22px + env(safe-area-inset-bottom));
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 12px;
}
.capture {
  border: 0;
  background: var(--text);
  color: var(--bg);
  font-weight: 700;
  font-size: 16px;
  height: 56px;
  padding: 0 30px;
  border-radius: 28px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5);
}
.capture-lib {
  width: 56px;
  height: 56px;
  flex: 0 0 auto;
  border-radius: 28px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--text);
  font-size: 22px;
  display: grid;
  place-items: center;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.4);
}
.capture:active,
.capture-lib:active {
  transform: scale(0.97);
}

/* ---- sheet (review / day detail) ---- */
.sheet-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 30;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.sheet {
  background: var(--bg);
  border: 1px solid var(--line);
  border-bottom: 0;
  border-radius: 20px 20px 0 0;
  width: 100%;
  max-width: 640px;
  max-height: 92vh;
  max-height: 92dvh;
  overflow-y: auto;
  padding: 18px 18px calc(18px + env(safe-area-inset-bottom));
}
.sheet h2 {
  margin: 4px 0 2px;
  font-size: 20px;
}
.sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.sheet .sub {
  color: var(--text2);
  font-size: 13px;
  margin-bottom: 14px;
}
.review-photo {
  width: 100%;
  height: 190px;
  object-fit: cover;
  border-radius: 14px;
  background: var(--card);
  margin-bottom: 14px;
}
.spinner-wrap {
  height: 190px;
  display: grid;
  place-items: center;
  color: var(--text2);
  gap: 10px;
}
.spinner {
  width: 26px;
  height: 26px;
  border: 3px solid var(--line);
  border-top-color: var(--text);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-top: 1px solid var(--line);
}
.item .iname {
  flex: 1;
  min-width: 0;
}
.item .iname .n {
  font-weight: 600;
}
.item .iname .m {
  color: var(--text2);
  font-size: 12px;
}
.badge {
  display: inline-block;
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--danger);
  border: 1px solid var(--danger);
  border-radius: 6px;
  padding: 1px 5px;
  margin-left: 6px;
  vertical-align: middle;
}
.grams {
  width: 76px;
  flex: 0 0 auto;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--text);
  padding: 10px;
  text-align: right;
  font-family: var(--num);
  font-variant-numeric: tabular-nums;
  font-size: 17px;
}
.grams:focus {
  outline: 2px solid var(--text2);
  outline-offset: 1px;
}
.gunit {
  color: var(--text2);
  font-size: 12px;
  margin-left: -8px;
}
.item .ikcal {
  width: 62px;
  text-align: right;
  font-family: var(--num);
  font-variant-numeric: tabular-nums;
  font-size: 19px;
  flex: 0 0 auto;
}

.review-total {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  border-top: 1px solid var(--line);
  padding-top: 14px;
  margin-top: 4px;
}
.review-total .rt {
  color: var(--text2);
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}
.review-total .rv {
  font-family: var(--num);
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  font-size: 40px;
}
.hint-field {
  width: 100%;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--text);
  padding: 12px;
  margin-top: 12px;
  font-size: 15px;
}
.actions {
  display: flex;
  gap: 10px;
  margin-top: 16px;
}
.btn {
  flex: 1;
  border: 1px solid var(--line);
  background: var(--card);
  border-radius: 14px;
  padding: 15px;
  font-weight: 700;
  font-size: 16px;
}
.btn.primary {
  background: var(--text);
  color: var(--bg);
  border-color: var(--text);
}
.btn.ghost {
  color: var(--text2);
}
.btn:disabled {
  opacity: 0.5;
}
.notes {
  color: var(--text2);
  font-size: 13px;
  margin: 8px 0 2px;
}

/* ---- login ---- */
.login {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 0 26px;
  gap: 14px;
}
/* .btn carries flex:1 for the side-by-side sheet actions; in these column
   layouts that makes it grow to fill the screen. */
.login .btn,
.onboard .btn {
  flex: 0 0 auto;
}
.login h1 {
  font-family: var(--num);
  font-weight: 600;
  font-size: 44px;
  letter-spacing: 0.02em;
  margin: 0;
}
.login p {
  color: var(--text2);
  margin: 0 0 6px;
  font-size: 21px;
}
.login p b,
.ob-tag b {
  color: var(--text);
  font-weight: 700;
}
.login input {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  color: var(--text);
  padding: 16px;
  font-size: 17px;
}
.login .err {
  color: var(--danger);
  font-size: 14px;
  min-height: 18px;
}

/* ---- progress chart ---- */
.chart-wrap {
  margin-top: 8px;
}
.chart {
  width: 100%;
  height: 240px;
  display: block;
}
.chart .bar {
  fill: var(--line);
}
.chart .bar.tap {
  cursor: pointer;
}
.chart .bar.over {
  fill: var(--danger);
}
.chart .bar.under {
  fill: var(--good);
}
.chart .goal-line {
  stroke: var(--text2);
  stroke-width: 1;
  stroke-dasharray: 4 4;
  opacity: 0.7;
}
.chart .avg {
  fill: none;
  stroke: var(--text);
  stroke-width: 2;
  stroke-linejoin: round;
}
/* Weekday letters under the bars. The chart SVG is scaled with
   preserveAspectRatio="none", which would stretch any text drawn inside it, so
   these live in HTML and share the bars' equal-column layout. */
.chart-days {
  display: flex;
  margin-top: 4px;
  color: var(--text2);
  font-size: 11px;
}
.chart-days span {
  flex: 1;
  text-align: center;
}

/* ---- range picker + running total ---- */
.sec-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.sec-row .sec-label {
  margin-bottom: 0;
}
.range-chips {
  display: flex;
  gap: 4px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 3px;
  margin-top: 16px;
}
.chip {
  background: none;
  border: 0;
  color: var(--text2);
  font-size: 12px;
  font-weight: 600;
  padding: 5px 10px;
  border-radius: 7px;
  white-space: nowrap;
}
.chip.on {
  background: var(--text);
  color: var(--bg);
}
.rsum {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px 14px;
  margin-top: 10px;
}
.rsum.over {
  border-color: var(--danger);
}
.rsum.under {
  border-color: var(--good);
}
.rsum-top {
  display: flex;
  align-items: baseline;
  gap: 8px;
}
.rsum-num {
  font-family: var(--num);
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  font-size: 34px;
  line-height: 1;
}
.rsum.over .rsum-num {
  color: var(--danger);
}
.rsum.under .rsum-num {
  color: var(--good);
}
.rsum-word {
  color: var(--text2);
  font-size: 14px;
}
.rsum-sub {
  color: var(--text2);
  font-size: 12px;
  margin-top: 4px;
}
.rsum-fix {
  color: var(--text2);
  font-size: 13px;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
}
.rsum-fix b {
  color: var(--text);
}
.legend {
  display: flex;
  gap: 18px;
  color: var(--text2);
  font-size: 12px;
  margin-top: 6px;
}
.legend .k {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.swatch {
  width: 14px;
  height: 3px;
  border-radius: 2px;
  background: var(--text);
  display: inline-block;
}
.swatch.bar {
  height: 10px;
  width: 8px;
  background: var(--line);
}
.swatch.bar.over {
  background: var(--danger);
}
.swatch.bar.under {
  background: var(--good);
}
/* over/under-goal pill on day cards */
.gpill {
  display: inline-block;
  font-family: var(--num);
  font-size: 12px;
  line-height: 1;
  padding: 3px 7px;
  border-radius: 999px;
  border: 1px solid currentColor;
}
.gpill.over {
  color: var(--danger);
}
.gpill.under,
.gpill.on {
  color: var(--good);
}

@media (prefers-reduced-motion: reduce) {
  .spinner {
    animation-duration: 1.6s;
  }
  .capture:active,
  .capture-lib:active {
    transform: none;
  }
}

/* ---- today: budget / exercise / manual ---- */
.hero .total.over {
  color: var(--danger);
}
.budget {
  color: var(--text2);
  font-size: 13px;
  margin-top: 8px;
}
.setgoal {
  background: none;
  border: 0;
  color: var(--text2);
  font-size: 14px;
  margin-top: 8px;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.exercise {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 10px 14px;
  margin: 4px 0 14px;
}
.ex-label {
  font-weight: 600;
}
.ex-input {
  width: 72px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--text);
  padding: 8px 10px;
  text-align: right;
  font-size: 16px;
}
.ex-unit {
  color: var(--text2);
  font-size: 13px;
}
.add-manual {
  margin-top: 14px;
}
.add-row {
  display: flex;
  gap: 10px;
  margin-top: 14px;
}
.add-row .ghost-btn {
  flex: 1;
}

/* ---- exercise section (Today) ---- */
.ex-section {
  margin: 4px 0 14px;
}
.ex-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}
.ex-title {
  color: var(--text2);
  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.ex-sum {
  color: var(--text);
  font-family: var(--num);
  font-variant-numeric: tabular-nums;
  font-size: 15px;
  margin-left: 6px;
}
.ex-add {
  padding: 7px 12px;
  font-size: 13px;
}
.ex-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.ex-row {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  text-align: left;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 8px;
}
.ex-thumb {
  width: 44px;
  height: 44px;
  border-radius: 9px;
  object-fit: cover;
  flex: 0 0 auto;
  background: var(--line);
  display: grid;
  place-items: center;
  font-size: 18px;
}
.ex-rmeta {
  flex: 1;
  min-width: 0;
}
.ex-rname {
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ex-rtime {
  color: var(--text2);
  font-size: 12px;
}
.meal {
  cursor: pointer;
}

/* ---- earn it back (Today, when the budget is nearly gone) ---- */
.earn {
  margin: 2px 0 16px;
  padding: 12px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
}
.earn-head {
  margin-bottom: 4px;
}
.earn-sub {
  color: var(--text2);
  font-size: 13px;
  line-height: 1.45;
  margin-bottom: 10px;
}
.earn-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.earn-row {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  text-align: left;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 9px 10px;
}
.earn-icon {
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  font-size: 17px;
  background: var(--line);
  border-radius: 9px;
}
.earn-meta {
  flex: 1;
  min-width: 0;
}
.earn-name {
  color: var(--text);
  font-size: 15px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.earn-buys {
  color: var(--text2);
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.earn-kcal {
  color: var(--text);
  font-size: 17px;
  flex: 0 0 auto;
}
.earn-foot {
  color: var(--text2);
  font-size: 12px;
  margin-top: 10px;
}
.goal-hint {
  color: var(--text2);
  font-size: 13px;
  line-height: 1.5;
  margin-top: 14px;
  padding: 10px 12px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
}
.goal-hint b {
  color: var(--text);
}
.ex-rkcal {
  font-family: var(--num);
  font-variant-numeric: tabular-nums;
  color: var(--text2);
  font-size: 18px;
}

/* ---- editor: editable items ---- */
.items {
  display: flex;
  flex-direction: column;
}
.item.edit {
  display: block;
  border-top: 1px solid var(--line);
  padding: 12px 0;
}
.item-top {
  display: flex;
  align-items: center;
  gap: 8px;
}
.n-input {
  flex: 1;
  min-width: 0;
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--line);
  color: var(--text);
  font-size: 16px;
  font-weight: 600;
  padding: 4px 0;
}
.n-input:focus {
  outline: none;
  border-bottom-color: var(--text2);
}
.rm {
  flex: 0 0 auto;
  width: 30px;
  height: 30px;
  border-radius: 15px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--text2);
  font-size: 13px;
  line-height: 1;
}
.item-bottom {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 8px;
  flex-wrap: wrap;
}
.item-bottom .field {
  color: var(--text2);
  font-size: 12px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.item-bottom .grams,
.item-bottom .kcal-input {
  width: 64px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--text);
  padding: 8px 8px;
  text-align: right;
  font-size: 16px;
}
.item-bottom .m {
  margin-left: auto;
  color: var(--text2);
  font-size: 12px;
}
.edit-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  border-top: 1px solid var(--line);
  padding-top: 12px;
  margin-top: 4px;
}

/* ---- editor: food search ---- */
.search-panel {
  margin: 4px 0 10px;
}
.search-input {
  width: 100%;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--text);
  font-size: 16px; /* 16px keeps iOS from zooming on focus */
  padding: 12px 14px;
}
.search-input:focus {
  outline: none;
  border-color: var(--text2);
}
.search-results {
  max-height: 46vh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.search-results:not(:empty) {
  margin-top: 8px;
}
.search-hit {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 3px;
  width: 100%;
  text-align: left;
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--line);
  color: var(--text);
  padding: 11px 2px;
}
.search-hit:active {
  background: var(--card);
}
.sh-name {
  font-size: 15px;
  font-weight: 600;
  line-height: 1.25;
}
.sh-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text2);
  font-size: 12px;
  font-family: var(--num);
}
.sh-src {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 1px 7px;
  font-family: var(--sans);
  font-size: 10px;
  letter-spacing: 0.02em;
}
.search-msg {
  color: var(--text2);
  font-size: 14px;
  padding: 14px 2px;
}
.ghost-btn {
  background: var(--card);
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 12px;
  padding: 11px 14px;
  font-size: 14px;
  font-weight: 600;
}
.err-box {
  color: var(--text2);
  text-align: center;
  padding: 24px 8px;
  font-size: 15px;
}

/* ---- goal calculator ---- */
.goal-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.seg {
  display: flex;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 4px;
  gap: 4px;
}
.seg button {
  flex: 1;
  background: none;
  border: 0;
  color: var(--text2);
  font-weight: 600;
  font-size: 15px;
  padding: 10px;
  border-radius: 9px;
}
.seg button.on {
  background: var(--text);
  color: var(--bg);
}
.gl {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--text2);
  font-size: 15px;
}
.gl .hh {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text2);
  font-size: 13px;
}
.gl input {
  width: 68px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--text);
  padding: 11px 10px;
  text-align: right;
  font-size: 16px;
}
.gl select {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--text);
  padding: 11px 10px;
  font-size: 15px;
  max-width: 62%;
}
.goal-result {
  text-align: center;
  margin-top: 12px;
}
.accordion {
  margin-top: 20px;
  border-top: 1px solid var(--line);
}
.acc-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: none;
  border: 0;
  color: var(--text);
  font-weight: 600;
  font-size: 15px;
  padding: 16px 2px;
}
.acc-caret {
  color: var(--text2);
  transition: transform 0.15s ease;
}
.accordion.open .acc-caret {
  transform: rotate(180deg);
}
.acc-body {
  padding-bottom: 8px;
}
.goal-num {
  font-family: var(--num);
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  font-size: clamp(56px, 20vw, 96px);
  line-height: 0.95;
}
.goal-rate {
  display: inline-block;
  margin-top: 12px;
  color: var(--text);
  font-weight: 600;
  font-size: 15px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 15px;
}
.goal-delta {
  color: var(--text2);
  font-size: 14px;
  margin-top: 8px;
}
.goal-breakdown {
  color: var(--text2);
  font-size: 14px;
  margin: 8px 0 18px;
}
.jstats {
  color: var(--text2);
  font-size: 13px;
  margin-top: 6px;
}
.jstats .jover {
  color: var(--danger);
}
.jstats .junder {
  color: var(--good);
}
.goal-result .btn {
  max-width: 260px;
  margin: 0 auto;
}

/* ---- progress dashboard: today log ---- */
.sec-label {
  color: var(--text2);
  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin: 22px 0 8px;
}
.log-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px;
  margin-top: 8px;
}
.log-title {
  font-weight: 700;
  margin-bottom: 10px;
}
.log-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
.log-label {
  color: var(--text2);
  font-size: 15px;
}
.log-row .hh {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text2);
  font-size: 13px;
}
.w-input {
  width: 80px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--text);
  padding: 9px 10px;
  text-align: right;
  font-size: 16px;
}
.note-input {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--text);
  padding: 10px;
  font-size: 15px;
  font-family: inherit;
  resize: vertical;
}
.body-photos {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  flex-wrap: wrap;
}
/* A div in the Progress log strip (it holds a remove button), a button in the
   day sheet — so the padding/border reset has to cover both. */
.bthumb {
  position: relative;
  width: 72px;
  height: 72px;
  border-radius: 12px;
  overflow: hidden;
  flex: 0 0 auto;
  padding: 0;
  border: 0;
  background: var(--line);
}
.bthumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  cursor: pointer;
}
.photo-hint {
  color: var(--text2);
  font-size: 12px;
  margin-top: 10px;
  line-height: 1.35;
}
.photo-hint b {
  color: var(--text);
  font-weight: 600;
}
.bthumb.add {
  border: 1px dashed var(--line);
  background: var(--bg);
  color: var(--text2);
  font-size: 24px;
  display: grid;
  place-items: center;
}
.brm {
  position: absolute;
  top: 3px;
  right: 3px;
  width: 22px;
  height: 22px;
  border-radius: 11px;
  border: 0;
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  font-size: 12px;
  line-height: 1;
}

/* ---- weight chart ---- */
.wchart-top {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 4px;
}
.wnow {
  font-family: var(--num);
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  font-size: 26px;
}
.wchart {
  height: 150px;
}
.wchart .wline {
  fill: none;
  stroke: var(--text);
  stroke-width: 2;
  stroke-linejoin: round;
  stroke-linecap: round;
}
.wchart circle {
  fill: var(--text);
}

/* ---- history timeline ---- */
.timeline {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.jentry {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px;
}
.jhead {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
}
.jdate {
  font-weight: 600;
}
.jweight {
  font-family: var(--num);
  font-variant-numeric: tabular-nums;
  color: var(--text2);
  font-size: 16px;
}
.jnote {
  color: var(--text2);
  font-size: 14px;
  margin-top: 6px;
  white-space: pre-wrap;
}
.jphotos {
  display: flex;
  gap: 8px;
  margin-top: 10px;
  flex-wrap: wrap;
}
/* Each thumb is a button — it opens the meal, workout or progress photo it
   came from, so the little tag says which of those you're about to get. */
.jthumb {
  position: relative;
  width: 84px;
  height: 84px;
  padding: 0;
  border: 0;
  border-radius: 12px;
  overflow: hidden;
  background: var(--line);
  flex: 0 0 auto;
  display: block;
}
.jthumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.jthumb:active {
  opacity: 0.75;
}
.jthumb-tag {
  position: absolute;
  left: 4px;
  bottom: 4px;
  font-size: 11px;
  line-height: 1;
  padding: 3px 4px;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.55);
}

/* ---- day sheet (a past day, opened from the chart or the history) ---- */
.day-sheet .sec-label {
  margin: 18px 0 8px;
}
.day-sheet .empty {
  padding: 18px 0;
}
.day-sheet .meal-list,
.day-sheet .ex-list {
  margin-top: 0;
}
.day-meta {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
}
.day-weight {
  font-family: var(--num);
  font-variant-numeric: tabular-nums;
  font-size: 20px;
  font-weight: 600;
}
.day-meta .jnote {
  margin-top: 2px;
}
/* A body photo is portrait — give it room rather than cropping to a strip. */
.review-photo.tall {
  height: auto;
  max-height: 52vh;
  object-fit: contain;
}

/* ---- onboarding walkthrough ---- */
.onboard {
  padding-bottom: 40px;
}
.ob-head {
  text-align: center;
  padding: 22px 0 18px;
}
.ob-logo {
  font-size: 40px;
  line-height: 1;
  margin-bottom: 10px;
}
.ob-head h1 {
  font-family: var(--num);
  font-size: 40px;
  margin: 0;
  letter-spacing: -0.01em;
}
.ob-tag {
  color: var(--text2);
  margin: 6px 0 0;
  font-size: 19px;
}
.ob-cards {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.ob-card {
  display: flex;
  gap: 12px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px;
}
.ob-icon {
  font-size: 22px;
  line-height: 1.2;
  flex: 0 0 auto;
}
.ob-title {
  font-weight: 600;
  margin-bottom: 3px;
}
.ob-body {
  color: var(--text2);
  font-size: 14px;
  line-height: 1.5;
}
.ob-cta {
  width: 100%;
  margin-top: 18px;
}
.ob-skip {
  display: block;
  width: 100%;
  background: none;
  border: 0;
  color: var(--text2);
  font-size: 14px;
  padding: 14px 0 0;
}
.ob-name {
  margin-top: 8px;
}
.ob-name input {
  width: 100%;
  background: var(--card);
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 12px;
  padding: 14px;
  font-size: 17px;
}
.ob-note {
  color: var(--text2);
  font-size: 13px;
  line-height: 1.5;
  margin-top: 10px;
}

/* ---- account + admin sharing ---- */
.acct {
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}
.acct-who {
  font-size: 15px;
  margin-bottom: 12px;
}
.acct-label,
.admin-sub {
  color: var(--text2);
  font-size: 12px;
  margin-bottom: 6px;
}
.acct-note {
  color: var(--text2);
  font-size: 12px;
  line-height: 1.5;
  margin-top: 8px;
}
.copy-row {
  display: flex;
  gap: 8px;
}
.copy-row input {
  flex: 1;
  min-width: 0;
  background: var(--bg);
  border: 1px solid var(--line);
  color: var(--text2);
  border-radius: 10px;
  padding: 10px;
  font-size: 13px;
}
.copy-row .ghost-btn {
  flex: 0 0 auto;
  padding: 10px 14px;
  font-size: 13px;
}
.admin-search {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 10px;
  padding: 10px;
  font-size: 14px;
  margin-bottom: 10px;
}
.admin-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.admin-row {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
.admin-meta {
  flex: 1;
  min-width: 0;
}
.admin-name {
  font-size: 15px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.admin-acts {
  display: flex;
  gap: 6px;
  flex: 0 0 auto;
}
.ghost-btn.sm {
  padding: 7px 10px;
  font-size: 12px;
}
.ghost-btn.danger {
  color: var(--danger);
}
.admin-link {
  flex: 1 0 100%;
}
.login-help {
  color: var(--text2);
  font-size: 13px;
  line-height: 1.5;
  margin-top: 18px;
}
.login-help a {
  color: var(--text);
}

/* ---- screenshot strip on the pitch ---- */
.ob-shots {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 6px;
  margin-bottom: 16px;
}
.ob-shots figure {
  margin: 0;
  flex: 0 0 62%;
  max-width: 240px;
  scroll-snap-align: center;
}
.ob-shots img {
  width: 100%;
  aspect-ratio: 1 / 2;
  object-fit: cover;
  object-position: top;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--card);
  display: block;
}
.ob-shots figcaption {
  color: var(--text2);
  font-size: 12px;
  text-align: center;
  margin-top: 7px;
}
.ob-fine {
  color: var(--text2);
  font-size: 12px;
  line-height: 1.5;
  text-align: center;
  margin-top: 14px;
}
.onboard .err {
  color: var(--danger);
  font-size: 13px;
  text-align: center;
  margin-top: 8px;
}
