/* Health Hub — carbon + performance mint. Monochrome discipline, one accent. */
@font-face { font-family: 'Barlow'; font-style: normal; font-weight: 400; font-display: swap; src: url('../fonts/Barlow-400.woff2') format('woff2'); }
@font-face { font-family: 'Barlow'; font-style: normal; font-weight: 500; font-display: swap; src: url('../fonts/Barlow-500.woff2') format('woff2'); }
@font-face { font-family: 'Barlow'; font-style: normal; font-weight: 600; font-display: swap; src: url('../fonts/Barlow-600.woff2') format('woff2'); }
@font-face { font-family: 'Barlow'; font-style: normal; font-weight: 700; font-display: swap; src: url('../fonts/Barlow-700.woff2') format('woff2'); }
@font-face { font-family: 'Barlow Semi Condensed'; font-style: normal; font-weight: 600; font-display: swap; src: url('../fonts/BarlowSemiCondensed-600.woff2') format('woff2'); }
@font-face { font-family: 'Barlow Semi Condensed'; font-style: normal; font-weight: 700; font-display: swap; src: url('../fonts/BarlowSemiCondensed-700.woff2') format('woff2'); }
:root {
  --bg: #0C0D10;
  --card: #14161B;
  --raise: #1A1D24;
  --ink: #F2F4F7;
  --muted: #8E99AB;
  --faint: #77839A;
  --line: #22262F;
  --mint: #2EE6A8;
  --mint-dim: #1B4A3B;
  --mint-tint: rgba(46, 230, 168, .09);
  --amber: #E8B54D;
  --amber-tint: rgba(232, 181, 77, .10);
  --red: #F26D6D;
  --red-tint: rgba(242, 109, 109, .10);
  --radius: 14px;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 6px 18px rgba(0, 0, 0, .22);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  font-family: 'Barlow', -apple-system, system-ui, sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 16px;
  line-height: 1.45;
  padding-bottom: calc(72px + env(safe-area-inset-bottom));
}

h1, h2, h3 { font-family: 'Barlow Semi Condensed', 'Barlow', sans-serif; }
.num { font-variant-numeric: tabular-nums; }

/* ---------- header ---------- */
header {
  background: rgba(12, 13, 16, .92);
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
  padding: calc(10px + env(safe-area-inset-top)) 14px 10px;
  position: sticky; top: 0; z-index: 20;
}
.head-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.head-row h1 {
  font-size: 15px; font-weight: 700; text-transform: uppercase; letter-spacing: .14em;
}
.head-row h1 em { font-style: normal; color: var(--mint); }
.head-right { display: flex; align-items: center; gap: 10px; }
.head-date { color: var(--muted); font-size: 12.5px; font-weight: 500; }
.btn-today {
  font: inherit; font-size: 12px; font-weight: 700; letter-spacing: .04em;
  color: var(--mint); background: var(--mint-tint); border: 1px solid var(--mint-dim);
  border-radius: 999px; padding: 8px 14px; min-height: 34px; cursor: pointer; display: none;
}
.btn-today.show { display: block; }

