/* ============ Tokens ============ */
:root {
  --r-lg: 22px;
  --r-md: 16px;
  --r-sm: 12px;
  --ease: cubic-bezier(.2, .8, .2, 1);
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Inter", "Segoe UI", Roboto, sans-serif;
  --safe-b: env(safe-area-inset-bottom, 0px);
}
[data-theme="dark"] {
  --bg: #0d0e10;
  --surface: #16181b;
  --surface-2: #1e2125;
  --surface-3: #272b30;
  --line: #2a2e34;
  --text: #f3f4f6;
  --muted: #8b919a;
  --faint: #5b616a;
  --accent: #d2ff3a;
  --accent-ink: #0d0e10;
  --accent-text: #d2ff3a;
  --accent-soft: rgba(210, 255, 58, .12);
  --danger: #ff5b4f;
  --danger-soft: rgba(255, 91, 79, .14);
  --info: #5ab0ff;
  --shadow: 0 10px 30px rgba(0, 0, 0, .35);
  --glass: rgba(13, 14, 16, .82);
}
[data-theme="light"] {
  --bg: #f2f3f5;
  --surface: #ffffff;
  --surface-2: #f2f3f6;
  --surface-3: #e7e9ed;
  --line: #e3e5ea;
  --text: #0d0e10;
  --muted: #6b717b;
  --faint: #a2a7b0;
  --accent: #c8f52a;
  --accent-ink: #0d0e10;
  --accent-text: #4b7a00;
  --accent-soft: rgba(120, 170, 0, .12);
  --danger: #e5392c;
  --danger-soft: rgba(229, 57, 44, .1);
  --info: #1d7ff0;
  --shadow: 0 10px 30px rgba(15, 20, 30, .08);
  --glass: rgba(242, 243, 245, .85);
}

/* ============ Base ============ */
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body {
  margin: 0; padding: 0;
  background: var(--bg); color: var(--text);
  font-family: var(--font);
  font-size: 15px; line-height: 1.35;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  overscroll-behavior: none;
}
.hidden { display: none !important; }
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; }
svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.num { font-variant-numeric: tabular-nums; }

.app {
  max-width: 640px; margin: 0 auto;
  padding: 14px 16px calc(110px + var(--safe-b));
}

/* ============ Header ============ */
.head { display: flex; align-items: flex-end; justify-content: space-between; margin: 6px 0 18px; }
.eyebrow { color: var(--muted); font-size: 13px; font-weight: 600; letter-spacing: .02em; }
.h1 { margin: 2px 0 0; font-size: 34px; font-weight: 800; letter-spacing: -.035em; line-height: 1.05; }
.head-actions { display: flex; align-items: center; gap: 10px; }
.icon-btn {
  width: 40px; height: 40px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--surface); border: 1px solid var(--line);
  transition: transform .15s var(--ease);
}
.icon-btn:active { transform: scale(.92); }
.icon-btn svg { width: 20px; height: 20px; }
.icon-btn circle { fill: currentColor; stroke: none; }
.sync { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); opacity: .0; transition: opacity .3s, background .3s; }
.sync.saving { opacity: 1; background: var(--muted); animation: pulse 1s infinite; }
.sync.ok { opacity: .0; }
.sync.error { opacity: 1; background: var(--danger); }
@keyframes pulse { 50% { opacity: .3; } }

/* ============ Cards & controls ============ */
.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-lg); padding: 16px; margin-bottom: 12px;
}
.section-title { font-size: 13px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; margin: 22px 4px 10px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 46px; padding: 0 18px; border-radius: var(--r-md);
  font-weight: 700; font-size: 15px;
  transition: transform .15s var(--ease), opacity .15s;
}
.btn:active { transform: scale(.97); }
.btn svg { width: 18px; height: 18px; stroke-width: 2.6; }
.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-ghost { background: var(--surface-2); color: var(--text); }
.btn-danger { background: var(--danger-soft); color: var(--danger); }
.btn-sm { height: 36px; padding: 0 14px; border-radius: var(--r-sm); font-size: 14px; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .5; }

