/* ===========================================================================
   PB Performance Coaching — client app
   Light, iOS-style theme with PB teal/gold brand accents.
   =========================================================================== */
@import url('https://fonts.googleapis.com/css2?family=Barlow+Condensed:wght@600;700;800;900&display=swap');

:root {
  /* brand */
  --teal: #2d6e7e;
  --teal-l: #2f7e90;
  --teal-d: #1e4f5c;
  --gold: #c9a84c;
  --gold-ink: #97781f;

  /* light surfaces */
  --bg: #eef1f3;
  --bg2: #e6eaec;
  --surface: #ffffff;
  --surface-2: #f6f8f9;
  --dark: #eef1f3;          /* legacy token used by inputs */
  --d1: #ffffff; --d2: #ffffff; --d3: #f4f6f7; --d4: #eef1f3;

  /* text */
  --text: #0d1719;
  --ink-2: #3a4d52;
  --muted: #75878c;
  --dim: #9fadb1;

  /* lines */
  --border: rgba(13, 23, 25, 0.09);
  --hair: rgba(13, 23, 25, 0.06);
  --tborder: rgba(45, 110, 126, 0.22);

  /* status */
  --good: #2e9e63;
  --warn: #c79026;
  --bad: #d65a50;

  /* tints */
  --teal-tint: rgba(45, 110, 126, 0.10);
  --gold-tint: rgba(201, 168, 76, 0.18);

  /* shadows (iOS-soft) */
  --sh-1: 0 1px 2px rgba(13,23,25,.05), 0 1px 1px rgba(13,23,25,.04);
  --sh-2: 0 1px 3px rgba(13,23,25,.06), 0 10px 24px rgba(13,23,25,.05);
  --sh-3: 0 8px 30px rgba(13,23,25,.10);

  --fd: 'Barlow Condensed', sans-serif;
  --fb: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Segoe UI', Roboto, system-ui, sans-serif;
  --maxw: 480px;
  --nav-h: 64px;
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html { scroll-behavior: smooth; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--fb);
  font-weight: 400;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
  overscroll-behavior-y: none;
}
button { font-family: inherit; color: inherit; cursor: pointer; border: none; background: none; }
a { color: inherit; text-decoration: none; }
img, svg { display: block; }
input { font-family: inherit; }
::selection { background: var(--teal); color: #fff; }

/* ---- App frame ---- */
#app {
  max-width: var(--maxw);
  margin: 0 auto;
  min-height: 100svh;
  background: var(--bg);
  position: relative;
  display: flex;
  flex-direction: column;
}
@media (min-width: 481px) {
  body { background: #d7dde0; }
  #app { box-shadow: 0 0 50px rgba(13,23,25,.14); }
}

/* ---- Top bar ---- */
.topbar {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between;
  padding: calc(env(safe-area-inset-top) + .7rem) 1.1rem .7rem;
  background: rgba(255,255,255,0.82);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--hair);
}
.brand { display: flex; align-items: center; gap: .55rem; }
.brand img { width: 34px; height: 34px; border-radius: 9px; box-shadow: var(--sh-1); }
.brand-text { font-family: var(--fd); line-height: .95; }
.brand-text b { font-size: 1.02rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; display: block; color: var(--text); }
.brand-text span { font-size: .56rem; font-weight: 700; letter-spacing: .26em; text-transform: uppercase; color: var(--teal); }
.avatar {
  width: 38px; height: 38px; border-radius: 50%;
  display: grid; place-items: center;
  font-family: var(--fd); font-weight: 800; font-size: .85rem; letter-spacing: .03em;
  background: linear-gradient(150deg, var(--teal-l), var(--teal-d));
  color: #fff; box-shadow: var(--sh-1);
}