.week-nav { display: flex; align-items: center; gap: 6px; }
.wk-arrow {
  flex: none; width: 40px; height: 48px; border: none; background: none; cursor: pointer;
  color: var(--faint); font-size: 17px; border-radius: 8px; -webkit-tap-highlight-color: transparent;
}
.wk-arrow:active { background: var(--raise); }
.week-strip { display: flex; gap: 4px; flex: 1; }
.wd {
  flex: 1; text-align: center; border-radius: 10px; padding: 7px 0 6px;
  border: 1px solid transparent; cursor: pointer; -webkit-tap-highlight-color: transparent;
  background: var(--card); color: var(--muted);
}
.wd b { display: block; font-size: 12px; font-weight: 700; font-variant-numeric: tabular-nums; }
.wd small { display: block; font-size: 9px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; opacity: .8; }
.wd.rest { background: transparent; border-color: var(--line); }
.wd.sel { background: var(--mint); color: #0A1410; border-color: var(--mint); }
.wd.today:not(.sel) { border-color: var(--mint-dim); color: var(--mint); }
.wd .dot {
  display: block; width: 4px; height: 4px; border-radius: 50%;
  margin: 3px auto 0; background: transparent;
}
.wd.logged .dot { background: var(--mint); }
.wd.sel .dot { background: #0A1410; }

/* ---------- layout ---------- */
main { padding: 14px 14px 24px; max-width: 640px; margin: 0 auto; }
.page { display: none; }
.page.active { display: block; }

.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 13px 15px; margin-bottom: 10px;
}
.section-label {
  font-family: 'Barlow Semi Condensed', sans-serif;
  font-size: 11.5px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .12em; color: var(--faint); margin: 16px 2px 7px;
}
.section-label:first-child { margin-top: 2px; }
.hint { color: var(--muted); font-size: 13px; }

/* ---------- lift page ---------- */
.day-banner { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 2px; }
.day-banner h2 {
  font-size: 26px; font-weight: 700; text-transform: uppercase; letter-spacing: .02em;
}
.day-banner .past-tag { color: var(--amber); font-size: 12px; font-weight: 700; letter-spacing: .06em; }
.day-note { color: var(--muted); font-size: 13px; margin: 0 2px 12px; }

.ex-card { padding: 0; overflow: hidden; margin-bottom: 8px; }
.ex-head {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 12px 14px; cursor: pointer; -webkit-tap-highlight-color: transparent; min-height: 46px;
}
.ex-head h3 { font-size: 16px; font-weight: 600; font-family: 'Barlow', sans-serif; flex: 1; }
.ex-head:active { background: var(--raise); }
.ex-head .chev { flex: none; width: 8px; height: 8px; border-right: 2px solid var(--faint); border-bottom: 2px solid var(--faint); transform: rotate(45deg); margin: -3px 2px 0 0; transition: transform .18s ease; }
.ex-card.open .ex-head .chev { transform: rotate(-135deg); margin-top: 3px; }
.ex-last { color: var(--faint); font-size: 12.5px; font-weight: 500; text-align: right; flex: none; }
.ex-last b { color: var(--muted); font-weight: 700; }
.ex-card.has-data .ex-last b { color: var(--mint); }
.ex-body { border-top: 1px solid var(--line); padding: 12px 14px 13px; display: none; }
.ex-card.open .ex-body { display: block; }

.set-grid { display: grid; grid-template-columns: 24px 1fr 1fr 78px 30px; gap: 7px; align-items: center; margin-bottom: 7px; }
.set-grid .col-label { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--faint); }
.set-num { color: var(--faint); font-size: 12.5px; font-weight: 700; text-align: center; }

input, select, textarea {
  font: inherit; color: var(--ink);
  border: 1px solid var(--line); border-radius: 10px;
  background: var(--bg); padding: 9px 10px; width: 100%;
  font-variant-numeric: tabular-nums;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--mint); outline-offset: -1px; }
input::placeholder, textarea::placeholder { color: var(--faint); font-weight: 500; }
input[type=number] { -moz-appearance: textfield; text-align: center; font-weight: 600; font-size: 17px; }
input.beat { border-color: var(--mint); background: var(--mint-tint); }

.set-del { border: none; background: none; color: var(--faint); font-size: 17px; cursor: pointer; width: 44px; height: 44px; margin: 0 -10px 0 -4px; display: grid; place-items: center; }