.field {
  width: 100%; height: 46px; padding: 0 14px;
  background: var(--surface-2); border: 1px solid transparent; border-radius: var(--r-md);
  outline: none; transition: border-color .15s, background .15s;
}
.field:focus { border-color: var(--accent); background: var(--surface); }
.field::placeholder { color: var(--faint); }
textarea.field { height: auto; min-height: 90px; padding: 12px 14px; resize: vertical; }
.search { position: relative; }
.search svg { position: absolute; left: 13px; top: 13px; width: 20px; height: 20px; color: var(--faint); }
.search .field { padding-left: 42px; }

.pill { display: inline-flex; align-items: center; height: 24px; padding: 0 10px; border-radius: 99px; background: var(--surface-2); color: var(--muted); font-size: 12px; font-weight: 600; }

/* ============ Summary strip ============ */
.summary { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 12px; }
.metric { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); padding: 12px; }
.metric-label { color: var(--muted); font-size: 12px; font-weight: 600; }
.metric-value { font-size: 22px; font-weight: 800; letter-spacing: -.02em; margin-top: 4px; font-variant-numeric: tabular-nums; }
.metric-value small { font-size: 13px; font-weight: 700; color: var(--muted); margin-left: 2px; }
.metric.hl { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.metric.hl .metric-label, .metric.hl small { color: rgba(13, 14, 16, .6); }

/* ============ Calendar ============ */
.cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.cal-title { font-size: 17px; font-weight: 800; letter-spacing: -.01em; }
.cal-nav { display: flex; gap: 6px; }
.cal-nav button { width: 34px; height: 34px; border-radius: 50%; background: var(--surface-2); display: grid; place-items: center; }
.cal-nav svg { width: 18px; height: 18px; }
.cal-week, .cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal-week div { text-align: center; font-size: 11px; font-weight: 700; color: var(--faint); padding-bottom: 6px; text-transform: uppercase; }
.cal-day { aspect-ratio: 1; display: grid; place-items: center; }
.cal-day span {
  width: 36px; height: 36px; border-radius: 50%;
  display: grid; place-items: center;
  font-size: 14px; font-weight: 600; font-variant-numeric: tabular-nums;
  color: var(--text); transition: transform .15s var(--ease);
}
.cal-day.out span { color: var(--faint); }
.cal-day.today span { box-shadow: inset 0 0 0 1.5px var(--muted); }
.cal-day.has span { background: var(--accent); color: var(--accent-ink); font-weight: 800; box-shadow: none; }
.cal-day.has:active span { transform: scale(.88); }
.cal-day.multi span { position: relative; }
.cal-day.multi span::after { content: ""; position: absolute; bottom: 4px; width: 4px; height: 4px; border-radius: 50%; background: var(--accent-ink); }

/* ============ Swipe rows ============ */
.swipe { position: relative; overflow: hidden; border-radius: var(--r-md); touch-action: pan-y; }
.swipe + .swipe { margin-top: 8px; }
.swipe-bg {
  position: absolute; inset: 0; display: flex; align-items: center;
  padding: 0 20px; font-weight: 700; font-size: 14px; opacity: 0; pointer-events: none;
  border-radius: var(--r-md);
}
.swipe-bg svg { width: 20px; height: 20px; }
.swipe-bg.left { background: var(--danger); color: #fff; justify-content: flex-end; gap: 8px; }
.swipe-bg.right { background: var(--info); color: #fff; justify-content: flex-start; gap: 8px; }
.swipe-fg { position: relative; z-index: 1; will-change: transform; }

/* ============ Workout list ============ */
.w-item {
  display: flex; align-items: center; gap: 14px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md);
  padding: 12px 14px; transition: transform .15s var(--ease);
}
.w-item:active { transform: scale(.985); }
.w-date {
  flex: 0 0 48px; height: 52px; border-radius: 13px;
  background: var(--surface-2);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.w-date b { font-size: 20px; font-weight: 800; line-height: 1; letter-spacing: -.02em; }
.w-date i { font-style: normal; font-size: 10px; font-weight: 700; color: var(--muted); text-transform: uppercase; margin-top: 3px; }
.w-item.recent .w-date { background: var(--accent-soft); color: var(--accent-text); }
.w-main { flex: 1; min-width: 0; }
.w-title { font-weight: 700; font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.w-meta { color: var(--muted); font-size: 13px; margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chev { color: var(--faint); width: 18px; height: 18px; flex: 0 0 auto; }
.month-label { font-size: 13px; font-weight: 700; color: var(--muted); margin: 18px 4px 8px; }
.month-label:first-child { margin-top: 4px; }

.empty { text-align: center; padding: 34px 12px; color: var(--muted); }
.empty-icon { width: 64px; height: 64px; border-radius: 20px; background: var(--accent-soft); color: var(--accent-text); display: grid; place-items: center; margin: 0 auto 14px; }
.empty-icon svg { width: 30px; height: 30px; }
.empty b { display: block; color: var(--text); font-size: 17px; margin-bottom: 6px; }

/* ============ Workout screen ============ */
.w-head { display: flex; align-items: center; gap: 10px; margin: 2px 0 6px; }
.title-input {
  flex: 1; min-width: 0; border: 0; outline: none; background: none;
  font-size: 28px; font-weight: 800; letter-spacing: -.03em; padding: 4px 0;
}
.title-input::placeholder { color: var(--faint); }
.date-chip {
  position: relative; display: inline-flex; align-items: center; gap: 6px;
  height: 32px; padding: 0 12px; border-radius: 99px;
  background: var(--surface); border: 1px solid var(--line);
  font-size: 13px; font-weight: 600; color: var(--muted);
}
.date-chip svg { width: 15px; height: 15px; }
.date-chip input { position: absolute; inset: 0; opacity: 0; width: 100%; }
.stat-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 14px 0 16px; }

.ex-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); margin-bottom: 12px; overflow: hidden; }
.ex-head .swipe-fg { background: var(--surface); }
.ex-head { border-radius: 0; }
.ex-head .swipe-bg { border-radius: 0; }
.ex-toggle { width: 100%; display: flex; align-items: center; gap: 12px; padding: 14px 16px; text-align: left; }
.ex-index {
  flex: 0 0 30px; height: 30px; border-radius: 10px;
  background: var(--accent); color: var(--accent-ink);
  display: grid; place-items: center; font-weight: 800; font-size: 14px;
}
.ex-name { flex: 1; min-width: 0; }
.ex-name b { display: block; font-size: 17px; font-weight: 800; letter-spacing: -.01em; }
.ex-name span { display: block; font-size: 12.5px; color: var(--muted); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ex-chev { transition: transform .25s var(--ease); color: var(--faint); }
.ex-card.collapsed .ex-chev { transform: rotate(-90deg); }
.ex-body { padding: 0 12px 14px; }
.ex-card.collapsed .ex-body { display: none; }

.sets-head { display: grid; grid-template-columns: 34px 1fr 18px 1fr; gap: 8px; padding: 0 6px 6px; font-size: 11px; font-weight: 700; color: var(--faint); text-transform: uppercase; letter-spacing: .05em; }
.sets-head div { text-align: center; }
.set-row { display: grid; grid-template-columns: 34px 1fr 18px 1fr; gap: 8px; align-items: center; background: var(--surface-2); padding: 6px; border-radius: var(--r-sm); }
.ex-body .swipe { border-radius: var(--r-sm); }
.ex-body .swipe + .swipe { margin-top: 6px; }
.ex-body .swipe-bg { border-radius: var(--r-sm); }
.set-n { text-align: center; font-weight: 800; color: var(--muted); font-size: 14px; }
.set-x { text-align: center; color: var(--faint); font-weight: 700; }
.set-in {
  width: 100%; height: 40px; border-radius: 10px; border: 1px solid transparent;
  background: var(--surface); text-align: center; outline: none;
  font-size: 17px; font-weight: 700; font-variant-numeric: tabular-nums;
}
.set-in:focus { border-color: var(--accent); }
.set-in::placeholder { color: var(--faint); font-weight: 600; }
.ex-actions { display: flex; gap: 8px; margin-top: 10px; }
.ex-actions .btn { flex: 1; }
.ex-note { margin-top: 10px; }
.prev-hint { font-size: 12px; color: var(--muted); padding: 0 6px 8px; }
.prev-hint b { color: var(--accent-text); font-weight: 700; }

/* ============ Progress ============ */
.p-item { display: flex; align-items: center; gap: 12px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); padding: 12px 14px; }
.p-item + .p-item { margin-top: 8px; }
.p-item:active { transform: scale(.985); }
.p-main { flex: 1; min-width: 0; }
.p-name { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.p-meta { color: var(--muted); font-size: 13px; margin-top: 2px; }
.spark { width: 72px; height: 30px; flex: 0 0 auto; }
.spark path { stroke: var(--accent-text); stroke-width: 2; fill: none; }
.delta-up { color: var(--accent-text); font-weight: 700; }
.delta-down { color: var(--danger); font-weight: 700; }

.seg { display: flex; background: var(--surface-2); border-radius: var(--r-sm); padding: 3px; gap: 3px; }
.seg button { flex: 1; height: 34px; border-radius: 9px; font-size: 13px; font-weight: 700; color: var(--muted); transition: background .2s, color .2s; }
.seg button.on { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px rgba(0, 0, 0, .15); }

.hero-val { font-size: 40px; font-weight: 800; letter-spacing: -.04em; margin: 16px 0 2px; font-variant-numeric: tabular-nums; }
.hero-val small { font-size: 18px; color: var(--muted); font-weight: 700; margin-left: 4px; }
.hero-sub { font-size: 13px; color: var(--muted); }
.chart { margin: 12px -4px 0; }
.chart svg { width: 100%; height: auto; display: block; overflow: visible; }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.chart .axis { fill: var(--faint); font-size: 10.5px; font-weight: 600; font-family: var(--font); }
.chart .line { stroke: var(--accent-text); stroke-width: 2.5; fill: none; }
.chart .dot { fill: var(--surface); stroke: var(--accent-text); stroke-width: 2; }
.chart .dot.pr { fill: var(--accent-text); }
.chart .tip { fill: var(--text); font-size: 12px; font-weight: 800; font-family: var(--font); }
.chart-empty { padding: 30px 0 18px; text-align: center; color: var(--muted); font-size: 14px; }

.prs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.hist { padding: 12px 14px; }
.hist + .hist { border-top: 1px solid var(--line); }
.hist-top { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.hist-title { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hist-date { color: var(--muted); font-size: 12.5px; flex: 0 0 auto; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.chip { height: 28px; padding: 0 10px; display: inline-flex; align-items: center; border-radius: 9px; background: var(--surface-2); font-size: 13px; font-weight: 700; font-variant-numeric: tabular-nums; }
.chip.pr { background: var(--accent-soft); color: var(--accent-text); }
.hist-note { color: var(--muted); font-size: 13px; margin-top: 8px; }

/* ============ Tab bar & bottom bar ============ */
.tabbar, .bottom-bar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  background: var(--glass);
  -webkit-backdrop-filter: blur(18px) saturate(1.4); backdrop-filter: blur(18px) saturate(1.4);
  border-top: 1px solid var(--line);
  padding: 8px 16px calc(8px + var(--safe-b));
}
.tabbar { display: grid; grid-template-columns: 1fr 72px 1fr; align-items: center; }
.tab { display: flex; flex-direction: column; align-items: center; gap: 3px; color: var(--faint); font-size: 11px; font-weight: 700; padding: 4px 0; }
.tab.active { color: var(--text); }
.tab svg { width: 24px; height: 24px; }
.fab {
  width: 56px; height: 56px; margin: -22px auto 0; border-radius: 50%;
  background: var(--accent); color: var(--accent-ink);
  display: grid; place-items: center;
  box-shadow: 0 8px 24px rgba(180, 230, 30, .35), 0 0 0 5px var(--bg);
  transition: transform .15s var(--ease);
}
.fab:active { transform: scale(.9); }
.fab svg { width: 26px; height: 26px; stroke-width: 2.8; }
.bottom-bar { max-width: 100%; }
.bottom-bar .btn { max-width: 608px; margin: 0 auto; display: flex; }

/* ============ Sheets ============ */
.sheet-backdrop {
  position: fixed; inset: 0; z-index: 60;
  background: rgba(0, 0, 0, .5);
  display: flex; align-items: flex-end; justify-content: center;
  animation: fade .2s ease;
}
.sheet {
  width: 100%; max-width: 640px; max-height: 88vh; overflow: auto;
  background: var(--surface); border-radius: 26px 26px 0 0;
  padding: 10px 16px calc(18px + var(--safe-b));
  animation: up .28s var(--ease);
}
.sheet-grip { width: 38px; height: 5px; border-radius: 9px; background: var(--surface-3); margin: 0 auto 12px; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.sheet-title { font-size: 20px; font-weight: 800; letter-spacing: -.02em; }
.sheet-sub { color: var(--muted); font-size: 13px; margin-top: 2px; }
.sheet .close { width: 32px; height: 32px; border-radius: 50%; background: var(--surface-2); display: grid; place-items: center; }
.sheet .close svg { width: 16px; height: 16px; stroke-width: 2.6; }
.closing .sheet-backdrop { animation: fade .2s ease reverse forwards; }
.closing .sheet { animation: down .2s ease forwards; }
@keyframes fade { from { opacity: 0; } }
@keyframes up { from { transform: translateY(100%); } }
@keyframes down { to { transform: translateY(100%); } }

.menu-list { display: flex; flex-direction: column; gap: 6px; }
.menu-item { display: flex; align-items: center; gap: 14px; padding: 14px; border-radius: var(--r-md); background: var(--surface-2); text-align: left; font-weight: 600; }
.menu-item svg { color: var(--accent-text); }
.menu-item small { display: block; color: var(--muted); font-weight: 500; font-size: 12.5px; margin-top: 2px; }
.menu-item:active { transform: scale(.985); }

.pick-list { display: flex; flex-direction: column; margin-top: 12px; }
.pick { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 13px 4px; border-bottom: 1px solid var(--line); text-align: left; font-weight: 600; }
.pick:last-child { border-bottom: 0; }
.pick small { color: var(--muted); font-weight: 500; }
.pick-del { color: var(--danger); font-size: 13px; font-weight: 700; padding: 6px 4px; }
.recent-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.recent-chips button { height: 32px; padding: 0 12px; border-radius: 99px; background: var(--accent-soft); color: var(--accent-text); font-size: 13px; font-weight: 700; }
.add-row { display: flex; gap: 8px; margin-top: 10px; }
.add-row .field { flex: 1; }

.share-ex { padding: 10px 0; border-bottom: 1px solid var(--line); }
.share-ex:last-child { border-bottom: 0; }

/* ============ Toast ============ */
.toast-root { position: fixed; left: 0; right: 0; bottom: calc(96px + var(--safe-b)); z-index: 80; display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; padding: 0 16px; }
.toast {
  pointer-events: auto; display: flex; align-items: center; gap: 14px;
  max-width: 100%; padding: 12px 16px; border-radius: 14px;
  background: var(--text); color: var(--bg); font-weight: 600; font-size: 14px;
  box-shadow: var(--shadow); animation: up .25s var(--ease);
}
.toast button { color: var(--accent); font-weight: 800; }
[data-theme="light"] .toast button { color: #a6d400; }

/* ============ Gate ============ */
.gate { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.gate-card { text-align: center; max-width: 320px; }
.gate-icon { width: 88px; height: 88px; border-radius: 24px; margin-bottom: 20px; }
.gate-title { font-size: 24px; font-weight: 800; letter-spacing: -.02em; margin-bottom: 8px; }
.gate-text { color: var(--muted); margin-bottom: 20px; }

/* ============ Screen transitions ============ */
.screen { animation: slide .24s var(--ease); }
.screen.back { animation: slideback .24s var(--ease); }
@keyframes slide { from { opacity: 0; transform: translateX(18px); } }
@keyframes slideback { from { opacity: 0; transform: translateX(-18px); } }

@media (max-width: 370px) {
  .h1 { font-size: 30px; }
  .metric-value { font-size: 19px; }
  .title-input { font-size: 24px; }
}

/* search on page background vs inside sheets */
.search .field { background: var(--surface); border-color: var(--line); }
.search .field:focus { border-color: var(--accent); }
.sheet .search .field { background: var(--surface-2); border-color: transparent; }

/* ============ v4 ============ */
/* SVG text inherited the global icon stroke -> looked bold. */
.chart text, .spark text { stroke: none; }
.chart .axis { font-weight: 500; font-size: 10.5px; fill: var(--muted); }
.chart .tip { font-weight: 700; font-size: 12px; }
.hero-note { color: var(--faint); }
.seg.sm { margin-top: 12px; }
.seg.sm button { height: 30px; font-size: 12.5px; }

.menu-item > div { min-width: 0; }
.menu-item small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tpl-row { display: flex; gap: 6px; }
.tpl-row .menu-item { flex: 1; min-width: 0; }
.tpl-del { flex: 0 0 50px; border-radius: var(--r-md); background: var(--danger-soft); color: var(--danger); display: grid; place-items: center; }
.tpl-del svg { width: 20px; height: 20px; }
.te-row { display: flex; align-items: center; gap: 8px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.te-name { flex: 1; min-width: 0; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.te-order button { width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; color: var(--muted); }
.te-order button[disabled] { opacity: .25; }
.te-order svg { width: 16px; height: 16px; }
.stepper { display: flex; align-items: center; gap: 2px; background: var(--surface-2); border-radius: 10px; padding: 3px; }
.stepper button { width: 30px; height: 30px; border-radius: 8px; background: var(--surface); font-weight: 800; font-size: 17px; }
.stepper span { min-width: 74px; text-align: center; font-size: 12.5px; font-weight: 700; }
.te-del { width: 28px; height: 28px; display: grid; place-items: center; color: var(--faint); }
.te-del svg { width: 16px; height: 16px; }

button.date-chip { cursor: pointer; }
.dp-quick { display: flex; gap: 8px; margin-bottom: 14px; }
.cal-day.mark span { color: var(--accent-text); font-weight: 800; }
.cal-day.sel span { background: var(--accent); color: var(--accent-ink); font-weight: 800; box-shadow: none; }

.kb-bar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 75;
  display: flex; align-items: center; gap: 6px;
  padding: 6px 10px;
  background: var(--glass);
  -webkit-backdrop-filter: blur(18px) saturate(1.4); backdrop-filter: blur(18px) saturate(1.4);
  border-top: 1px solid var(--line);
}
.kb-bar button { height: 36px; min-width: 40px; border-radius: 10px; background: var(--surface-2); display: grid; place-items: center; }
.kb-bar svg { width: 20px; height: 20px; }
.kb-bar .kb-done { margin-left: auto; padding: 0 18px; background: var(--accent); color: var(--accent-ink); font-weight: 800; }
.kb-hint { font-size: 12px; color: var(--faint); margin-left: 4px; white-space: nowrap; }
body.kb .bottom-bar, body.kb .tabbar { display: none !important; }
body.kb .app { padding-bottom: 65vh; }

/* ============ v5: smoothness ============ */
.screen { animation: slide .32s cubic-bezier(.22,.8,.24,1); }
.screen.back { animation: slideback .32s cubic-bezier(.22,.8,.24,1); }
@keyframes slide { from { opacity: 0; transform: translateX(28px); } }
@keyframes slideback { from { opacity: 0; transform: translateX(-28px); } }
.sheet { animation: up .34s cubic-bezier(.22,.8,.24,1); }
.closing .sheet { animation: down .22s cubic-bezier(.4,0,1,1) forwards; }
.closing .sheet-backdrop { animation: fade .22s ease reverse forwards; }

/* collapsible exercise body: animate height via grid rows */
.ex-body { display: grid; grid-template-rows: 1fr; padding: 0; transition: grid-template-rows .32s cubic-bezier(.22,.8,.24,1); }
.ex-card.collapsed .ex-body { display: grid; grid-template-rows: 0fr; }
.ex-inner { overflow: hidden; min-height: 0; }
.ex-pad { padding: 0 12px 14px; transition: opacity .25s ease; }
.ex-card.collapsed .ex-pad { opacity: 0; }
.sets .swipe + .swipe { margin-top: 6px; }

.note-wrap { display: grid; grid-template-rows: 0fr; transition: grid-template-rows .28s cubic-bezier(.22,.8,.24,1); }
.note-wrap.open { grid-template-rows: 1fr; }
.note-wrap > div { overflow: hidden; min-height: 0; }
.note-wrap .ex-note { margin-top: 10px; }

.cal-grid { will-change: transform; }
.chart { animation: fade .3s ease; }
.btn, .icon-btn, .menu-item, .w-item, .p-item, .cal-day span, .tab { transition: transform .18s cubic-bezier(.22,.8,.24,1), background .2s, opacity .2s; }

/* room so the lowest fields can still be centred above the keyboard (constant -> no jump) */
[data-screen="workout"] { padding-bottom: 45vh; }
body.kb .app { padding-bottom: calc(110px + var(--safe-b)); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