/* ---- Page ---- */
.page {
  flex: 1;
  padding: 1.1rem 1.1rem calc(var(--nav-h) + env(safe-area-inset-bottom) + 1.6rem);
  animation: fade .32s ease;
}
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.eyebrow {
  font-size: .7rem; font-weight: 700;
  letter-spacing: .12em; text-transform: uppercase; color: var(--teal);
  margin-bottom: .3rem;
}
h1.page-h {
  font-weight: 800; font-size: 2.1rem; line-height: 1.02; letter-spacing: -0.02em;
  margin-bottom: 1.1rem; color: var(--text);
}
h1.page-h em { color: var(--teal); font-style: normal; }
.section-h {
  font-weight: 700; font-size: 1.12rem; letter-spacing: -0.01em;
  margin: 1.6rem 0 .8rem; display: flex; align-items: center; justify-content: space-between;
}
.section-h a, .section-h button { font-size: .82rem; font-weight: 600; color: var(--teal); }

/* ---- Cards ---- */
.card {
  background: var(--surface);
  border: 1px solid var(--hair);
  border-radius: 18px;
  padding: 1.1rem;
  box-shadow: var(--sh-2);
}
.card + .card { margin-top: .8rem; }
.card.tealtop { border-top: none; }

/* ---- Buttons (iOS filled) ---- */
.btn {
  font-weight: 600; font-size: .98rem; letter-spacing: -0.01em;
  padding: .85rem 1.2rem; border-radius: 14px;
  background: var(--teal); color: #fff; width: 100%;
  display: inline-flex; align-items: center; justify-content: center; gap: .45rem;
  transition: transform .08s ease, filter .2s, background .2s;
  box-shadow: 0 1px 2px rgba(45,110,126,.3);
}
.btn:active { transform: scale(.97); }
.btn:hover { filter: brightness(1.06); }
.btn.gold { background: linear-gradient(180deg, #d4b35a, var(--gold)); color: #2a2208; box-shadow: 0 1px 2px rgba(201,168,76,.35); }
.btn.ghost { background: var(--teal-tint); color: var(--teal); box-shadow: none; }
.btn.ghost:hover { background: rgba(45,110,126,.16); filter: none; }
.btn.sm { width: auto; padding: .55rem 1rem; font-size: .85rem; border-radius: 11px; }

.pill {
  display: inline-flex; align-items: center; gap: .3rem;
  font-size: .68rem; font-weight: 700; letter-spacing: .03em;
  padding: .3rem .6rem; border-radius: 100px;
  background: var(--teal-tint); color: var(--teal);
}
.pill.gold { background: var(--gold-tint); color: var(--gold-ink); }
.pill.good { background: rgba(46,158,99,.14); color: var(--good); }
.pill.muted { background: rgba(13,23,25,.05); color: var(--muted); }

/* ---- Progress ring ---- */
.ring { position: relative; display: grid; place-items: center; }
.ring svg { transform: rotate(-90deg); }
.ring .ring-bg { stroke: rgba(13,23,25,.08); }
.ring .ring-fg { stroke-linecap: round; transition: stroke-dashoffset .7s cubic-bezier(.3,.9,.3,1); }
.ring-center { position: absolute; text-align: center; line-height: 1; }
.ring-center b { font-family: var(--fd); font-weight: 800; font-size: 1.4rem; display: block; color: var(--text); }
.ring-center span { font-size: .58rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }

/* ---- Linear bar ---- */
.bar { height: 9px; border-radius: 100px; background: rgba(13,23,25,.08); overflow: hidden; }
.bar > i { display: block; height: 100%; border-radius: 100px; background: linear-gradient(90deg, var(--teal-d), var(--teal-l)); }
.bar.gold > i { background: linear-gradient(90deg, var(--gold), #ddc06a); }

/* ---- Home greeting ---- */
.greet { margin-bottom: 1.1rem; }
.greet h2 { font-weight: 800; font-size: 1.95rem; letter-spacing: -0.02em; line-height: 1.02; color: var(--text); }
.greet p { color: var(--muted); font-size: .9rem; margin-top: .25rem; }

/* metric grid */
.metric-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .8rem; }
.metric { display: flex; align-items: center; gap: .85rem; }
.metric .meta { min-width: 0; }
.metric .meta b { font-family: var(--fd); font-size: 1.55rem; font-weight: 800; display: block; line-height: 1; }
.metric .meta span { font-size: .68rem; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; font-weight: 600; }

/* macro rows */
.macro-row { display: flex; align-items: center; gap: .7rem; margin-top: .75rem; }
.macro-row .lbl { width: 66px; font-size: .78rem; color: var(--ink-2); font-weight: 500; }
.macro-row .bar { flex: 1; }
.macro-row .val { width: 80px; text-align: right; font-size: .76rem; font-variant-numeric: tabular-nums; color: var(--muted); }
.macro-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; margin-right: 5px; }

/* today's session hero */
.session-hero {
  position: relative; overflow: hidden; color: #fff;
  border: none;
  background: linear-gradient(150deg, #357d8f 0%, var(--teal) 55%, var(--teal-d) 100%);
  box-shadow: 0 10px 28px rgba(45,110,126,.3);
}
.session-hero .ring-center b, .session-hero h3 { color: #fff; }
.session-hero .muted { color: rgba(255,255,255,.78) !important; }
.session-hero .grid-bg {
  position: absolute; inset: 0; opacity: .5; pointer-events: none;
  background-image: linear-gradient(rgba(255,255,255,.08) 1px, transparent 1px),
                    linear-gradient(90deg, rgba(255,255,255,.08) 1px, transparent 1px);
  background-size: 34px 34px;
}
.session-hero > * { position: relative; }
.session-hero .pill.gold { background: rgba(255,255,255,.92); color: var(--teal-d); }
.session-hero .pill.muted { background: rgba(255,255,255,.18); color: #fff; }
.session-hero .btn { background: #fff; color: var(--teal-d); box-shadow: 0 2px 10px rgba(0,0,0,.12); }

/* ---- Training: day strip ---- */
.day-strip { display: flex; gap: .5rem; overflow-x: auto; padding: .2rem 1.1rem .5rem; margin: 0 -1.1rem; scrollbar-width: none; }
.day-strip::-webkit-scrollbar { display: none; }
.day-chip {
  flex: 0 0 auto; width: 60px; border-radius: 15px; padding: .6rem .3rem;
  background: var(--surface); border: 1px solid var(--hair); text-align: center;
  box-shadow: var(--sh-1); transition: border-color .2s, background .2s;
}
.day-chip .dow { font-weight: 700; font-size: .74rem; letter-spacing: .02em; color: var(--muted); }
.day-chip .dot { width: 7px; height: 7px; border-radius: 50%; margin: .45rem auto 0; background: var(--dim); }
.day-chip.completed .dot { background: var(--good); }
.day-chip.today { border-color: transparent; background: var(--teal); box-shadow: 0 4px 12px rgba(45,110,126,.3); }
.day-chip.today .dow { color: #fff; }
.day-chip.today .dot { background: rgba(255,255,255,.9); }
.day-chip.rest .dot { background: transparent; border: 1px solid var(--dim); }

/* day list rows */
.day-row { display: flex; align-items: center; gap: .9rem; padding: .85rem 0; border-bottom: 1px solid var(--hair); }
.day-row:last-child { border-bottom: none; }
.day-badge {
  width: 46px; height: 46px; border-radius: 13px; flex: 0 0 auto;
  display: grid; place-items: center; font-family: var(--fd); font-weight: 800;
  background: var(--teal-tint); color: var(--teal); font-size: .9rem; letter-spacing: .03em;
}
.day-row .grow { flex: 1; min-width: 0; }
.day-row h4 { font-weight: 700; font-size: 1rem; letter-spacing: -0.01em; }
.day-row p { font-size: .78rem; color: var(--muted); }
.chev { color: var(--dim); display: grid; }

/* ---- Exercise / set logging ---- */
.exercise { border: 1px solid var(--hair); border-radius: 16px; overflow: hidden; margin-bottom: .8rem; background: var(--surface); box-shadow: var(--sh-2); }
.exercise-head { display: flex; align-items: center; gap: .8rem; padding: .9rem 1rem; background: var(--surface-2); border-bottom: 1px solid var(--hair); }
.exercise-head .grow { flex: 1; min-width: 0; }
.exercise-head h4 { font-weight: 700; font-size: 1.05rem; letter-spacing: -0.01em; line-height: 1.1; }
.exercise-head .sub { font-size: .74rem; color: var(--muted); margin-top: .15rem; }
.vid-btn {
  flex: 0 0 auto; width: 40px; height: 40px; border-radius: 11px;
  background: var(--teal); color: #fff; display: grid; place-items: center;
  box-shadow: 0 2px 6px rgba(45,110,126,.3);
}
.vid-btn:hover { filter: brightness(1.08); }
.ex-note { font-size: .8rem; color: var(--ink-2); padding: .7rem 1rem; border-bottom: 1px solid var(--hair); display: flex; gap: .45rem; background: var(--surface-2); }
.ex-note b { color: var(--gold-ink); font-weight: 700; }

.set-row { display: flex; align-items: center; gap: .55rem; padding: .6rem 1rem; border-bottom: 1px solid var(--hair); }
.set-row:last-child { border-bottom: none; }
.set-num {
  width: 26px; height: 26px; border-radius: 8px; flex: 0 0 auto;
  display: grid; place-items: center; font-family: var(--fd); font-weight: 800; font-size: .82rem;
  background: var(--bg2); color: var(--muted);
}
.set-target { flex: 1; min-width: 0; font-size: .78rem; color: var(--muted); }
.set-target b { display: block; color: var(--text); font-size: .84rem; font-weight: 600; }
.set-input { width: 52px; }
.set-input input {
  width: 100%; text-align: center; background: var(--surface-2); color: var(--text);
  border: 1px solid var(--border); border-radius: 9px; padding: .45rem .2rem;
  font-family: var(--fd); font-weight: 800; font-size: 1rem;
}
.set-input input:focus { outline: none; border-color: var(--teal); background: #fff; box-shadow: 0 0 0 3px var(--teal-tint); }
.set-input .cap { font-size: .54rem; text-align: center; color: var(--dim); text-transform: uppercase; letter-spacing: .06em; margin-top: 2px; font-weight: 600; }
.set-check {
  width: 32px; height: 32px; border-radius: 9px; flex: 0 0 auto;
  border: 2px solid var(--border); background: var(--surface-2); display: grid; place-items: center; color: transparent;
  transition: all .15s;
}
.set-check.done { background: var(--good); border-color: var(--good); color: #fff; }

.rest-tag { font-size: .72rem; color: var(--muted); padding: .55rem 1rem; background: var(--surface-2); font-weight: 600; }

/* ---- Goals ---- */
.goal { display: flex; align-items: center; gap: .9rem; }
.goal .gi { font-size: 1.4rem; width: 46px; height: 46px; border-radius: 13px; background: var(--surface-2); display: grid; place-items: center; border: 1px solid var(--hair); flex: 0 0 auto; }
.goal .grow { flex: 1; min-width: 0; }
.goal h4 { font-size: .92rem; font-weight: 600; }
.goal .gmeta { display: flex; justify-content: space-between; font-size: .76rem; color: var(--muted); margin: .3rem 0 .4rem; font-variant-numeric: tabular-nums; }
.goal .gmeta b { color: var(--gold-ink); font-weight: 700; }

/* ---- Steps chart ---- */
.chart { display: flex; align-items: flex-end; gap: .5rem; height: 120px; padding-top: .5rem; }
.chart .col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: .4rem; height: 100%; justify-content: flex-end; }
.chart .col .b { width: 100%; max-width: 26px; border-radius: 7px; background: linear-gradient(180deg, var(--teal-l), var(--teal)); min-height: 5px; transition: height .5s; }
.chart .col.today .b { background: linear-gradient(180deg, #ddc06a, var(--gold)); }
.chart .col .d { font-size: .62rem; color: var(--muted); text-transform: uppercase; font-weight: 600; }

/* ---- Line chart ---- */
.linechart { width: 100%; height: 130px; }
.linechart .ln { fill: none; stroke: var(--teal); stroke-width: 2.5; }
.linechart .ar { fill: url(#wgrad); }
.linechart .pt { fill: var(--gold); stroke: #fff; stroke-width: 1.5; }

/* ---- Feed ---- */
.feed-card { padding: 0; overflow: hidden; }
.feed-top { display: flex; align-items: center; gap: .6rem; padding: .85rem 1rem .6rem; }
.feed-top .av { width: 34px; height: 34px; border-radius: 50%; background: linear-gradient(150deg, var(--teal-l), var(--teal-d)); display: grid; place-items: center; font-family: var(--fd); font-weight: 800; font-size: .74rem; color: #fff; }
.feed-top .who b { font-size: .85rem; font-weight: 600; }
.feed-top .who span { font-size: .72rem; color: var(--muted); }
.feed-thumb {
  position: relative; aspect-ratio: 16/9; display: grid; place-items: center;
  background: linear-gradient(150deg, #357d8f, var(--teal-d));
  border-top: 1px solid var(--hair); border-bottom: 1px solid var(--hair);
}
.feed-thumb .play { width: 58px; height: 58px; border-radius: 50%; background: rgba(255,255,255,.92); display: grid; place-items: center; color: var(--teal-d); box-shadow: 0 4px 14px rgba(0,0,0,.18); }
.feed-thumb .play svg { margin-left: 3px; }
.feed-thumb .dur { position: absolute; bottom: .6rem; right: .6rem; font-size: .68rem; color: #fff; background: rgba(0,0,0,.45); padding: .2rem .45rem; border-radius: 6px; font-variant-numeric: tabular-nums; backdrop-filter: blur(4px); }
.feed-thumb .ico { font-size: 2.8rem; }
.feed-body { padding: .85rem 1rem 1rem; }
.feed-body h4 { font-weight: 700; font-size: 1.08rem; letter-spacing: -0.01em; line-height: 1.15; margin-bottom: .35rem; }
.feed-body p { font-size: .86rem; color: var(--ink-2); }
.feed-actions { display: flex; gap: 1.4rem; padding-top: .8rem; margin-top: .3rem; border-top: 1px solid var(--hair); }
.feed-actions button { display: flex; align-items: center; gap: .35rem; font-size: .82rem; font-weight: 500; color: var(--muted); padding-top: .6rem; }
.feed-actions button.liked { color: var(--gold-ink); }

/* ---- Profile ---- */
.profile-head { display: flex; align-items: center; gap: 1rem; }
.profile-head .pav { width: 66px; height: 66px; border-radius: 50%; background: linear-gradient(150deg, var(--teal-l), var(--teal-d)); display: grid; place-items: center; font-family: var(--fd); font-weight: 800; font-size: 1.5rem; color: #fff; box-shadow: var(--sh-1); }
.profile-head h2 { font-weight: 800; font-size: 1.5rem; letter-spacing: -0.02em; line-height: 1; }
.profile-head p { color: var(--muted); font-size: .84rem; margin-top: .25rem; }
.list-row { display: flex; align-items: center; gap: .9rem; padding: .95rem 0; border-bottom: 1px solid var(--hair); }
.list-row:last-child { border-bottom: none; }
.list-row .ico { width: 22px; display: grid; place-items: center; color: var(--teal); }
.list-row .grow { flex: 1; }
.list-row .grow b { font-size: .92rem; font-weight: 500; display: block; }
.list-row .grow span { font-size: .76rem; color: var(--muted); }

/* ---- Bottom tab bar ---- */
.tabbar {
  position: fixed; bottom: 0; left: 50%; transform: translateX(-50%);
  width: 100%; max-width: var(--maxw); z-index: 60;
  display: flex; justify-content: space-around;
  padding: .45rem .4rem calc(env(safe-area-inset-bottom) + .4rem);
  background: rgba(255,255,255,0.86);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-top: 1px solid var(--hair);
}
.tab { flex: 1; display: flex; flex-direction: column; align-items: center; gap: .15rem; padding: .35rem 0; color: var(--dim); transition: color .2s; }
.tab svg { width: 24px; height: 24px; }
.tab span { font-size: .62rem; font-weight: 600; letter-spacing: .01em; }
.tab.active { color: var(--teal); }
.tab.active .train-accent { color: var(--teal); }

/* ---- Sheet ---- */
.sheet-backdrop {
  position: fixed; inset: 0; z-index: 100; background: rgba(13,23,25,.4);
  backdrop-filter: blur(2px);
  display: flex; align-items: flex-end; justify-content: center;
  opacity: 0; pointer-events: none; transition: opacity .25s;
}
.sheet-backdrop.open { opacity: 1; pointer-events: auto; }
.sheet {
  width: 100%; max-width: var(--maxw); background: var(--surface);
  border-radius: 22px 22px 0 0;
  padding: 1rem 1.1rem calc(env(safe-area-inset-bottom) + 1.4rem);
  transform: translateY(100%); transition: transform .32s cubic-bezier(.2,.8,.2,1);
  max-height: 85svh; overflow-y: auto; box-shadow: 0 -10px 40px rgba(13,23,25,.18);
}
.sheet-backdrop.open .sheet { transform: none; }
.sheet-grip { width: 38px; height: 5px; border-radius: 100px; background: var(--border); margin: 0 auto .9rem; }
.sheet h3 { font-weight: 800; font-size: 1.35rem; letter-spacing: -0.02em; margin-bottom: .15rem; }

.qa-item { display: flex; align-items: center; gap: .8rem; padding: .8rem 0; border-bottom: 1px solid var(--hair); }
.qa-item:last-child { border-bottom: none; }
.qa-item .grow { flex: 1; min-width: 0; }
.qa-item b { font-size: .9rem; font-weight: 600; display: block; }
.qa-item span { font-size: .74rem; color: var(--muted); display: block; margin-top: 1px; }
.qa-add { width: 36px; height: 36px; border-radius: 10px; background: var(--teal); border: none; color: #fff; display: grid; place-items: center; flex: 0 0 auto; box-shadow: 0 2px 6px rgba(45,110,126,.3); }

/* ---- Misc ---- */
.muted { color: var(--muted); }
.tabular { font-variant-numeric: tabular-nums; }
.center { text-align: center; }
.row { display: flex; align-items: center; gap: .6rem; }
.between { display: flex; align-items: center; justify-content: space-between; }
.divider { height: 1px; background: var(--hair); margin: 1rem 0; }
.toast {
  position: fixed; bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 1rem); left: 50%; transform: translateX(-50%) translateY(20px);
  background: var(--text); color: #fff; padding: .75rem 1.3rem; border-radius: 100px;
  font-weight: 600; font-size: .88rem;
  z-index: 200; opacity: 0; transition: all .3s; box-shadow: var(--sh-3); white-space: nowrap;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.empty { text-align: center; color: var(--muted); padding: 2.5rem 1rem; }
.empty .big { font-size: 2.6rem; margin-bottom: .5rem; }

/* install banner */
.install-banner { display: flex; align-items: center; gap: .8rem; background: var(--teal-tint); border-radius: 16px; padding: .85rem 1rem; margin-bottom: 1rem; }
.install-banner .grow { flex: 1; }
.install-banner b { font-size: .95rem; font-weight: 700; }
.install-banner p { font-size: .76rem; color: var(--muted); }