.btn {
  font: inherit; font-weight: 600; cursor: pointer;
  border: 1px solid var(--line); background: var(--raise); color: var(--ink);
  border-radius: 10px; padding: 10px 14px; -webkit-tap-highlight-color: transparent;
}
.btn.primary { background: var(--mint); border-color: var(--mint); color: #0A1410; font-weight: 700; }
.btn.small { padding: 7px 12px; font-size: 13.5px; min-height: 44px; }
.btn.ghostb { background: transparent; border-style: dashed; color: var(--muted); width: 100%; margin-top: 2px; }

.feel-row { display: flex; gap: 7px; margin: 11px 0 8px; }
.feel-btn { flex: 1; text-align: center; font-size: 13.5px; color: var(--muted); }
.feel-btn.sel-good { background: var(--mint-tint); border-color: var(--mint); color: var(--mint); }
.feel-btn.sel-off { background: var(--amber-tint); border-color: var(--amber); color: var(--amber); }
.feel-btn.sel-pain { background: var(--red-tint); border-color: var(--red); color: var(--red); }

.beat-chip {
  display: inline-block; background: var(--mint); color: #0A1410;
  font-size: 11px; font-weight: 800; letter-spacing: .04em; border-radius: 999px;
  padding: 2px 9px; margin-left: 8px; vertical-align: 2px;
}

.rest-row { display: flex; align-items: center; gap: 7px; margin-top: 10px; }
.rest-row .lbl { font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--faint); margin-right: 2px; }
.rest-btn { flex: 1; font-size: 13.5px; color: var(--muted); padding: 7px 0; min-height: 44px; }

.history-block { margin-top: 10px; border-top: 1px dashed var(--line); padding-top: 10px; display: none; }
.ex-card.show-history .history-block { display: block; }
.hist-row { display: flex; justify-content: space-between; font-size: 13.5px; padding: 4px 0; }
.hist-row .d { color: var(--muted); }

.add-ex-row { display: flex; gap: 8px; margin-top: 6px; }

/* rest timer pill */
#timer-pill {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(84px + env(safe-area-inset-bottom)); z-index: 35;
  background: var(--raise); border: 1px solid var(--mint); color: var(--ink);
  border-radius: 999px; padding: 9px 20px; font-weight: 700; font-size: 16px;
  font-variant-numeric: tabular-nums; display: none; align-items: center; gap: 10px;
  box-shadow: var(--shadow); cursor: pointer;
}
#timer-pill.on { display: flex; }
#timer-pill.done { background: var(--mint); color: #0A1410; border-color: var(--mint); animation: pulse 1s ease infinite; }
#timer-pill .x { color: var(--faint); font-size: 14px; font-weight: 600; }
#timer-pill.done .x { color: #0A1410; }
@keyframes pulse { 50% { transform: translateX(-50%) scale(1.04); } }

/* checklist */
.check-item {
  display: flex; align-items: flex-start; gap: 12px; padding: 10px 4px;
  border-bottom: 1px solid var(--line); cursor: pointer; -webkit-tap-highlight-color: transparent;
}
.check-item:last-child { border-bottom: none; }
.check-item .box {
  width: 23px; height: 23px; border-radius: 7px; border: 2px solid var(--line);
  flex: none; margin-top: 1px; display: grid; place-items: center;
  color: transparent; font-size: 14px; font-weight: 800;
}
.check-item.done .box { background: var(--mint); border-color: var(--mint); color: #0A1410; }
.check-item.done .txt { color: var(--faint); text-decoration: line-through; text-decoration-color: rgba(90,101,119,.6); }

/* ---------- check-in ---------- */
.review-card { border-color: var(--mint-dim); }
.review-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 9px; }
.review-head h3 { font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .1em; color: var(--mint); }
.review-head span { font-size: 12px; color: var(--faint); }
.review-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; margin-bottom: 10px; }
.rv-cell { background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; }
.rv-cell .v { font-size: 19px; font-weight: 700; font-variant-numeric: tabular-nums; }
.rv-cell .k { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: var(--faint); margin-top: 1px; }
.verdict { font-size: 13.5px; font-weight: 600; border-radius: 10px; padding: 8px 12px; }
.verdict.ok { background: var(--mint-tint); color: var(--mint); }
.verdict.warn { background: var(--amber-tint); color: var(--amber); }
.verdict.info { background: var(--raise); color: var(--muted); }

