/* ───────────────────────── Nats Lifts ─────────────────────────
   Soft blush theme · mobile-first · big touch targets */

:root {
  --bg: #FFF7F5;
  --card: #FFFFFF;
  --ink: #3D2C35;
  --muted: #A08894;
  --line: #F6E4E9;
  --pink: #ED5C86;
  --coral: #FF8E6E;
  --grad: linear-gradient(120deg, #ED5C86, #FF8E6E);
  --grad-soft: linear-gradient(120deg, #FFE3EC, #FFEDE5);
  --green: #4CB98F;
  --amber: #E8A33D;
  --shadow: 0 6px 24px rgba(237, 92, 134, 0.10);
  --radius: 22px;
}

* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html { height: 100%; }
body {
  font-family: 'Outfit', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--ink);
  min-height: 100%;
  padding-bottom: env(safe-area-inset-bottom);
}

#app { max-width: 480px; margin: 0 auto; padding: 18px 18px 90px; }

button { font: inherit; color: inherit; background: none; border: none; cursor: pointer; }
input, select { font: inherit; color: inherit; }
a { color: var(--pink); text-decoration: none; }

/* ── header ── */
.top {
  display: flex; align-items: center; justify-content: space-between;
  padding: 6px 2px 16px;
}
.brand { font-size: 24px; font-weight: 800; letter-spacing: -0.5px; }
.brand .heart { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.top-actions { display: flex; align-items: center; gap: 10px; }
.sync-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--green); display: inline-block; }
.sync-dot.pending { background: var(--amber); }
.sync-dot.offline { background: #C9B6BF; }
.sync-dot.error { background: #E2574C; }

/* ── sync warning bar (says it in words, not just a dot) ── */
.syncbar {
  max-width: 480px; margin: 0 auto; padding: 12px 14px;
  display: flex; align-items: center; gap: 10px;
  background: #FFF1E2; color: #7A4B18; border-bottom: 1px solid #F6DCC0;
  font-size: 13px; line-height: 1.35; font-weight: 500;
}
.syncbar span { flex: 1; }
.syncbar button {
  flex: none; padding: 8px 12px; border-radius: 12px; font-size: 13px;
  font-weight: 700; background: #7A4B18; color: #fff;
}
.warn-card {
  background: #FFF1E2; color: #7A4B18; border: 1px solid #F6DCC0;
  border-radius: var(--radius); padding: 14px 16px; margin-bottom: 14px;
  font-size: 14px; line-height: 1.4; font-weight: 500;
}
.icon-btn {
  width: 42px; height: 42px; border-radius: 14px; background: var(--card);
  box-shadow: var(--shadow); font-size: 18px; display: grid; place-items: center;
}

/* ── back row ── */
.back-row { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.back-btn {
  width: 40px; height: 40px; border-radius: 13px; background: var(--card);
  box-shadow: var(--shadow); font-size: 17px; display: grid; place-items: center; flex: none;
}
.back-row h1 { font-size: 21px; font-weight: 800; line-height: 1.15; }
.back-row .sub { font-size: 13px; color: var(--muted); font-weight: 500; }
.back-row .grow { flex: 1; min-width: 0; }
.pill-btn {
  padding: 9px 15px; border-radius: 999px; background: var(--card); box-shadow: var(--shadow);
  font-weight: 700; font-size: 13.5px; color: var(--pink); flex: none;
}

/* ── hero (home) ── */
.hero {
  background: var(--grad); border-radius: var(--radius); padding: 20px;
  color: #fff; box-shadow: 0 10px 28px rgba(237, 92, 134, 0.30); margin-bottom: 20px;
}
.hero .hi { font-size: 20px; font-weight: 800; }
.hero .date { font-size: 13px; opacity: 0.9; margin-top: 2px; font-weight: 500; }
.hero .msg { font-size: 13.5px; font-weight: 600; margin-top: 10px; opacity: 0.96; line-height: 1.35; }
.hero .stats { display: flex; gap: 18px; margin-top: 16px; }
.hero .stat { flex: 1; }
.hero .stat b { display: block; font-size: 22px; font-weight: 800; line-height: 1; }
.hero .stat span { font-size: 11.5px; opacity: 0.9; font-weight: 500; }
.weekbar { margin-top: 16px; }
.weekbar .lbl { display: flex; justify-content: space-between; font-size: 12px; font-weight: 600; margin-bottom: 6px; }
.bar { height: 10px; border-radius: 999px; background: rgba(255,255,255,0.28); overflow: hidden; }
.bar > i { display: block; height: 100%; border-radius: 999px; background: #fff; transition: width 0.6s cubic-bezier(.2,.8,.2,1); }

/* ── lifting power (combined strength + fun comparison) ── */
.power {
  display: block; width: 100%; text-align: center;
  background: var(--grad-soft); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 18px 18px 16px; margin-bottom: 20px;
}
.power:active { transform: scale(0.99); }
.power-top { font-size: 13px; font-weight: 800; color: #8A5A6C; letter-spacing: 0.2px; }
.power-num { font-size: 40px; font-weight: 800; color: var(--pink); line-height: 1.05; margin: 4px 0 2px; }
.power-num span { font-size: 18px; font-weight: 700; margin-left: 3px; }
.power-sub { font-size: 13.5px; font-weight: 700; color: #8A5A6C; line-height: 1.4; }
.power .spark { display: block; width: 100%; height: auto; margin: 12px 0 2px; }
.power-foot { font-size: 11.5px; font-weight: 700; color: var(--pink); margin-top: 8px; }

/* ── last-trained hint on day cards ── */
.last-ago {
  font-size: 11.5px; font-weight: 700; color: var(--muted); background: var(--line);
  padding: 4px 9px; border-radius: 999px; flex: none; white-space: nowrap;
}

/* ── personal-bests shelf ── */
.pr-medal { font-size: 20px; flex: none; }
.pr-date { display: block; font-size: 12px; font-weight: 600; color: var(--muted); margin-top: 1px; }

/* ── monthly recap ── */
.recap {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 16px 18px; margin-bottom: 20px;
}
.recap-title { font-size: 14px; font-weight: 800; color: var(--ink); margin-bottom: 12px; }
.recap-stats { display: flex; gap: 10px; }
.recap-stats > div { flex: 1; text-align: center; background: var(--grad-soft); border-radius: 15px; padding: 11px 6px; }
.recap-stats b { display: block; font-size: 20px; font-weight: 800; line-height: 1.1; color: var(--pink); }
.recap-stats span { font-size: 11px; font-weight: 600; color: var(--muted); }
.recap-vol { margin-top: 12px; font-size: 13.5px; font-weight: 600; color: #8A5A6C; text-align: center; line-height: 1.4; }
.recap-vol b { color: var(--pink); font-weight: 800; }

/* ── day cards ── */
.day-card {
  display: flex; align-items: center; gap: 14px; width: 100%; text-align: left;
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 16px; margin-bottom: 12px; border: 2px solid transparent; position: relative;
}
.day-card.today { border-color: var(--pink); }
.day-card .emoji {
  width: 52px; height: 52px; border-radius: 17px; background: var(--grad-soft);
  display: grid; place-items: center; font-size: 24px; flex: none;
}
.day-card .info { flex: 1; min-width: 0; }
.day-card .dayname { font-size: 11.5px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 0.8px; }
.day-card .focus { font-size: 17.5px; font-weight: 800; margin: 1px 0 3px; }
.day-card .meta { font-size: 13px; color: var(--muted); font-weight: 500; }
.day-card .done-tick { font-size: 20px; flex: none; }
.today-chip {
  position: absolute; top: -9px; right: 16px; background: var(--grad); color: #fff;
  font-size: 10.5px; font-weight: 800; letter-spacing: 0.6px; padding: 3px 10px;
  border-radius: 999px; text-transform: uppercase;
}
.chev { color: #DCC5CE; font-size: 18px; flex: none; }

/* ── done banner (undo a logged workout) ── */
.done-banner {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  background: #EAF7F0; color: var(--green); border-radius: 16px; padding: 12px 16px;
  font-size: 14px; font-weight: 700; margin-bottom: 16px;
}
.done-banner button {
  padding: 7px 15px; border-radius: 999px; background: #fff; color: var(--pink);
  font-weight: 800; font-size: 13px; box-shadow: var(--shadow);
}

/* ── day view ── */
.start-btn {
  display: block; width: 100%; padding: 17px; border-radius: 18px; background: var(--grad);
  color: #fff; font-size: 17px; font-weight: 800; box-shadow: 0 10px 28px rgba(237,92,134,0.30);
  margin-bottom: 18px;
}
.day-note {
  background: var(--grad-soft); border-radius: 16px; padding: 12px 16px; font-size: 13.5px;
  font-weight: 500; color: #8A5A6C; margin-bottom: 16px;
}
.ex-row {
  display: flex; align-items: center; gap: 12px; width: 100%; text-align: left;
  background: var(--card); border-radius: 18px; box-shadow: var(--shadow);
  padding: 14px 16px; margin-bottom: 10px;
}
.ex-row .num {
  width: 30px; height: 30px; border-radius: 10px; background: var(--grad-soft);
  color: var(--pink); font-weight: 800; font-size: 13.5px; display: grid; place-items: center; flex: none;
}
.ex-row .name { flex: 1; font-weight: 600; font-size: 15px; min-width: 0; line-height: 1.3; }
.ex-row .last {
  font-size: 13px; font-weight: 700; color: var(--pink); background: #FFF0F4;
  padding: 5px 10px; border-radius: 999px; flex: none;
}
.ex-row .last.none { color: var(--muted); background: var(--line); font-weight: 600; }
.trend-up { color: var(--green); }
.trend-same, .trend-down { color: var(--amber); }

/* ── session mode ── */
.session-bar {
  position: sticky; top: 10px; z-index: 5; background: var(--card); border-radius: 18px;
  box-shadow: var(--shadow); padding: 13px 16px; margin-bottom: 16px;
}
.session-bar .row1 { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 10px; }
.count-big { font-size: 16px; font-weight: 600; color: var(--ink); }
.count-big b { font-weight: 800; color: var(--pink); font-size: 18px; }
.count-pct { font-size: 15px; font-weight: 800; color: var(--pink); }
.bar.track { background: var(--line); }
.bar.track.big { height: 16px; }
.bar.track > i { background: var(--grad); }
.all-done { margin-top: 10px; text-align: center; font-size: 13px; font-weight: 700; color: var(--green); }
.check {
  width: 34px; height: 34px; border-radius: 50%; border: 2.5px solid #EFD5DD;
  display: grid; place-items: center; font-size: 16px; color: transparent; flex: none;
  transition: all 0.18s;
}
.ex-row.done-ex { opacity: 0.55; }
.ex-row.done-ex .check { background: var(--grad); border-color: transparent; color: #fff; }
.finish-btn {
  display: block; width: 100%; padding: 16px; border-radius: 18px; background: var(--ink);
  color: #fff; font-size: 16px; font-weight: 800; margin-top: 16px;
}
.sess-item { margin-bottom: 6px; }
.cue { font-size: 12.5px; font-weight: 600; color: var(--muted); margin: 3px 4px 0 62px; }
.cue b { color: var(--pink); font-weight: 800; }
.ql-toggle { text-align: right; margin: 4px 4px 10px; }
.ql-toggle button { font-size: 12px; font-weight: 700; color: var(--pink); }
.quicklog {
  display: flex; gap: 7px; margin: 6px 0 4px; padding: 0 4px; align-items: stretch;
}
.quicklog input {
  flex: 1; min-width: 0; padding: 11px 12px; border-radius: 13px; border: 2px solid var(--line);
  background: var(--card); font-weight: 700; font-size: 16px; text-align: center;
}
.quicklog input:focus { outline: none; border-color: var(--pink); }
.quicklog .save {
  padding: 0 16px; border-radius: 13px; background: var(--grad); color: #fff; font-weight: 800;
}

/* ── weight stepper (− input +) ── */
.stepper { display: flex; gap: 8px; align-items: stretch; }
.stepper input {
  flex: 1; min-width: 0; padding: 13px 14px; border-radius: 14px; border: 2px solid var(--line);
  background: #FFFDFD; font-weight: 800; font-size: 18px; width: 100%; text-align: center;
}
.stepper input:focus { outline: none; border-color: var(--pink); }
.step {
  width: 48px; flex: none; border-radius: 14px; background: var(--grad-soft); color: var(--pink);
  font-size: 24px; font-weight: 800; display: grid; place-items: center; line-height: 1;
}
.step:active { background: var(--pink); color: #fff; }
.quicklog .step { width: 42px; font-size: 21px; }
.prefill-hint { font-size: 12px; font-weight: 600; color: var(--muted); text-align: center; margin: 14px 2px 0; line-height: 1.45; }

/* ── exercise view ── */
.pr-card {
  background: var(--grad); color: #fff; border-radius: var(--radius); padding: 18px 20px;
  box-shadow: 0 10px 28px rgba(237,92,134,0.28); margin-bottom: 16px;
  display: flex; align-items: center; gap: 14px;
}
.pr-card .trophy { font-size: 30px; }
.pr-card b { font-size: 21px; font-weight: 800; display: block; }
.pr-card span { font-size: 12.5px; opacity: 0.92; font-weight: 500; }
.card {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 18px; margin-bottom: 16px;
}
.card h3 { font-size: 15px; font-weight: 800; margin-bottom: 12px; }
.log-form { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.log-form .field { display: flex; flex-direction: column; gap: 5px; }
.log-form label { font-size: 11.5px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 0.6px; }
.log-form input {
  padding: 13px 14px; border-radius: 14px; border: 2px solid var(--line); background: #FFFDFD;
  font-weight: 700; font-size: 16px; width: 100%;
}
.log-form input:focus { outline: none; border-color: var(--pink); }
.log-form .full { grid-column: 1 / -1; }
.log-save {
  grid-column: 1 / -1; padding: 15px; border-radius: 15px; background: var(--grad); color: #fff;
  font-weight: 800; font-size: 16px; box-shadow: 0 8px 20px rgba(237,92,134,0.25);
}
.chart-wrap { overflow-x: auto; }
.chart-wrap svg { display: block; width: 100%; height: auto; }
.hist-row {
  display: flex; align-items: center; gap: 10px; padding: 11px 2px;
  border-bottom: 1.5px solid var(--line); font-size: 14.5px;
}
.hist-row:last-child { border-bottom: none; }
.hist-row .d { color: var(--muted); font-weight: 500; width: 84px; flex: none; }
.hist-row .w { font-weight: 800; flex: 1; }
.hist-row .w small { font-weight: 600; color: var(--muted); font-size: 12.5px; }
.hist-row .pr-star { flex: none; }
.hist-row .del { color: #D8BFC9; font-size: 15px; padding: 6px; flex: none; }
.empty { text-align: center; color: var(--muted); font-size: 14px; padding: 22px 10px; font-weight: 500; line-height: 1.5; }

/* ── edit mode ── */
.edit-field { margin-bottom: 14px; }
.edit-field label { display: block; font-size: 11.5px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 0.6px; margin-bottom: 6px; }
.edit-field input {
  width: 100%; padding: 13px 14px; border-radius: 14px; border: 2px solid var(--line);
  background: var(--card); font-weight: 600; font-size: 15px;
}
.edit-field input:focus { outline: none; border-color: var(--pink); }
.edit-mins { display: flex; gap: 10px; }
.edit-ex-row {
  display: flex; align-items: center; gap: 8px; background: var(--card); border-radius: 15px;
  box-shadow: var(--shadow); padding: 10px 12px; margin-bottom: 9px;
}
.edit-ex-row .name { flex: 1; font-weight: 600; font-size: 14.5px; min-width: 0; }
.edit-ex-name {
  flex: 1; min-width: 0; padding: 9px 11px; border-radius: 11px; border: 2px solid var(--line);
  background: #FFFDFD; font-weight: 600; font-size: 14.5px;
}
.edit-ex-name:focus { outline: none; border-color: var(--pink); }
.mini-btn {
  width: 34px; height: 34px; border-radius: 11px; background: var(--grad-soft); color: var(--pink);
  font-size: 14px; font-weight: 800; display: grid; place-items: center; flex: none;
}
.mini-btn:disabled { opacity: 0.3; }
.mini-btn.danger { background: #FFF0F0; color: #E05B5B; }
.add-row { display: flex; gap: 9px; margin-top: 12px; }
.add-row input {
  flex: 1; padding: 13px 14px; border-radius: 14px; border: 2px dashed #EFD5DD;
  background: transparent; font-weight: 600; font-size: 14.5px; min-width: 0;
}
.add-row input:focus { outline: none; border-color: var(--pink); }
.add-row button { padding: 0 18px; border-radius: 14px; background: var(--grad); color: #fff; font-weight: 800; }

/* ── emoji picker (edit day) ── */
.emoji-row { display: flex; flex-wrap: wrap; gap: 8px; }
.emoji-pick {
  width: 44px; height: 44px; border-radius: 13px; background: #FFFDFD; border: 2px solid var(--line);
  font-size: 22px; display: grid; place-items: center; line-height: 1;
}
.emoji-pick.on { border-color: var(--pink); background: var(--grad-soft); transform: scale(1.05); }

/* ── cardio bits ── */
.cardio-tag {
  font-size: 10px; font-weight: 800; color: var(--coral); background: #FFF1EA;
  padding: 2px 7px; border-radius: 999px; text-transform: uppercase; letter-spacing: 0.5px; vertical-align: middle;
}
.quicklog.cardio input {
  flex: 1; min-width: 0; padding: 11px 10px; border-radius: 13px; border: 2px solid var(--line);
  background: var(--card); font-weight: 700; font-size: 16px; text-align: center;
}
.quicklog.cardio input:focus { outline: none; border-color: var(--pink); }
.mini-btn.kind { background: #FFFDFD; border: 2px solid var(--line); font-size: 15px; }
.mini-btn.kind.on { background: #FFF1EA; border-color: var(--coral); }

/* ── template swap + library ── */
.tmpl-wrap { position: relative; display: inline-flex; }
.tmpl-x {
  position: absolute; top: -7px; right: -5px; width: 20px; height: 20px; border-radius: 50%;
  background: #E05B5B; color: #fff; font-size: 11px; font-weight: 800; display: grid; place-items: center;
  box-shadow: 0 2px 6px rgba(0,0,0,0.18);
}
.save-tmpl-btn {
  display: block; width: 100%; margin-top: 13px; padding: 12px; border-radius: 14px;
  background: var(--grad-soft); color: #8A5A6C; font-weight: 800; font-size: 14px;
}
.save-tmpl-btn:active { background: var(--pink); color: #fff; }
.restore-tmpl-btn {
  display: block; width: 100%; margin-top: 9px; padding: 10px; border-radius: 14px;
  background: transparent; color: var(--muted); font-weight: 700; font-size: 13px;
}
.restore-tmpl-btn:active { color: var(--pink); }

.hint-line { font-size: 12.5px; font-weight: 500; color: var(--muted); margin: -6px 0 12px; line-height: 1.4; }
.tmpl-row { display: flex; flex-wrap: wrap; gap: 13px 11px; padding-top: 7px; }
.tmpl-chip {
  padding: 10px 15px; border-radius: 999px; background: var(--grad-soft); color: #8A5A6C;
  font-weight: 700; font-size: 14px; line-height: 1;
}
.tmpl-chip:active { background: var(--pink); color: #fff; }
.lib-btn {
  display: block; width: 100%; padding: 15px; border-radius: 16px; background: var(--grad); color: #fff;
  font-size: 15.5px; font-weight: 800; box-shadow: 0 8px 20px rgba(237, 92, 134, 0.25); margin-bottom: 11px;
}

/* ── exercise picker ── */
.pick-cat { margin-bottom: 18px; }
.pick-cat-title { font-size: 14px; font-weight: 800; color: var(--ink); margin: 0 2px 9px; }
.pick-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.pick-pill {
  padding: 10px 14px; border-radius: 999px; background: var(--card); box-shadow: var(--shadow);
  font-weight: 600; font-size: 13.5px; color: var(--ink); border: 2px solid transparent; line-height: 1.15;
}
.pick-pill.on { background: var(--grad); color: #fff; box-shadow: 0 6px 16px rgba(237, 92, 134, 0.28); font-weight: 700; }

/* ── PIN lock ── */
.lock { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 82vh; text-align: center; }
.lock-heart { font-size: 34px; margin-bottom: 10px; }
.lock-title { font-size: 30px; font-weight: 800; letter-spacing: -0.5px; }
.lock-title .heart { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.lock-sub { font-size: 14px; font-weight: 600; color: var(--muted); margin-top: 8px; min-height: 20px; }
.lock-sub.err { color: var(--pink); }
.pin-dots { display: flex; gap: 16px; margin: 26px 0 30px; }
.pin-dot { width: 15px; height: 15px; border-radius: 50%; border: 2.5px solid #E9C9D3; box-sizing: border-box; transition: all 0.15s; }
.pin-dot.filled { background: var(--grad); border-color: transparent; transform: scale(1.12); }
.pin-dots--key { gap: 7px; }
.pin-dots--key .pin-dot { width: 12px; height: 12px; }
.pin-dots--key .pin-dot:nth-child(4n):not(:last-child) { margin-right: 10px; }
.pin-pad { display: grid; grid-template-columns: repeat(3, 74px); gap: 16px; justify-content: center; }
.pin-key {
  width: 74px; height: 74px; border-radius: 50%; background: var(--card); box-shadow: var(--shadow);
  font-size: 27px; font-weight: 700; color: var(--ink); display: grid; place-items: center;
}
.pin-key:active { background: var(--grad-soft); }
.pin-key.ghost { background: transparent; box-shadow: none; pointer-events: none; }

/* ── settings ── */
.set-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 13px 2px; border-bottom: 1.5px solid var(--line); font-size: 14.5px; font-weight: 600;
}
.set-row:last-child { border-bottom: none; }
.set-row .hint { font-size: 12.5px; color: var(--muted); font-weight: 500; margin-top: 2px; }
.love { text-align: center; color: var(--muted); font-size: 13px; font-weight: 500; padding: 26px 0 6px; }

/* ── toast & confetti ── */
.toast {
  position: fixed; bottom: 26px; left: 50%; transform: translateX(-50%);
  background: var(--ink); color: #fff; padding: 12px 22px; border-radius: 999px;
  font-weight: 700; font-size: 14px; z-index: 60; box-shadow: 0 10px 26px rgba(61,44,53,0.3);
  animation: pop 0.25s cubic-bezier(.2,.8,.3,1.2); max-width: 86vw; text-align: center;
}
@keyframes pop { from { transform: translateX(-50%) translateY(14px); opacity: 0; } }
.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 70; width: 100vw; height: 100vh; }

.fade-in { animation: fade 0.25s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(7px); } }
