:root {
  --blue: #1d6fe0;
  --blue-soft: #e8f1fc;
  --ink: #1b1d27;
  --muted: #6d7280;
  --line: #e6e8ee;
  --bg: #f4f5f7;
  --card: #ffffff;
  --soft: #f2f3f6;
  --protein: #ef7a3a;
  --fat: #e2b325;
  --carbs: #2fbe78;
  --cal: #3b82f6;
  --danger: #d14343;
  --shadow: 0 8px 28px rgba(22, 27, 45, 0.08);
  --radius: 16px;
  --tab: calc(96px + env(safe-area-inset-bottom, 0px));
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body.wt-body { background: #e7e9ee; }
button, input, textarea, select { font-family: inherit; font-size: 16px; color: inherit; }
button { cursor: pointer; border: 0; background: none; }
button, .btn, .chip, .pick, .choice, .day-chip, .tile, .finish-pill, .add-set, .set-check, .icon-btn, .kebab, .plus, .subnav button, .filters button, .pill-toggle button, .seg button {
  transition: transform .16s ease, background-color .16s ease, border-color .16s ease, color .16s ease, box-shadow .16s ease;
}
button:active, .chip:active, .pick:active, .choice:active, .day-chip:active, .tile:active, .finish-pill:active, .add-set:active, .icon-btn:active, .kebab:active, .plus:active, .subnav button:active, .filters button:active, .seg button:active {
  transform: scale(0.97);
}
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}
#app {
  max-width: 480px;
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0 auto;
  background: var(--bg);
  position: relative;
}
.view { padding: 18px 16px var(--tab); }
.view.no-tabs { padding-bottom: 28px; }
.boot, .empty {
  padding: 48px 24px;
  text-align: center;
  color: var(--muted);
}
h1.screen-title, .screen-title {
  font-size: 28px;
  line-height: 1.1;
  font-weight: 800;
  margin: 8px 0 16px;
  letter-spacing: -0.03em;
}
.meals-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 40px;
  margin: 6px 0 12px;
}
.meals-head .meals-title { margin: 0; line-height: 1.15; }
.meals-tools { display: flex; align-items: center; justify-content: flex-end; gap: 2px; min-width: 40px; min-height: 40px; }
.meals-title {
  font-size: 26px;
  font-weight: 800;
  letter-spacing: 0.04em;
  margin: 6px 0 12px;
}
.topbar {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
}
.topbar h1 { flex: 1; margin: 0; font-size: 20px; }
.icon-btn {
  width: 40px;
  height: 40px;
  border-radius: 20px;
  display: grid;
  place-items: center;
  color: var(--ink);
}
.icon-btn svg { width: 22px; height: 22px; }
.grow { flex: 1; }
.muted { color: var(--muted); }
.small { font-size: 13px; line-height: 1.4; }
.row { display: flex; align-items: center; gap: 10px; }
.between { justify-content: space-between; }
.stack { display: flex; flex-direction: column; gap: 12px; }

.tabbar {
  position: fixed;
  left: max(8px, calc((100% - 448px) / 2));
  bottom: calc(8px + env(safe-area-inset-bottom, 0px));
  transform: none;
  width: min(448px, calc(100% - 16px));
  height: 64px;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  padding: 5px;
  border-radius: 999px;
  background: rgba(247, 247, 249, 0.78);
  -webkit-backdrop-filter: blur(28px) saturate(1.8);
  backdrop-filter: blur(28px) saturate(1.8);
  border: 0.5px solid rgba(255, 255, 255, 0.72);
  box-shadow:
    0 0 0 0.5px rgba(20, 24, 40, 0.08),
    0 10px 28px rgba(20, 24, 40, 0.14),
    inset 0 0.5px 0 rgba(255, 255, 255, 0.85);
  z-index: 20;
  transition: width .45s cubic-bezier(.22, 1, .36, 1), height .45s cubic-bezier(.22, 1, .36, 1), padding .45s cubic-bezier(.22, 1, .36, 1);
}
.tabbar > button:not(.resume-bar):not(.tab-add) {
  flex: 1 1 0;
  min-width: 0;
  max-width: 96px;
  height: 54px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 4px 0 3px;
  overflow: hidden;
  color: #8a8a8e;
  font-size: 10px;
  font-weight: 500;
  letter-spacing: -0.01em;
  border-radius: 18px;
  -webkit-tap-highlight-color: transparent;
  transition:
    transform .16s ease,
    background-color .2s ease,
    color .2s ease,
    box-shadow .2s ease,
    flex-grow .45s cubic-bezier(.22, 1, .36, 1),
    flex-basis .45s cubic-bezier(.22, 1, .36, 1),
    max-width .45s cubic-bezier(.22, 1, .36, 1),
    width .45s cubic-bezier(.22, 1, .36, 1),
    height .45s cubic-bezier(.22, 1, .36, 1),
    padding .45s cubic-bezier(.22, 1, .36, 1),
    opacity .2s ease,
    border-radius .45s cubic-bezier(.22, 1, .36, 1),
    gap .2s ease;
}
.tabbar > button:not(.resume-bar):not(.tab-add) span {
  display: block;
  max-width: 100%;
  max-height: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  line-height: 1.15;
  transition: opacity .15s ease, max-height .2s ease;
}
.tabbar > button:not(.resume-bar):not(.tab-add) svg { width: 23px; height: 23px; }
.tabbar > button.on:not(.resume-bar) {
  color: var(--blue);
  background: rgba(255, 255, 255, 0.88);
  box-shadow: 0 1px 2px rgba(20, 24, 40, 0.06), inset 0 0 0 0.5px rgba(255, 255, 255, 0.9);
}
.tabbar > button.tab-add {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 36px;
  width: 36px;
  max-width: 36px;
  height: 36px;
  align-self: center;
  margin: 0 1px;
  padding: 0;
  gap: 0;
  border-radius: 18px;
  background: var(--blue);
  color: #fff;
  box-shadow: 0 4px 12px rgba(29, 111, 224, 0.32);
}
.tabbar > button.tab-add svg { width: 18px; height: 18px; }
.tabbar > button.tab-add span {
  position: absolute;
  width: 1px;
  height: 1px;
  max-height: none;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}