.dots-row { display: flex; gap: 6px; margin-top: 10px; }
.dot-day { flex: 1; text-align: center; }
.dot-day i {
  display: block; width: 10px; height: 10px; border-radius: 50%;
  margin: 0 auto 3px; background: var(--raise); border: 1px solid var(--line);
}
.dot-day.full i { background: var(--mint); border-color: var(--mint); }
.dot-day.part i { background: var(--amber); border-color: var(--amber); }
.dot-day span { font-size: 9.5px; font-weight: 700; color: var(--faint); text-transform: uppercase; }

.macro-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.macro-cell label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: var(--faint); display: block; margin-bottom: 4px; }
.bars { margin-top: 13px; }
.bar-row { margin-bottom: 9px; }
.bar-row .bar-label { display: flex; justify-content: space-between; font-size: 13px; font-weight: 600; margin-bottom: 4px; }
.bar-row .bar-label .val { color: var(--muted); }
.bar { height: 8px; background: var(--raise); border-radius: 999px; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--mint); border-radius: 999px; width: 0; transition: width .25s ease; }
.bar-row.over .bar i { background: var(--amber); }
.protein-flag { font-size: 13px; font-weight: 600; margin-top: 2px; }
.protein-flag.under { color: var(--red); }
.protein-flag.hit { color: var(--mint); }

.past-day { display: flex; justify-content: space-between; align-items: baseline; padding: 8px 2px; border-bottom: 1px solid var(--line); font-size: 13.5px; }
.past-day:last-child { border-bottom: none; }
.past-day .d { font-weight: 600; }
.past-day .m { color: var(--muted); }

/* ---------- reference ---------- */
.ref-list li { margin: 0 0 7px 18px; }
.meal-row { display: flex; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.meal-row:last-child { border-bottom: none; }
.meal-time { flex: none; width: 112px; color: var(--mint); font-weight: 700; font-size: 12.5px; padding-top: 2px; }
.meal-what b { display: block; font-size: 14.5px; }
.meal-what span { color: var(--muted); font-size: 13.5px; }
.split-row { display: flex; gap: 12px; padding: 7px 0; border-bottom: 1px solid var(--line); font-size: 14.5px; }
.split-row:last-child { border-bottom: none; }
.split-row .sd { flex: none; width: 42px; font-weight: 700; color: var(--mint); }
.banned-tag { display: inline-block; background: var(--red-tint); color: var(--red); font-size: 12.5px; font-weight: 600; border-radius: 8px; padding: 4px 10px; margin: 0 6px 6px 0; }

/* ---------- nav ---------- */
nav {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 30;
  background: rgba(12, 13, 16, .94);
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  border-top: 1px solid var(--line);
  display: flex; padding-bottom: env(safe-area-inset-bottom);
}
nav button {
  flex: 1; border: none; background: none; cursor: pointer;
  font-family: 'Barlow', sans-serif; font-size: 10.5px; font-weight: 700;
  letter-spacing: .06em; text-transform: uppercase;
  color: var(--faint); padding: 8px 0 9px; -webkit-tap-highlight-color: transparent;
}
nav button svg { display: block; margin: 0 auto 3px; width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
nav button.active { color: var(--mint); }

.toast {
  position: fixed; left: 50%; bottom: calc(96px + env(safe-area-inset-bottom)); transform: translateX(-50%) translateY(8px);
  background: var(--ink); color: var(--bg); font-size: 13.5px; font-weight: 700;
  border-radius: 999px; padding: 12px 20px; opacity: 0; pointer-events: none;
  transition: opacity .2s ease, transform .2s ease; z-index: 40; white-space: nowrap;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.tappable { pointer-events: auto; cursor: pointer; background: var(--mint); color: #0A1410; }
body.timer-on .toast { bottom: calc(150px + env(safe-area-inset-bottom)); }

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