/* ═══ helfy brand tokens ══════════════════════════════════════════════════
   Palette, type scale and UI elements taken from the helfy Brand Guide v1.0.
   Deep Teal is primary · Helfy Pink adds warmth · Teal is for accents and data
   · Off White is background/surface · Stone is secondary text and dividers.   */
:root {
  --deep-teal: #0C2F2F;
  --teal:      #155555;
  --pink:      #F7C9CD;
  --off-white: #F6F5F2;
  --stone:     #8A938E;

  --pink-deep: #E9A7AD;          /* pink darkened for text on light surfaces (contrast) */
  --ink:       #0C2F2F;
  --surface:   #FFFFFF;
  --line:      #E2E0DA;
  --alert:     #C4564C;          /* functional only — not a brand colour */

  --r-card: 18px;
  --r-pill: 999px;
  --shadow: 0 2px 10px rgba(12, 47, 47, .06);
  --tabbar-h: 62px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--off-white);
  color: var(--ink);
  font: 400 16px/1.5 Poppins, "Segoe UI", system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
}

h1 { font: 700 30px/1.17 Poppins, inherit; margin: 0; letter-spacing: -.4px; }
h2 { font: 600 19px/1.25 Poppins, inherit; margin: 0; }
h3 { font: 500 17px/1.3 Poppins, inherit; margin: 0; }
p  { margin: 0; }
small, .small { font-size: 12px; line-height: 1.33; }
.muted { color: var(--stone); }

/* ═══ shell ═══════════════════════════════════════════════════════════════ */
.app { max-width: 520px; margin: 0 auto; min-height: 100vh; }

.topbar {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; gap: 9px;
  padding: 14px 20px 12px;
  background: var(--deep-teal);
  color: var(--off-white);
}
.topbar .brand { height: 25px; width: auto; display: block; }
.topbar .tagline { font-size: 11px; color: var(--pink); opacity: .8; align-self: flex-end; padding-bottom: 3px; }
.topbar .spacer { flex: 1; }
.topbar .today {
  font-size: 12px; font-weight: 500; color: var(--off-white);
  background: rgba(255, 255, 255, .1);
  border-radius: var(--r-pill); padding: 4px 11px;
}

main { padding: 16px 20px calc(var(--tabbar-h) + 28px); }
.view { display: flex; flex-direction: column; gap: 14px; }
.view[hidden] { display: none; }   /* a class beats the UA [hidden] rule, so restate it */

/* ═══ cards, buttons, meters ══════════════════════════════════════════════ */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  padding: 16px;
  box-shadow: var(--shadow);
}
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.chip {
  font-size: 12px; font-weight: 500; color: var(--teal);
  background: rgba(21, 85, 85, .08);
  border-radius: var(--r-pill); padding: 4px 10px;
}

.btn {
  display: inline-block; font: 500 15px/1 Poppins, inherit;
  padding: 12px 20px; border-radius: var(--r-pill);
  border: 1.5px solid transparent; cursor: pointer;
  text-decoration: none; text-align: center; white-space: nowrap;
}
.btn.primary { background: var(--pink); color: var(--deep-teal); }
.btn.primary:hover { background: #FBD9DC; }
.btn.ghost { background: transparent; color: var(--deep-teal); border-color: var(--deep-teal); }
.btn.ghost:hover { background: rgba(12, 47, 47, .05); }
.btn.ghost.danger { color: var(--alert); border-color: var(--alert); width: 100%; margin-top: 6px; }
.btn.ghost.danger:hover { background: rgba(196, 86, 76, .07); }

button.ghost {
  font: 500 22px/1 Poppins, inherit; color: var(--deep-teal);
  background: none; border: 0; cursor: pointer;
  padding: 2px 12px; border-radius: var(--r-pill);
}
button.ghost:hover { background: rgba(12, 47, 47, .06); }

.meter { height: 8px; border-radius: var(--r-pill); background: rgba(21, 85, 85, .12); overflow: hidden; }
.meter i { display: block; height: 100%; background: var(--teal); border-radius: inherit; transition: width .3s; }

/* ═══ home ════════════════════════════════════════════════════════════════ */
.hero {
  position: relative; overflow: hidden;
  background: var(--deep-teal); color: var(--off-white);
  border-radius: var(--r-card); padding: 22px 20px 20px;
  min-height: 186px;
}
.hero-copy { position: relative; z-index: 1; max-width: 63%; }
.hero h1 { color: var(--off-white); font-size: 25px; }
.hero p { color: var(--pink); font-size: 13px; margin-top: 8px; }
/* Cut-out figure — the source white ground is keyed to alpha, so it sits on the teal. */
.hero-art {
  position: absolute; right: -8px; bottom: -6px;
  height: 176px; width: auto;
}

.activity .goal { font-size: 14px; margin-bottom: 10px; }
.activity .goal b { font-size: 17px; font-weight: 600; }

.tiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.tiles.flat { gap: 10px; }
.tile {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 13px; padding: 11px 8px; text-align: center;
}
.tiles.flat .tile { border-color: transparent; background: rgba(21, 85, 85, .06); }
.tile b { display: block; font: 600 20px/1.1 Poppins, inherit; font-variant-numeric: tabular-nums; }
.tile span { display: block; margin-top: 3px; font-size: 10.5px; line-height: 1.25; color: var(--stone); }

.cta { display: flex; align-items: center; gap: 14px; }
.cta h3 { margin-bottom: 4px; }
.cta p { font-size: 12.5px; }
.cta .btn { flex: none; }

.last { font-size: 12.5px; color: var(--stone); text-align: center; padding: 2px 10px; }

/* ═══ calendar ════════════════════════════════════════════════════════════ */
.dow, .grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.dow { margin-bottom: 6px; }
.dow span { text-align: center; font-size: 11px; font-weight: 500; color: var(--stone); }
.day {
  aspect-ratio: 1; display: flex; align-items: center; justify-content: center;
  font-size: 13.5px; border-radius: 50%; font-variant-numeric: tabular-nums;
}
.day.is-done { background: var(--pink); color: var(--deep-teal); font-weight: 600; }
.day.is-today { outline: 1.5px solid var(--teal); outline-offset: -1.5px; font-weight: 600; }
.legend { display: flex; align-items: center; gap: 7px; margin-top: 12px; font-size: 12px; color: var(--stone); }
.legend .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--pink); }