.tabbar.minimized {
  width: 56px;
  height: 56px;
  padding: 6px;
  gap: 0;
}
.tabbar.minimized.has-add {
  width: 108px;
}
.tabbar.minimized > button:not(.on):not(.tab-add):not(.resume-bar) {
  position: absolute;
  flex: 0 0 0px;
  width: 0;
  max-width: 0;
  min-width: 0;
  height: 0;
  padding: 0;
  margin: 0;
  opacity: 0;
  overflow: hidden;
  pointer-events: none;
  border: 0;
}
.tabbar.minimized > button.on,
.tabbar.minimized > .tab-add {
  position: relative;
  flex: 0 0 44px;
  width: 44px;
  max-width: 44px;
  height: 44px;
  margin: 0;
  padding: 0;
  gap: 0;
  border-radius: 22px;
}
.tabbar.minimized.has-add > button.on { order: 1; }
.tabbar.minimized.has-add > .tab-add { order: 2; margin-left: 4px; }
.tabbar.minimized > button.on {
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  box-shadow: none;
  color: var(--blue);
}
.tabbar.minimized > button.on span {
  display: none;
}
.tabbar.minimized > button.on svg { width: 32px; height: 32px; }
.tabbar.minimized > .tab-add svg { width: 20px; height: 20px; }
.tabbar.minimized > button span {
  max-height: 0;
  opacity: 0;
}
.tab-brand { display: none; }
#app:has(.select-bar) .tabbar { display: none; }
.resume-bar {
  position: fixed;
  left: calc(50vw - max(8px, (100vw - 448px) / 2));
  transform: translateX(-50%);
  bottom: 96px;
  width: min(448px, calc(100vw - 20px));
  background: var(--ink);
  color: white;
  border-radius: 14px;
  padding: 12px 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  z-index: 19;
  font-weight: 650;
}
.resume-bar span { font-weight: 500; opacity: 0.8; font-size: 13px; }

.view.trainer { padding-bottom: 210px; }
#app:has(.resume-bar) .view.trainer { padding-bottom: 270px; }
.trainer-brief .goal-line:first-child { border-top: 0; padding-top: 0; }
.trainer-brief .goal-line { align-items: flex-start; }
.trainer-brief .goal-line span { flex: 0 0 auto; }
.trainer-brief .goal-line strong { font-weight: 650; max-width: 68%; }
.trainer-plan { white-space: pre-wrap; margin: 8px 0 0; }
.trainer-thread { display: flex; flex-direction: column; gap: 10px; margin-top: 16px; }
.bubble-row { display: flex; }
.bubble-row.user { justify-content: flex-end; }
.bubble {
  max-width: 85%;
  white-space: pre-wrap;
  border-radius: 16px;
  padding: 12px 14px;
  line-height: 1.45;
  font-size: 15px;
}
.bubble.user { background: var(--blue); color: #fff; }
.bubble.assistant {
  max-width: 100%;
  white-space: normal;
  background: #fff;
  border: 1px solid var(--line);
}
.bubble.assistant p,
.bubble.assistant ul,
.bubble.assistant ol,
.bubble.assistant .trainer-table-wrap { margin: 0 0 10px; }
.bubble.assistant > :last-child { margin-bottom: 0; }
.bubble.assistant ul,
.bubble.assistant ol { padding-left: 1.2em; }
.bubble.assistant li + li { margin-top: 4px; }
.bubble.assistant strong { font-weight: 700; }
.trainer-table-wrap { overflow-x: auto; }
.trainer-table { width: 100%; border-collapse: collapse; font-size: 13.5px; line-height: 1.35; }
.trainer-table th,
.trainer-table td {
  text-align: left;
  padding: 7px 8px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
.trainer-table th { font-size: 12px; font-weight: 700; color: var(--muted); }
.trainer-table tr:last-child td { border-bottom: 0; }
.bubble-row.arrive { animation: bubble-in .42s cubic-bezier(.2, .8, .2, 1); }
.bubble-row.user.arrive { animation-name: bubble-in-user; }
@keyframes bubble-in {
  from { opacity: 0; transform: translate3d(-14px, 12px, 0); }
  to { opacity: 1; transform: none; }
}
@keyframes bubble-in-user {
  from { opacity: 0; transform: translate3d(16px, 12px, 0); }
  to { opacity: 1; transform: none; }
}
.trainer-links { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.trainer-link {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 40px;
  padding: 8px 12px;
  border-radius: 12px;
  background: var(--blue);
  color: #fff;
  font-weight: 700;
  text-align: center;
}
.bubble.thinking { display: inline-flex; align-items: center; gap: 8px; }
.think-dots { display: inline-flex; align-items: center; gap: 4px; height: 14px; }
.think-dots i {
  width: 5px; height: 5px; border-radius: 50%;
  background: currentColor; opacity: 0.75;
  animation: think-bounce 1s ease-in-out infinite;
}
.think-dots i:nth-child(2) { animation-delay: .15s; }
.think-dots i:nth-child(3) { animation-delay: .3s; }
@keyframes think-bounce {
  0%, 70%, 100% { transform: translateY(2px); }
  35% { transform: translateY(-5px); }
}
@media (prefers-reduced-motion: reduce) {
  .think-dots i { animation: none; transform: none; }
  .tabbar,
  .tabbar > button,
  .tabbar button span { transition: none; }
}
.trainer-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.trainer-chips button {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 12px;
  font-size: 14px;
  font-weight: 650;
}
.trainer-chips button:disabled { opacity: 0.55; }
.trainer-compose {
  position: fixed;
  z-index: 18;
  left: max(16px, calc((100vw - 480px) / 2 + 16px));
  bottom: calc(96px + env(safe-area-inset-bottom, 0px));
  width: min(448px, calc(100vw - 32px));
  display: flex;
  gap: 8px;
  align-items: center;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 8px;
  box-shadow: 0 10px 30px rgba(20, 24, 40, 0.12);
}
#app:has(.resume-bar) .trainer-compose { bottom: calc(156px + env(safe-area-inset-bottom, 0px)); }
.trainer-compose input {
  flex: 1;
  min-width: 0;
  height: 40px;
  border: 0;
  background: transparent;
  padding: 0 8px;
}
.trainer-compose .send {
  height: 40px;
  padding: 0 14px;
  border-radius: 12px;
  background: var(--blue);
  color: #fff;
  font-weight: 700;
}
.trainer-compose .talk {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: var(--soft);
  display: grid;
  place-items: center;
  font-weight: 700;
}
.trainer-compose .talk.on { width: auto; padding: 0 14px; background: var(--blue); color: #fff; }
.trainer-compose .talk svg { width: 20px; height: 20px; }
.trainer-compose button:disabled { opacity: 0.55; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
}
.session-card { padding: 18px 16px 8px; }
.who { display: flex; gap: 10px; align-items: center; margin-bottom: 12px; }
.avatar, .brand-mark {
  width: 42px; height: 42px; border-radius: 21px;
  background: #eceef2; color: #8b909c;
  display: grid; place-items: center; font-weight: 700;
}
.who strong { display: block; font-size: 15px; }
.who .small { margin-top: 1px; }
.goal-line {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
  padding: 10px 0;
  border-top: 1px solid var(--line);
}
.goal-line strong { text-align: right; font-size: 15px; }
button.goal-card {
  width: 100%;
  display: block;
  text-align: left;
  color: inherit;
  cursor: pointer;
}
.home-split {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  row-gap: 18px;
  align-items: start;
}
.home-split > section { min-width: 0; }
.home-split .section-label { margin-top: 0; }
.month-cal { max-width: none; min-width: 0; }
.month-cal .row { align-items: center; }
.cal-key { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 12px; font-weight: 700; }
.cal-key i { width: 6px; height: 6px; border-radius: 50%; background: var(--blue); display: block; }
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; text-align: center; min-width: 0; }
.cal-head { margin: 12px 0 6px; color: var(--muted); font-size: 12px; font-weight: 700; }
.cal-day {
  min-width: 0;
  min-height: 44px; border-radius: 10px;
  display: flex; flex-direction: column; align-items: center; justify-content: flex-start;
  gap: 1px; padding: 4px 2px 3px;
  font-size: 13px; font-weight: 650; line-height: 1.1;
  overflow: hidden;
}
.cal-name {
  display: block;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  color: var(--blue);
  font-size: 9px;
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cal-day.out { color: #c5c8d0; }
.cal-day.out .cal-name { color: #b7c3d6; }
.cal-day.today { box-shadow: inset 0 0 0 1.5px var(--blue); color: var(--blue); }
.cal-day.trained { color: var(--blue); font-weight: 800; }
.view.home > .weight-card { width: 100%; text-align: left; }
.oura-board {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px 12px;
}
.oura-board .lbl { color: var(--muted); font-size: 13px; font-weight: 650; }
.oura-board .val { font-size: 28px; font-weight: 800; letter-spacing: -0.04em; margin-top: 2px; }
.oura-sleep .goal-line:first-child { border-top: 0; padding-top: 0; }
.stat-grid {
  display: grid;
  grid-template-columns: 1fr 1.2fr 0.8fr;
  gap: 8px;
  margin: 8px 0 12px;
}
.stat-grid .lbl, .mini-stats .lbl { color: var(--muted); font-size: 13px; }
.stat-grid .val, .mini-stats .val { font-size: 20px; font-weight: 700; letter-spacing: -0.03em; margin-top: 2px; }
.stat-grid .val.blue { color: var(--blue); }
.medal {
  display: inline-block;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: radial-gradient(circle at 40% 35%, #ffe38a, #f0b429 60%, #d89a12);
  box-shadow: inset 0 -2px 0 rgba(0,0,0,.08);
  vertical-align: -2px;
  margin-right: 4px;
}
.ex-line {
  display: flex; gap: 12px; align-items: center;
  padding: 10px 0;
  border-top: 1px solid var(--line);
  font-weight: 650;
}
.ex-line.detail { align-items: flex-start; }
.ex-line .ex-name { flex: 1; min-width: 0; padding-top: 12px; }
.ex-line .ex-sets {
  margin-left: auto;
  max-width: 58%;
  padding-top: 12px;
  text-align: right;
  color: var(--muted);
  font-weight: 650;
  font-size: 13px;
  line-height: 1.35;
}
.ex-ico {
  width: 46px; height: 46px; flex: 0 0 46px;
  border-radius: 10px; background: #f7f8fa;
  display: grid; place-items: center;
}
.ex-ico svg { width: 42px; height: 42px; }
.linkish {
  width: 100%;
  text-align: center;
  color: #9aa0ab;
  padding: 12px 0 8px;
  font-weight: 600;
}

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 48px; padding: 0 16px; border-radius: 12px;
  font-weight: 700; width: 100%;
  text-decoration: none;
}
.btn.primary { background: var(--blue); color: white; }
.btn.soft { background: var(--soft); color: var(--ink); }
.btn.ghost { background: transparent; color: var(--blue); }
.btn.danger { background: #fdecec; color: var(--danger); }
.btn:disabled { opacity: 0.55; }
.btn.is-busy, .btn.is-busy:disabled { opacity: 1; cursor: progress; }
.spin {
  width: 16px; height: 16px; flex: 0 0 16px;
  border-radius: 50%;
  border: 2px solid #d7dbe3;
  border-top-color: var(--ink);
  display: inline-block;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.btn-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.goal-actions .btn.soft { background: white; border: 1px solid var(--line); }

.routine-card h2 { margin: 0 0 6px; font-size: 18px; }
.clamp {
  color: var(--muted);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.4;
  min-height: 2.8em;
  margin-bottom: 14px;
}
.section-label {
  display: flex; align-items: center; justify-content: space-between;
  font-weight: 700; margin: 18px 0 10px;
}
.plan-intro { margin: 18px 0 0; }
.plan-note { margin: -4px 0 12px; }
.plan-card, .routine-card { cursor: pointer; }
.plan-list { margin-top: 4px; }
.plan-ex { padding: 12px 0; border-top: 1px solid var(--line); }
.plan-ex strong { font-size: 15px; }
.plan-set { display: flex; align-items: baseline; gap: 12px; padding: 3px 0 3px 2px; font-variant-numeric: tabular-nums; }
.plan-set .set-num { width: 18px; }
.strip {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px;
}
.strip.quad { grid-template-columns: repeat(4, 1fr); }
.strip.quad .cell {
  padding: 12px 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}
.strip button, .strip .cell {
  background: white; border: 1px solid var(--line); border-radius: 14px;
  padding: 12px 10px; text-align: left;
}
.strip .n { font-weight: 800; font-size: 16px; letter-spacing: -0.03em; }
.strip .k { color: var(--muted); font-size: 12px; margin-top: 2px; }

.field { display: flex; flex-direction: column; gap: 6px; }
.field span, label.lbl { font-size: 13px; color: var(--muted); font-weight: 600; }
input[type="text"], input[type="number"], input[type="password"], input[type="time"], input[type="date"], textarea, select {
  width: 100%;
  background: white;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 12px;
  min-height: 48px;
}
input[type="time"], input[type="date"] {
  -webkit-appearance: none;
  appearance: none;
}
input[type="time"]::-webkit-date-and-time-value,
input[type="date"]::-webkit-date-and-time-value { text-align: left; }
input[type="time"]::-webkit-calendar-picker-indicator,
input[type="date"]::-webkit-calendar-picker-indicator { cursor: pointer; opacity: 0.55; }
textarea { min-height: 72px; resize: vertical; }
.seg { display: flex; background: var(--soft); border-radius: 12px; padding: 4px; gap: 4px; }
.seg button { flex: 1; border-radius: 10px; padding: 10px 6px; font-weight: 700; font-size: 14px; color: var(--muted); }
.seg button.on { background: white; color: var(--ink); box-shadow: 0 1px 2px rgba(0,0,0,.06); }
.choice-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.choice {
  background: white; border: 1px solid var(--line); border-radius: 14px;
  padding: 14px 12px; text-align: left; font-weight: 700;
}
.choice.on { border-color: var(--blue); background: var(--blue-soft); color: var(--blue); }
.choice small { display: block; font-weight: 500; color: var(--muted); margin-top: 2px; }
input[type="range"] { width: 100%; accent-color: var(--blue); }
.chime-list { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.chime-row {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 4px 4px 4px 12px;
  background: #fff;
}
.chime-row.on { border-color: var(--blue); background: var(--blue-soft); }
.chime-pick {
  flex: 1;
  min-width: 0;
  text-align: left;
  font-weight: 650;
  font-size: 14px;
  padding: 8px 0;
}
.chime-row.on .chime-pick { color: var(--blue); }
.week-rate { font-size: 28px; font-weight: 800; letter-spacing: -0.04em; }

.chart-card h3 { margin: 0 0 4px; font-size: 16px; }
.chart-card { overflow: visible; }
.chart {
  --bar: #1d6fe0;
  position: relative;
  width: 100%;
  height: auto;
  display: block;
}
.chart-bars {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  height: 112px;
  margin-top: 4px;
}
button.chart-col {
  position: relative;
  flex: 1 1 0;
  align-self: stretch;
  min-width: 0;
  margin: 0;
  padding: 0;
  display: flex;
  align-items: flex-end;
  border-radius: 3px;
  background: transparent;
  cursor: pointer;
  touch-action: pan-y;
}
button.chart-col:hover,
button.chart-col.on,
button.chart-col:focus-visible {
  z-index: 2;
  background: rgba(27, 29, 39, 0.06);
}
button.chart-col:active { transform: none; }
.chart-fill {
  display: block;
  width: 100%;
  height: max(2px, calc(var(--h, 0) * 1%));
  border-radius: 2px;
  background: var(--bar);
  pointer-events: none;
}
.chart-tip {
  position: absolute;
  z-index: 4;
  left: 0;
  bottom: 0;
  transform: translateX(-50%);
  background: var(--ink);
  color: #fff;
  border-radius: 8px;
  padding: 5px 8px 6px;
  white-space: nowrap;
  pointer-events: none;
  box-shadow: 0 6px 16px rgba(22, 27, 45, 0.18);
  text-align: left;
  opacity: 0;
  visibility: hidden;
  transition: left .12s ease-out, bottom .14s ease-out, opacity .1s ease, visibility .1s ease;
}
.chart-tip-label {
  display: block;
  font-size: 10px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.72);
  line-height: 1.2;
}
.chart-tip-val {
  display: block;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.25;
}
.chart-tip.on {
  opacity: 1;
  visibility: visible;
}
.chart-axis {
  display: flex;
  justify-content: space-between;
  margin-top: 6px;
  font-size: 9px;
  line-height: 1;
  color: #6d7280;
}
.macro-tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.tile { background: white; border: 1px solid var(--line); border-radius: 16px; padding: 14px; }
.tile .k { color: var(--muted); font-size: 13px; }
.bar { height: 8px; background: #eceff3; border-radius: 99px; overflow: hidden; margin: 10px 0; }
.bar > span { display: block; height: 100%; border-radius: 99px; }
.bar .cal { background: var(--cal); }
.bar .p { background: var(--protein); }
.bar .f { background: var(--fat); }
.bar .c { background: var(--carbs); }
.tile .n { font-weight: 800; font-size: 20px; letter-spacing: -0.03em; }

.week-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.week-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}
.week-arrow {
  width: 36px;
  height: 36px;
  border-radius: 18px;
  font-size: 22px;
  line-height: 1;
  color: var(--ink);
}
.today-label {
  font-size: 15px;
  font-weight: 800;
  letter-spacing: -0.02em;
}
.today-jump {
  height: 32px;
  padding: 0 14px;
  border-radius: 999px;
  background: var(--blue);
  color: white;
  font-size: 13px;
  font-weight: 750;
}
.days { display: flex; justify-content: space-between; gap: 4px; }
.day-chip {
  width: 44px; min-height: 64px; border-radius: 22px;
  border: 1px solid #e4e6ec; background: white;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  font-size: 12px; color: var(--muted); position: relative;
}
.day-chip strong { color: var(--ink); font-size: 15px; }
.day-chip.on { border-color: var(--blue); box-shadow: 0 0 0 1px var(--blue); }
.day-chip.today {
  background: #d9f5e6;
  border-color: #8ed9b0;
  color: #137a43;
}
.day-chip.today strong { color: #137a43; }
.day-chip .dot {
  width: 4px; height: 4px; border-radius: 2px; background: var(--blue);
  position: absolute; bottom: -8px;
}
.macro-lines { margin: 16px 0; display: flex; flex-direction: column; gap: 8px; }
.macro-line { display: grid; grid-template-columns: 16px 7.2em minmax(0, 1fr); gap: 8px; align-items: center; font-size: 13px; font-weight: 650; }
.macro-line > strong,
.macro-line > svg { width: 16px; height: 16px; justify-self: start; }
.macro-line > strong { display: flex; align-items: center; justify-content: flex-start; line-height: 1; }
.macro-line > span { white-space: nowrap; }
.macro-line .mark-p { color: var(--protein); }
.macro-line .mark-f { color: var(--fat); }
.macro-line .mark-c { color: var(--carbs); }
.macro-line .track { height: 6px; width: 100%; background: #e6e8ee; border-radius: 99px; overflow: hidden; }
.macro-line .track span { display: block; height: 100%; }
.view.log .macro-lines {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px 10px;
  position: sticky;
  top: 0;
  z-index: 4;
  margin: 0;
  padding: 14px 0 12px;
  background: var(--bg);
}
.view.log .macro-line {
  grid-template-columns: auto minmax(0, 1fr);
  grid-template-rows: auto auto;
  column-gap: 4px;
  row-gap: 6px;
  font-size: 12px;
  font-weight: 750;
  letter-spacing: -0.03em;
}
.view.log .macro-line > svg,
.view.log .macro-line > strong {
  grid-column: 1;
  grid-row: 1;
  width: 14px;
  height: 14px;
}
.view.log .macro-line > strong { font-size: 13px; width: auto; }
.view.log .macro-line > span {
  grid-column: 2;
  grid-row: 1;
  overflow: hidden;
  text-overflow: ellipsis;
}
.view.log .macro-line .track { grid-column: 1 / -1; grid-row: 2; height: 5px; }

.week-chart { display: grid; grid-template-columns: 1fr 118px; gap: 8px; align-items: end; }
.cols { display: flex; align-items: flex-end; justify-content: space-between; height: 150px; gap: 6px; }
.col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; justify-content: flex-end; }
.col .shaft {
  width: 100%; max-width: 28px; background: #eceff3; border-radius: 8px;
  height: 120px; display: flex; align-items: flex-end; overflow: hidden;
  border: 2px solid transparent;
}
.col.on .shaft { border-color: var(--blue-soft); }
.cols.remain .shaft { align-items: flex-start; }
.stackbar { width: 100%; display: flex; flex-direction: column-reverse; }
.cols.remain .stackbar { flex-direction: column; }
.stackbar i { display: block; width: 100%; }
.legend-num { font-weight: 800; font-size: 18px; }
.legend-row { display: flex; gap: 6px; align-items: baseline; font-size: 14px; margin-top: 6px; }
.swatch { width: 8px; height: 8px; border-radius: 2px; display: inline-block; }
.pill-toggle {
  display: flex; background: #eceef2; border-radius: 999px; padding: 4px;
  width: max-content; margin: 14px auto 0;
}
.view.log .pill-toggle { margin: 14px auto 2px; }
.view.log .pill-toggle button { font-size: 13px; padding: 6px 12px; }
.pill-toggle button { border-radius: 999px; padding: 8px 16px; font-weight: 700; color: var(--muted); }
.pill-toggle button.on { background: var(--ink); color: white; }
.insights { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.spark { width: 100%; height: 48px; }
.weight-plot { width: 100%; height: 112px; display: block; margin-top: 8px; }
.weight-card .chip { width: auto; flex: 0 0 auto; }
.subnav { display: flex; gap: 6px; margin-bottom: 12px; }
.subnav button { flex: 1; background: white; border-radius: 999px; padding: 8px; font-weight: 700; font-size: 13px; color: var(--muted); border: 1px solid var(--line); }
.subnav button.on { background: var(--ink); color: white; border-color: var(--ink); }
.sheet-tabs { display: flex; gap: 6px; margin: 0 0 14px; }
.sheet-tabs button { flex: 1; background: var(--soft); border-radius: 999px; padding: 8px 6px; font-weight: 700; font-size: 13px; color: var(--muted); }
.sheet-tabs button.on { background: var(--ink); color: white; }

.hour {
  --tick: 84px;
  position: relative;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  column-gap: 8px;
  row-gap: 8px;
  min-height: 68px;
  padding: 4px 0 12px;
}
.hour::before {
  content: "";
  position: absolute;
  left: calc(var(--tick) / 2 - 1px);
  top: 0;
  bottom: 0;
  width: 2px;
  background: #e4e6ec;
}
.hour:first-child::before { top: 20px; }
.hour:last-child:not(:has(.food))::before { height: 20px; bottom: auto; }
.hour .tick {
  order: 1;
  flex: 0 0 auto;
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: var(--tick);
  box-sizing: border-box;
  color: var(--ink);
  font-size: 14px;
  font-weight: 700;
  line-height: 1;
  padding: 9px 12px;
  border-radius: 999px;
  background: #e7e8ec;
}
.now-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--ink);
  flex: 0 0 auto;
}
.rail { order: 3; position: relative; z-index: 1; flex: 1 1 100%; border-left: 0; padding: 0; min-height: 0; }
.hour .rail:empty { display: none; }
.food {
  background: white; border-radius: 14px; border: 1px solid var(--line);
  padding: 10px 12px; margin-bottom: 8px; display: flex; gap: 8px; align-items: flex-start;
}
.food.on { border-color: var(--blue); background: #f5f9ff; }
.food .nm { font-weight: 700; }
.plus {
  order: 2;
  flex: 0 0 auto;
  width: 34px; height: 34px; border-radius: 17px; background: #e7e8ec;
  display: grid; place-items: center; font-size: 22px; font-weight: 400; line-height: 1; color: var(--ink);
}
.meals-tools .finish-pill { height: 40px; display: inline-flex; align-items: center; }
.select-bar {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: 12px; width: min(448px, calc(100% - 20px));
  background: white; border-radius: 16px; box-shadow: var(--shadow);
  display: flex; flex-wrap: wrap; z-index: 21; padding: 8px;
}
.select-bar button { flex: 1; font-weight: 700; font-size: 12px; padding: 10px 2px; color: var(--ink); }
.select-bar .cookbook-toggle { flex: 1 1 100%; font-size: 14px; padding: 10px 8px; }
.cookbook { display: flex; flex-direction: column; gap: 8px; }
.cookbook .lbl { font-size: 13px; color: var(--muted); font-weight: 600; }
.cookbook-row {
  display: flex; gap: 8px; align-items: center;
  background: var(--soft); border-radius: 12px; padding: 8px 8px 8px 12px;
}
.cookbook-row.on { outline: 2px solid var(--blue); background: var(--blue-soft); }
.cookbook-pick { flex: 1; text-align: left; min-width: 0; }
.cookbook-pick .nm { font-weight: 700; }
.select-bar button:disabled { color: #c5c8d0; }

.session-head {
  position: sticky;
  top: 0;
  z-index: 5;
  padding: 8px 8px 0;
  background: rgba(255, 255, 255, 0.9);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  border-bottom-left-radius: 20px;
  border-bottom-right-radius: 20px;
  margin-bottom: 16px;
}
.session-head:has(.rest-slide) { overflow: hidden; padding-bottom: 0; }
.rest-slide {
  display: flex;
  flex-direction: column;
  width: calc(100% + 16px);
  margin: 2px -8px 0;
  padding: 0;
  border: 0;
  background: transparent;
  text-align: left;
  animation: rest-in .28s cubic-bezier(.2, .8, .2, 1);
}
.rest-slide-meta {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 0 16px 8px;
}
.rest-slide-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
}
.rest-slide-time {
  flex: 0 0 auto;
  color: var(--blue);
  font-size: 18px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.03em;
}
.rest-slide-track {
  height: 8px;
  background: var(--blue-soft);
}
.rest-slide-fill {
  display: block;
  height: 100%;
  width: 100%;
  background: var(--blue);
  transform-origin: left center;
  transition: transform .25s linear;
}
@keyframes rest-in {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: none; }
}
.session-head::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 100%;
  height: 36px;
  pointer-events: none;
  background: linear-gradient(to bottom, rgba(255, 255, 255, 0.4), rgba(255, 255, 255, 0));
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
  -webkit-mask-image: linear-gradient(to bottom, #000 0%, transparent 100%);
  mask-image: linear-gradient(to bottom, #000 0%, transparent 100%);
}
.live-stats {
  display: grid; grid-template-columns: 1fr 1fr 1fr 36px; gap: 6px;
  padding: 8px 12px 12px; align-items: end;
}
.live-stats .lbl { color: var(--muted); font-size: 13px; }
.live-stats .slot { height: 24px; overflow: hidden; }
.live-stats .val { font-weight: 700; font-size: 18px; line-height: 24px; display: inline-block; }
.live-stats .val.bump { animation: stat-bump .46s cubic-bezier(.16, .84, .28, 1); }
@keyframes stat-bump {
  0% { transform: translateY(100%); color: var(--blue); }
  62% { transform: translateY(-10%); color: var(--blue); }
  100% { transform: none; color: var(--ink); }
}
.finish-pill {
  background: var(--blue); color: white; border-radius: 999px;
  padding: 8px 16px; font-weight: 800;
}
.ex-block { background: transparent; padding: 8px 16px 0; }
.session-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  padding: 4px 16px 24px;
}
.session-actions .btn {
  height: auto;
  min-height: 48px;
  padding: 12px;
  line-height: 1.2;
  text-align: center;
}
.reorder-list { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.reorder-row {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--soft);
  border-radius: 12px;
  padding: 12px 14px;
  font-weight: 700;
  cursor: grab;
  touch-action: none;
  user-select: none;
}
.reorder-row.dragging { opacity: 0.45; cursor: grabbing; }
.reorder-handle { color: #9aa0ab; letter-spacing: -1px; font-weight: 800; }
.ex-block h2 { color: var(--blue); font-size: 18px; margin: 0; }
.ex-title {
  font-size: inherit;
  font-weight: inherit;
  color: inherit;
  text-align: left;
  cursor: pointer;
  padding: 0;
}
.ex-title:hover { text-decoration: underline; text-underline-offset: 3px; }
.rest-row { display: flex; gap: 8px; margin: 8px 0; }
.chip {
  background: white; border: 1px solid var(--line); border-radius: 12px;
  padding: 8px 10px; font-weight: 650; font-size: 14px;
  display: inline-flex; gap: 6px; align-items: center; white-space: nowrap;
}
.chip svg { width: 16px; height: 16px; flex: 0 0 auto; }
.set-table { width: 100%; border-collapse: collapse; }
.set-table th {
  font-size: 11px; letter-spacing: 0.04em; color: #9aa0ab; font-weight: 700;
  text-align: center; padding: 4px;
}
.set-table td { padding: 4px; text-align: center; }
.set-num { font-weight: 700; color: #5c6370; }
.set-table td.set-num { width: 52px; }
.pr-mark {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  background: #fbf3d8;
  color: #8a6414;
  border-radius: 999px;
  padding: 2px 6px 2px 4px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.04em;
  line-height: 1;
}
.pr-mark svg { width: 14px; height: 14px; }
.prev { color: var(--muted); font-size: 13px; white-space: nowrap; }
.cell-input {
  width: 64px; background: #f3f5f8; border: 0; border-radius: 10px;
  text-align: center; padding: 10px 0; font-weight: 700;
}
.set-check {
  width: 32px; height: 32px; border-radius: 16px;
  border: 2px solid #d5d7de; display: grid; place-items: center; color: transparent;
}
.set-remove { width: 36px; padding-right: 0; }
.set-x {
  width: 28px; height: 28px; border-radius: 8px;
  background: #d7dae2; color: #8b919c;
  display: grid; place-items: center;
  opacity: 0; pointer-events: none;
}
.set-x svg { width: 14px; height: 14px; }
.set-table tr:hover .set-x,
.set-table tr:focus-within .set-x { opacity: 1; pointer-events: auto; }
.set-x:hover, .set-x:focus-visible { background: #fde8e8; color: var(--danger); }
@media (hover: none) {
  .set-x { opacity: 1; pointer-events: auto; }
}
.set-check.on { background: var(--blue); border-color: var(--blue); color: white; }
.set-check.pop { animation: pop .28s cubic-bezier(.2, .8, .2, 1); }
.add-set {
  width: 100%; background: #eef0f4; border-radius: 12px; padding: 12px;
  font-weight: 700; color: #5c6370; margin: 8px 0 16px;
}
.save-dot { font-size: 12px; color: var(--muted); font-weight: 600; }

.picker-list { display: flex; flex-direction: column; gap: 8px; }
.pick {
  background: white; border: 1px solid var(--line); border-radius: 14px;
  padding: 10px; display: flex; gap: 10px; align-items: center; text-align: left;
}
.pick .meta { color: var(--muted); font-size: 13px; }
.filters { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; }
.filters button { background: white; border-radius: 999px; padding: 8px 12px; font-weight: 700; border: 1px solid var(--line); white-space: nowrap; }
.filters button.on { background: var(--ink); color: white; border-color: var(--ink); }
.muscle-label { font-size: 13px; color: var(--muted); font-weight: 700; margin: 12px 0 6px; }

.backdrop {
  position: fixed; inset: 0; background: rgba(17, 19, 28, 0.4);
  z-index: 40; display: flex; align-items: flex-end; justify-content: center;
}
.sheet {
  width: min(480px, 100%);
  background: white; border-radius: 20px 20px 0 0;
  padding: 12px 16px calc(18px + env(safe-area-inset-bottom));
  max-height: 88vh; overflow: auto;
}
.grab { width: 40px; height: 4px; border-radius: 2px; background: #e1e3e8; margin: 0 auto 12px; }
.sheet h2 { margin: 0 0 8px; font-size: 20px; }
.rest-ring { width: 180px; height: 180px; margin: 8px auto; display: block; }
.rest-time { font-size: 42px; font-weight: 800; letter-spacing: -0.04em; text-align: center; margin-top: -128px; margin-bottom: 78px; }
.complete-hero { text-align: center; padding-top: 28px; }
.check-pop {
  width: 72px; height: 72px; border-radius: 36px; background: var(--blue);
  color: white; display: grid; place-items: center; margin: 0 auto 12px;
  animation: pop .35s ease;
}
@keyframes pop { from { transform: scale(.8); opacity: 0; } to { transform: none; opacity: 1; } }
.achieve { display: flex; gap: 10px; align-items: flex-start; padding: 10px 0; border-top: 1px solid var(--line); }
.notable { margin-top: 22px; }
.notable h2 { margin: 0 0 8px; font-size: 18px; }
.notable .ai-note { margin: 0; }
.notable .achieve:first-of-type { border-top: 0; padding-top: 2px; }
.notable .ai-note + .achieve { border-top: 1px solid var(--line); padding-top: 10px; }
.toast {
  position: fixed; left: 50%; bottom: 110px; transform: translateX(-50%) translateY(8px);
  background: var(--ink); color: white; padding: 10px 14px; border-radius: 12px;
  z-index: 70; opacity: 0; pointer-events: none; transition: .2s ease; max-width: min(420px, calc(100% - 32px));
  font-weight: 600;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.login-wrap { min-height: 100dvh; display: grid; place-items: center; padding: 24px; }
.login-card { width: min(400px, 100%); background: white; border-radius: 20px; padding: 28px 22px; box-shadow: var(--shadow); }
.login-card h1 { margin: 12px 0 4px; }
.lede { color: var(--muted); margin-top: 0; }
.form-error { background: #fdecec; color: var(--danger); padding: 10px 12px; border-radius: 10px; }
#loginform p { margin: 0 0 12px; }
#loginform label { display: block; font-size: 13px; color: var(--muted); font-weight: 650; margin-bottom: 6px; }
#loginform input[type="text"], #loginform input[type="password"] { width: 100%; }
#loginform .button-primary, #wp-submit {
  width: 100%; height: 48px; border: 0; border-radius: 12px;
  background: var(--blue); color: white; font-weight: 800; margin-top: 8px;
  transition: transform .16s ease, filter .16s ease;
}
#loginform .button-primary:active, #wp-submit:active { transform: scale(0.98); }
.hint { background: #f7f8fb; border-radius: 12px; padding: 10px 12px; color: var(--muted); font-size: 13px; }
.caution { background: #fff6e8; border-radius: 12px; padding: 10px 12px; color: #8a5a12; font-size: 14px; }
.ai-note { font-size: 15px; line-height: 1.45; }
.kebab { width: 36px; height: 36px; border-radius: 18px; font-weight: 900; letter-spacing: 1px; color: #6d7280; }
hr.sep { border: 0; border-top: 1px solid var(--line); margin: 8px 0; }
.figure { width: 32px; height: 48px; justify-self: end; }
.run-layout { display: flex; flex-direction: column; gap: 12px; }

@media (min-width: 960px) {
  body.wt-body { background: var(--bg); }
  #app:has(.tabbar) {
    max-width: none;
    display: grid;
    grid-template-columns: 232px minmax(0, 1fr);
    background: transparent;
    align-items: start;
  }
  #app:has(.tabbar) > .tabbar { grid-column: 1; grid-row: 1; }
  #app:has(.tabbar) > .view { grid-column: 2; grid-row: 1; }
  #app:not(:has(.tabbar)) { max-width: none; background: var(--bg); }
  #app:not(:has(.tabbar)) .view { max-width: 1080px; margin: 0 auto; }
  #app:has(.select-bar) .tabbar { display: flex; }

  .tabbar,
  .tabbar.minimized,
  .tabbar.minimized.has-add {
    position: sticky;
    top: 0;
    left: auto;
    bottom: auto;
    transform: none;
    width: auto;
    height: 100vh;
    height: 100dvh;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    gap: 4px;
    border-radius: 0;
    box-shadow: none;
    border: 0;
    border-right: 1px solid var(--line);
    padding: 22px 14px;
    background: transparent;
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
    transition: none;
  }
  .tab-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 6px 10px 22px;
  }
  .tab-brand strong { display: block; font-size: 18px; letter-spacing: -0.02em; }
  .tab-brand .sub { display: block; color: var(--muted); font-size: 13px; font-weight: 600; }
  .tabbar > button:not(.resume-bar):not(.tab-add),
  .tabbar.minimized > button:not(.on):not(.tab-add):not(.resume-bar),
  .tabbar.minimized > button.on {
    position: static;
    order: 0;
    flex: 0 0 auto;
    width: auto;
    max-width: none;
    height: auto;
    min-width: 0;
    flex-direction: row;
    justify-content: flex-start;
    gap: 12px;
    padding: 12px 14px;
    font-size: 17px;
    font-weight: 600;
    letter-spacing: 0;
    border-radius: 12px;
    opacity: 1;
    pointer-events: auto;
    overflow: visible;
  }
  .tabbar > button:not(.resume-bar):not(.tab-add) svg,
  .tabbar.minimized > button.on svg { width: 24px; height: 24px; }
  .tabbar > button:not(.resume-bar):not(.tab-add) span,
  .tabbar.minimized > button span,
  .tabbar.minimized > button.on span {
    display: block;
    max-height: none;
    opacity: 1;
    font-size: inherit;
    overflow: visible;
  }
  .tabbar > button.tab-add {
    display: none;
  }
  .run-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.15fr) minmax(280px, 0.8fr);
    gap: 22px;
    align-items: start;
  }
  .run-side { position: sticky; top: 24px; }
  .tabbar > button.on:not(.resume-bar),
  .tabbar.minimized > button.on { background: var(--blue-soft); box-shadow: none; color: var(--blue); }
  .tabbar > button:not(.resume-bar):not(.tab-add):hover { background: #f3f5f8; color: var(--ink); }
  .tabbar > button.on:not(.resume-bar):hover { background: var(--blue-soft); color: var(--blue); }

  .view {
    width: min(1120px, 100%);
    margin-inline: auto;
    padding: 28px 36px 72px;
  }
  .view.narrow { max-width: 720px; margin-inline: 0; }
  .view.run.narrow { margin-inline: auto; }
  .view.no-tabs { padding-bottom: 40px; }
  .view > .btn, .narrow > .btn { width: auto; min-width: 180px; }
  .card .btn, .sheet .btn { width: 100%; min-width: 0; }
  .view > .card.empty { max-width: 480px; }
  .narrow > .card { max-width: 520px; }

  .card-grid {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: stretch;
  }
  .card-grid > * {
    flex: 1 1 340px;
    max-width: calc(50% - 8px);
    min-width: min(100%, 300px);
  }
  .chart-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 16px;
  }

  .oura-board { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .home-split {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(280px, 0.9fr);
    column-gap: 24px;
    align-items: start;
  }
  .home-split .tile { padding: 14px; }
  .home-split .tile .n { font-size: 20px; }
  .home-split .cal-day { min-height: 52px; font-size: 13px; }
  .home-split .cal-name { font-size: 10px; }
  .home-split .weight-card { width: 100%; }

  .dash > .subpane {
    display: grid;
    grid-template-columns: minmax(0, 1.35fr) minmax(280px, 0.85fr);
    column-gap: 24px;
    align-items: start;
  }
  .dash > .subpane > h2:nth-of-type(2),
  .dash > .subpane > .insights { grid-column: 1 / -1; }
  .dash > .subpane > section.card { grid-column: 1; grid-row: 1 / span 2; }
  .dash > .subpane > h2:nth-of-type(1) { grid-column: 2; grid-row: 1; margin-top: 0; }
  .dash > .subpane > .macro-tiles { grid-column: 2; grid-row: 2; }
  .col .shaft { max-width: 44px; }

  .log-layout {
    display: grid;
    grid-template-columns: 300px minmax(0, 1fr);
    gap: 28px;
    align-items: start;
  }
  .log-side {
    position: sticky;
    top: 24px;
    background: white;
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 16px;
  }
  .log-side .days { flex-wrap: wrap; justify-content: flex-start; gap: 8px; }
  .log-main { min-width: 0; }
  .view.log .log-main .macro-lines { top: 24px; }

  .session-actions { grid-template-columns: 240px 260px; justify-content: start; }
  .session-board .ex-block {
    background: white;
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 14px 16px 4px;
    margin-bottom: 16px;
  }
  .picker-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }

  .select-bar {
    left: 268px;
    transform: none;
    width: min(640px, calc(100vw - 320px));
  }
  .tabbar .resume-bar {
    position: static;
    left: auto;
    bottom: auto;
    transform: none;
    width: auto;
    margin-top: auto;
    flex: 0 0 auto;
    color: white;
    background: var(--ink);
    padding: 12px 14px;
  }
  .tabbar .resume-bar:hover { background: var(--ink); color: white; }
  .tabbar .resume-bar span:first-child {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .view.trainer { padding-bottom: 140px; }
  #app:has(.tabbar .resume-bar) .view.trainer { padding-bottom: 140px; }
  .trainer-compose {
    left: max(268px, calc(232px + (100vw - 232px - 1120px) / 2 + 36px));
    bottom: 24px;
    width: min(1048px, calc(100vw - 232px - 72px));
  }
  #app:has(.tabbar .resume-bar) .trainer-compose { bottom: 24px; }
  .toast { left: calc(50% + 116px); }

  .backdrop { align-items: center; padding: 24px; }
  .sheet {
    width: min(520px, 100%);
    border-radius: 20px;
    max-height: min(80vh, 760px);
    box-shadow: 0 24px 70px rgba(20, 24, 40, 0.22);
  }
}

.run-steps { display: flex; gap: 6px; margin: 0 0 16px; }
.run-steps i { flex: 1; height: 4px; border-radius: 4px; background: var(--line); }
.run-steps i.on { background: var(--blue); }
.day-picks { display: flex; flex-wrap: wrap; gap: 8px; }
.day-picks button {
  width: 46px; height: 46px; border-radius: 23px;
  border: 1px solid var(--line); background: white; font-weight: 800;
}
.day-picks button.on { background: var(--ink); color: white; border-color: var(--ink); }
.time-row { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; }
.run-day { display: block; width: 100%; text-align: left; }
.run-day strong { display: block; margin-top: 2px; }
.run-day p { margin: 8px 0 0; }
.run-day.today { border: 1px solid var(--blue); }
.run-day.done { background: #f3faf6; }
.run-kicker { color: var(--blue); font-size: 12px; font-weight: 800; letter-spacing: 0.04em; text-transform: uppercase; }
.run-check { font-size: 13px; font-weight: 800; color: var(--muted); white-space: nowrap; }
.run-day.done .run-check { color: #1f8a4c; }

.view:has(.subpane) { overflow-x: clip; }
.subpane.slide-left { animation: pane-left .36s cubic-bezier(.22, .8, .24, 1); }
.subpane.slide-right { animation: pane-right .36s cubic-bezier(.22, .8, .24, 1); }
@keyframes pane-left {
  from { transform: translateX(100%); }
  to { transform: none; }
}
@keyframes pane-right {
  from { transform: translateX(-100%); }
  to { transform: none; }
}
.view.enter { animation: screen-in .34s cubic-bezier(.2, .8, .2, 1); }
.view.enter-back { animation: screen-back .3s cubic-bezier(.2, .8, .2, 1); }
.backdrop.enter { animation: fade-in .22s ease; }
.backdrop.enter .sheet { animation: sheet-in .34s cubic-bezier(.2, .8, .2, 1); }
@keyframes screen-in {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: none; }
}
@keyframes screen-back {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: none; }
}
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes sheet-in {
  from { opacity: 0; transform: translateY(28px); }
  to { opacity: 1; transform: none; }
}
@media (hover: hover) and (pointer: fine) {
  .routine-card, .session-card, .pick, .tile, .choice {
    transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
  }
  .routine-card:hover, .session-card:hover, .pick:hover, .tile:hover, .choice:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 28px rgba(22, 27, 45, 0.08);
  }
  .routine-card:active, .session-card:active, .pick:active, .tile:active, .choice:active {
    transform: translateY(0) scale(0.99);
  }
}

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