.history { list-style: none; margin: 12px 0 0; padding: 0; }
.history li {
  display: grid; grid-template-columns: auto 1fr auto; align-items: baseline; gap: 10px;
  padding: 9px 0; border-top: 1px solid var(--line); font-size: 13.5px;
}
.history li:first-child { border-top: 0; }
.history li b { font-weight: 600; }
.history li span { color: var(--stone); }
.history li em { font-style: normal; font-size: 12px; color: var(--teal); }
.history li.muted { display: block; color: var(--stone); font-size: 13.5px; }

/* ═══ fitness ═════════════════════════════════════════════════════════════ */
.banner {
  position: relative; overflow: hidden;
  border-radius: var(--r-card); background: var(--deep-teal); color: var(--off-white);
  padding: 20px; display: flex; align-items: center; min-height: 108px;
}
.banner img { position: absolute; right: 0; top: 0; height: 100%; width: auto; opacity: .5; }
.banner > div { position: relative; z-index: 1; max-width: 68%; }
.banner h2 { color: var(--off-white); }
.banner p { color: var(--pink); font-size: 12.5px; margin-top: 5px; }

.workout {
  display: flex; align-items: center; gap: 13px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-card); padding: 14px 16px;
  text-decoration: none; color: inherit;
}
.workout.live:hover { border-color: var(--teal); box-shadow: var(--shadow); }
.workout[aria-disabled] { opacity: .55; }
.wicon {
  flex: none; width: 42px; height: 42px; border-radius: 12px;
  display: grid; place-items: center;
  background: rgba(21, 85, 85, .09); color: var(--teal);
}
.workout.live .wicon { background: var(--pink); color: var(--deep-teal); }
.wicon svg { width: 23px; height: 23px; }
.wbody { flex: 1; min-width: 0; }
.wbody b { display: block; font-weight: 600; font-size: 15px; }
.wbody small { display: block; color: var(--stone); margin-top: 2px; }
.wgo { flex: none; font-size: 13px; font-weight: 500; color: var(--teal); }
.wgo.soon {
  font-size: 11px; color: var(--stone);
  background: rgba(138, 147, 142, .14); border-radius: var(--r-pill); padding: 3px 9px;
}

/* ═══ profile ═════════════════════════════════════════════════════════════ */
.profile { display: flex; align-items: center; gap: 14px; }
.avatar {
  width: 54px; height: 54px; border-radius: 50%; padding: 12px;
  background: var(--deep-teal); object-fit: contain;
}
.pref { display: block; font-size: 13px; color: var(--stone); margin-bottom: 14px; }
.pref.row { display: flex; align-items: center; justify-content: space-between; }
.pref input {
  font: 400 15px/1 Poppins, inherit; color: var(--ink);
  border: 1px solid var(--line); border-radius: 11px;
  padding: 10px 12px; margin-top: 6px; width: 100%; background: var(--off-white);
}
.pref.row span { display: flex; align-items: center; gap: 7px; font-size: 13px; color: var(--ink); }
.pref.row input { width: 66px; margin-top: 0; text-align: center; }
.pref input:focus-visible { outline: 2px solid var(--teal); outline-offset: 1px; border-color: transparent; }
.footnote { font-size: 11.5px; color: var(--stone); text-align: center; padding: 0 14px; }

/* ═══ bottom nav ══════════════════════════════════════════════════════════ */
.tabbar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 6;
  height: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  max-width: 520px; margin: 0 auto;
  display: grid; grid-template-columns: repeat(4, 1fr);
  background: var(--deep-teal);
  border-radius: 20px 20px 0 0;
}
.tabbar a {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  text-decoration: none; color: rgba(246, 245, 242, .55); font-size: 10.5px; font-weight: 500;
}
.tabbar a svg { width: 23px; height: 23px; }
.tabbar a.active { color: var(--pink); }
.tabbar a:hover { color: var(--off-white); }
.tabbar a.active:hover { color: var(--pink); }

@media (min-width: 560px) { .tabbar { border-radius: 20px 20px 0 0; } }

/* Windows animation settings mean this fires on this machine — keep it honest. */
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
