:root {
  --bg: #f7f8fb;
  --surface: #ffffff;
  --surface-strong: #eef3f7;
  --ink: #111827;
  --muted: #687285;
  --line: #e2e8f0;
  --green: #20c997;
  --green-dark: #07936d;
  --coral: #ff6b6b;
  --blue: #5b7cfa;
  --amber: #ffb020;
  --shadow: 0 18px 48px rgba(17, 24, 39, 0.14);
  --radius: 8px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  background: #eef2f7;
  color: var(--ink);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "PingFang SC",
    "Microsoft YaHei", sans-serif;
  letter-spacing: 0;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-frame {
  min-height: 100svh;
  display: grid;
  place-items: center;
}

.app-shell {
  position: relative;
  width: min(100vw, 430px);
  min-height: 100svh;
  max-height: 920px;
  overflow: hidden;
  background: var(--bg);
  box-shadow: var(--shadow);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 60px;
  padding: 14px 18px 8px;
}

.topbar-left {
  min-width: 0;
  display: flex;
  align-items: center;
}

#screenTitle {
  display: none;
}

.back-button {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border: 0;
  border-radius: var(--radius);
  background: transparent;
  color: var(--ink);
  padding: 0 4px 0 0;
  font-size: 14px;
  font-weight: 900;
}

.back-button svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2.4;
}

.eyebrow {
  margin: 0 0 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: 24px;
  line-height: 1.12;
  font-weight: 800;
}

h2 {
  margin-bottom: 0;
  font-size: 20px;
  line-height: 1.16;
  font-weight: 800;
}

.icon-button {
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
}

.icon-button svg,
.primary-action svg,
.tab svg,
.send svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.screen {
  display: none;
  height: calc(100svh - 60px);
  max-height: 860px;
  overflow-y: auto;
  padding: 0 14px 96px;
  scrollbar-width: none;
}

#todayScreen {
  padding-bottom: 172px;
}

#mateScreen {
  padding-bottom: 226px;
}

.screen::-webkit-scrollbar {
  display: none;
}

.screen.active {
  display: block;
}

.coach-panel,
.section-block,
.metric-card,
.training-hero {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.coach-panel {
  display: grid;
  grid-template-columns: 42px 1fr;
  gap: 12px;
  align-items: start;
  padding: 14px;
  margin-bottom: 12px;
}

.identity-panel {
  border: 0;
  background: transparent;
  padding: 4px 2px 12px;
}

.coach-panel.slim {
  grid-template-columns: 34px 1fr;
  padding: 12px;
}

.coach-avatar {
  position: relative;
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: var(--radius);
  background: #17201b;
  color: #ffffff;
  font-size: 13px;
  font-weight: 900;
}

.avatar-button {
  border: 0;
  padding: 0;
}

.avatar-button:focus-visible {
  outline: 2px solid var(--green);
  outline-offset: 3px;
}

.coach-face {
  background:
    linear-gradient(135deg, rgba(32, 201, 151, 0.92), rgba(91, 124, 250, 0.92));
  box-shadow: 0 10px 28px rgba(32, 201, 151, 0.18);
}

.status-dot {
  position: absolute;
  right: -2px;
  bottom: -2px;
  width: 12px;
  height: 12px;
  border: 2px solid var(--bg);
  border-radius: 50%;
  background: var(--green);
}

.slim .coach-avatar {
  width: 34px;
  height: 34px;
  font-size: 12px;
}

.coach-name {
  margin-bottom: 3px;
  color: var(--green-dark);
  font-size: 12px;
  font-weight: 800;
}

.coach-line,
.coach-panel p {
  margin-bottom: 0;
  color: #263244;
  font-size: 15px;
  line-height: 1.48;
}

.section-block {
  padding: 14px;
  margin-bottom: 12px;
}

.section-block.compact {
  padding-bottom: 10px;
}

.today-hero,
.readiness-panel,
.rhythm-panel,
.today-preview,
.mate-profile {
  border-radius: var(--radius);
  background: var(--surface);
}

.today-hero {
  padding: 18px;
  margin-bottom: 12px;
  border: 1px solid transparent;
  background:
    linear-gradient(#ffffff, #ffffff) padding-box,
    linear-gradient(135deg, rgba(32, 201, 151, 0.55), rgba(91, 124, 250, 0.45)) border-box;
}

.hero-labels {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-bottom: 14px;
}

.hero-labels span,
.muscle-tag {
  min-height: 26px;
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  background: #edf7ff;
  color: var(--blue);
  padding: 4px 9px;
  font-size: 12px;
  font-weight: 900;
}

.today-hero h2 {
  font-size: 28px;
  letter-spacing: 0;
}

.today-hero p {
  margin: 10px 0 16px;
  color: #334155;
  font-size: 15px;
  line-height: 1.55;
}

.intensity-row,
.rhythm-heading,
.rhythm-copy {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.intensity-row span,
.rhythm-heading span,
.rhythm-copy span,
.quiet-meta {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.intensity-row strong,
.rhythm-heading strong {
  font-size: 14px;
}

.intensity-bar {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: #e8eef5;
  margin-top: 8px;
}

.intensity-bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--green), var(--blue));
}

.readiness-panel,
.rhythm-panel,
.today-preview {
  padding: 14px;
  margin-bottom: 12px;
}

.section-heading.tight {
  align-items: center;
  margin-bottom: 10px;
}

.section-heading.tight h2 {
  font-size: 16px;
}

.rhythm-line {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 7px;
  margin: 12px 0 9px;
}

.rhythm-line span {
  height: 7px;
  border-radius: 999px;
  background: #e8eef5;
}

.rhythm-line span.done {
  background: var(--green);
}

.rhythm-line span.active {
  background: var(--blue);
}

.sticky-start {
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: calc(82px + var(--safe-bottom));
  z-index: 12;
  padding: 12px 0 0;
  background: linear-gradient(rgba(247, 248, 251, 0), var(--bg) 38%);
}

.section-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.pill {
  min-height: 28px;
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  background: var(--surface-strong);
  color: var(--muted);
  padding: 5px 10px;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.pill.strong {
  background: #e7f4ed;
  color: var(--green-dark);
}

.focus-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 14px;
}

.focus-grid div {
  min-height: 72px;
  border-radius: var(--radius);
  background: #f8fafc;
  border: 1px solid #e8eef5;
  padding: 10px;
}

.focus-grid span,
.metric-card span,
.exercise-preview span,
.exercise-card span,
.field span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.focus-grid strong {
  display: block;
  margin-top: 8px;
  font-size: 16px;
  line-height: 1.2;
}

.state-row,
.rating-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 14px;
}

.state-chip,
.rating-row button,
.quick-prompts button,
.small-button,
.text-button {
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  font-size: 13px;
  font-weight: 800;
}

.state-chip.active,
.rating-row button.active,
.quick-prompts button.active {
  border-color: var(--green);
  background: #e8f6ef;
  color: var(--green-dark);
}

.primary-action,
.secondary-action {
  width: 100%;
  min-height: 52px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  border: 0;
  border-radius: var(--radius);
  font-size: 16px;
  font-weight: 900;
}

.primary-action {
  background: var(--ink);
  color: #ffffff;
}

.secondary-action {
  margin-top: 4px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
}

.metric-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 12px;
}

.metric-card {
  min-height: 76px;
  padding: 12px 10px;
}

.metric-card strong {
  display: block;
  margin-top: 8px;
  font-size: 21px;
  line-height: 1;
}

.text-button,
.small-button {
  padding: 0 11px;
  color: var(--green-dark);
}

.text-button {
  min-height: 30px;
  border-color: transparent;
  background: transparent;
}

.exercise-preview {
  display: grid;
  gap: 8px;
}

.preview-row,
.week-item,
.exercise-card {
  border: 1px solid #e8eef5;
  border-radius: var(--radius);
  background: #fbfcfe;
}

.preview-row {
  min-height: 54px;
  display: grid;
  grid-template-columns: 28px 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 10px;
}

.preview-row b {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  font-size: 13px;
  font-weight: 900;
}

.preview-row strong {
  display: block;
  margin-bottom: 3px;
  font-size: 15px;
}

.preview-row em,
.preview-detail-button {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
  font-weight: 800;
}

.preview-detail-button {
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
}

.preview-detail-button:active {
  background: var(--surface-strong);
}

.exercise-detail-hero h2 {
  margin: 6px 0 12px;
  font-size: 24px;
}

.exercise-detail-list article {
  align-items: flex-start;
}

.exercise-detail-list strong {
  text-align: right;
  line-height: 1.45;
}

.week-list {
  display: grid;
  gap: 9px;
}

.week-item {
  min-height: 72px;
  display: grid;
  grid-template-columns: 52px 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 10px;
}

.week-date {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: var(--radius);
  background: var(--surface-strong);
  font-size: 12px;
  font-weight: 900;
}

.week-main strong {
  display: block;
  margin-bottom: 5px;
}

.week-main span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.week-status {
  font-size: 12px;
  font-weight: 900;
  color: var(--green-dark);
}

.split-days-grid,
.split-rest-mode {
  margin-bottom: 0;
}

.split-rest-controls {
  margin-top: 12px;
}

.weekday-grid,
.cycle-grid {
  display: grid;
  gap: 8px;
}

.weekday-grid {
  grid-template-columns: repeat(4, 1fr);
}

.cycle-grid {
  grid-template-columns: repeat(3, 1fr);
}

.split-chip {
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fbfcfe;
  color: var(--ink);
  font-size: 13px;
  font-weight: 900;
}

.split-chip.active {
  border-color: var(--green);
  background: #e8f6ef;
  color: var(--green-dark);
}

.split-theme-list {
  display: grid;
  gap: 10px;
}

.split-theme-card {
  border: 1px solid #e8eef5;
  border-radius: var(--radius);
  background: #fbfcfe;
  padding: 10px;
}

.split-theme-card .field {
  margin-bottom: 10px;
}

.split-theme-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.split-theme-meta span {
  min-height: 24px;
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  background: var(--surface-strong);
  color: var(--muted);
  padding: 3px 8px;
  font-size: 11px;
  font-weight: 900;
}

.training-hero {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  min-height: 112px;
  padding: 16px 14px;
  margin-bottom: 12px;
}

.progress-ring {
  width: 72px;
  height: 72px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background:
    radial-gradient(circle at center, var(--surface) 58%, transparent 59%),
    conic-gradient(var(--green) var(--progress, 0%), #e2e9e4 0);
}

.progress-ring span {
  font-size: 15px;
  font-weight: 900;
}

.exercise-list {
  display: grid;
  gap: 10px;
  margin-bottom: 12px;
}

.exercise-card {
  padding: 12px;
}

.focus-exercise {
  padding: 16px;
  border-color: transparent;
  background:
    linear-gradient(#ffffff, #ffffff) padding-box,
    linear-gradient(135deg, rgba(91, 124, 250, 0.42), rgba(32, 201, 151, 0.38)) border-box;
}

.exercise-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.exercise-top h3 {
  margin: 3px 0 0;
  font-size: 17px;
}

.set-count {
  min-width: 56px;
  min-height: 30px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 999px;
  background: #e8f6ef;
  color: var(--green-dark);
  font-size: 12px;
  font-weight: 900;
}

.rest-button {
  padding: 0 12px;
}

.rest-button.active {
  background: var(--ink);
  color: #ffffff;
}

.rest-timer {
  position: relative;
  width: 148px;
  height: 148px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin: 8px auto 16px;
  border: 0;
  border-radius: 50%;
  background: conic-gradient(var(--blue) var(--rest-progress, 0%), #e8eef5 0);
  color: var(--ink);
  padding: 0;
  overflow: hidden;
}

.rest-timer::before {
  content: "";
  position: absolute;
  inset: 12px;
  border-radius: 50%;
  background: #ffffff;
}

.rest-timer span {
  position: relative;
  z-index: 1;
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  text-align: center;
}

.rest-timer strong {
  position: relative;
  z-index: 1;
  display: block;
  font-size: 28px;
  line-height: 1;
  text-align: center;
}

.rest-timer.active {
  background: conic-gradient(var(--blue) var(--rest-progress, 0%), #e8eef5 0);
  color: var(--ink);
}

.rest-timer.paused {
  background: conic-gradient(var(--amber) var(--rest-progress, 0%), #e8eef5 0);
}

.set-track {
  display: grid;
  grid-template-columns: repeat(var(--set-count, 4), 1fr);
  gap: 8px;
  margin-bottom: 14px;
}

.set-track span {
  height: 8px;
  border-radius: 999px;
  background: #e8eef5;
}

.set-track span.active {
  background: var(--blue);
}

.set-track span.done {
  background: var(--green);
}

.exercise-meta {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 10px;
}

.exercise-meta div {
  min-height: 54px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 8px;
}

.exercise-meta strong {
  display: block;
  margin-top: 5px;
  font-size: 14px;
}

.exercise-meta.quiet div {
  border: 0;
  background: #f8fafc;
}

.exercise-primary {
  margin: 2px 0 10px;
}

.exercise-primary.completed {
  background: var(--green-dark);
}

.exercise-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 10px;
}

.exercise-actions button {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  font-size: 13px;
  font-weight: 900;
}

.exercise-actions button.done {
  background: var(--ink);
  color: #ffffff;
}

.exercise-secondary {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.exercise-secondary button {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #ffffff;
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
}

.exercise-secondary .danger {
  border-color: rgba(255, 107, 107, 0.36);
  background: #fff1f1;
  color: #d73b3b;
}

.up-next {
  display: grid;
  gap: 8px;
  margin-bottom: 12px;
}

.next-row {
  min-height: 46px;
  display: grid;
  grid-template-columns: 26px 1fr auto;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid var(--line);
}

.next-row span {
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #eef3f7;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.next-row strong {
  font-size: 14px;
}

.next-row em {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
  font-weight: 800;
}

.next-row.done {
  opacity: 0.55;
}

.trend-chart {
  height: 180px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  align-items: end;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fbfcfe;
  padding: 12px;
  margin-bottom: 12px;
}

.trend-chart div {
  position: relative;
  min-height: 36px;
  height: var(--value);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  border-radius: var(--radius);
  background: var(--green);
}

.trend-chart div:nth-child(2) {
  background: var(--blue);
}

.trend-chart div:nth-child(3) {
  background: var(--coral);
}

.trend-chart span {
  position: absolute;
  bottom: 8px;
  color: #ffffff;
  font-size: 12px;
  font-weight: 900;
}

.insight-list {
  display: grid;
  gap: 8px;
}

.insight-list article {
  display: grid;
  grid-template-columns: 10px 1fr;
  gap: 10px;
  align-items: start;
  border: 1px solid #e7ede8;
  border-radius: var(--radius);
  background: #fbfcfe;
  padding: 10px;
}

.insight-list p {
  margin-bottom: 0;
  color: #334155;
  font-size: 14px;
  line-height: 1.45;
}

.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-top: 5px;
}

.dot.green {
  background: var(--green);
}

.dot.amber {
  background: var(--amber);
}

.dot.blue {
  background: var(--blue);
}

.chat-list {
  min-height: calc(100svh - 324px);
  display: grid;
  align-content: end;
  gap: 10px;
  padding-bottom: 20px;
}

.mate-profile {
  display: grid;
  grid-template-columns: 48px 1fr;
  gap: 12px;
  align-items: center;
  padding: 14px;
  margin-bottom: 12px;
}

.mate-profile h2 {
  margin-bottom: 4px;
  font-size: 18px;
}

.mate-profile span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.message {
  max-width: 84%;
  border-radius: var(--radius);
  padding: 11px 12px;
}

.message p {
  margin-bottom: 0;
  font-size: 15px;
  line-height: 1.48;
}

.message span {
  display: block;
  margin-bottom: 5px;
  font-size: 11px;
  font-weight: 900;
}

.message.coach {
  justify-self: start;
  background: var(--surface);
  border: 1px solid var(--line);
}

.message.coach span {
  color: var(--green-dark);
}

.message.user {
  justify-self: end;
  background: var(--ink);
  color: #ffffff;
}

.user-hero {
  display: grid;
  grid-template-columns: 58px 1fr;
  gap: 12px;
  align-items: center;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--line);
  padding: 14px;
  margin-bottom: 12px;
}

.user-avatar {
  width: 58px;
  height: 58px;
  display: grid;
  place-items: center;
  border-radius: var(--radius);
  background:
    linear-gradient(135deg, rgba(17, 24, 39, 0.96), rgba(32, 201, 151, 0.92));
  color: #ffffff;
  font-size: 20px;
  font-weight: 900;
}

.user-hero h2 {
  margin-bottom: 4px;
  font-size: 22px;
}

.user-hero span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.user-identity {
  min-width: 0;
}

.identity-edit {
  min-height: 28px;
  margin-top: 6px;
  padding: 0;
}

.user-metrics {
  margin-bottom: 12px;
}

.user-section h2 {
  font-size: 18px;
}

.user-tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-bottom: 12px;
}

.user-tag-row span {
  min-height: 26px;
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  background: #e8f6ef;
  color: var(--green-dark);
  padding: 4px 9px;
  font-size: 12px;
  font-weight: 900;
}

.profile-list,
.settings-list,
.event-list {
  display: grid;
  gap: 8px;
}

.profile-list article,
.settings-list article,
.event-list article {
  min-height: 48px;
  display: grid;
  grid-template-columns: 96px 1fr;
  align-items: center;
  gap: 10px;
  border: 1px solid #e8eef5;
  border-radius: var(--radius);
  background: #fbfcfe;
  padding: 9px 10px;
}

.profile-list span,
.settings-list span,
.event-list span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.profile-list strong,
.settings-list strong,
.event-list strong {
  min-width: 0;
  color: var(--ink);
  font-size: 14px;
  line-height: 1.35;
}

.event-list {
  margin-top: 10px;
}

.event-list article {
  grid-template-columns: 76px 1fr;
  border-color: rgba(255, 176, 32, 0.34);
  background: #fffaf0;
}

.event-list article.danger {
  border-color: rgba(255, 107, 107, 0.36);
  background: #fff5f5;
}

.event-list p {
  margin-bottom: 0;
  color: #334155;
  font-size: 13px;
  line-height: 1.42;
}

.user-actions {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin-bottom: 12px;
}

.user-actions button {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #ffffff;
  color: var(--ink);
  font-size: 13px;
  font-weight: 900;
}

.user-actions button:first-child {
  border-color: var(--green);
  background: #e8f6ef;
  color: var(--green-dark);
}

.user-movement-list {
  max-height: 174px;
  overflow-y: auto;
  display: grid;
  gap: 8px;
  padding-right: 2px;
}

.user-movement-list article {
  border: 1px solid #e8eef5;
  border-radius: var(--radius);
  background: #fbfcfe;
  padding: 9px 10px;
}

.ai-hero {
  background:
    linear-gradient(#ffffff, #ffffff) padding-box,
    linear-gradient(135deg, rgba(32, 201, 151, 0.45), rgba(91, 124, 250, 0.32)) border-box;
  border-color: transparent;
}

.ai-option-grid .option-card {
  min-height: 78px;
}

.quick-prompts {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 10px;
}

.quick-prompts.more-prompts {
  grid-template-columns: repeat(2, 1fr);
  margin-top: -2px;
}

.quick-prompts button {
  min-width: 0;
  padding: 0 8px;
}

.mate-composer {
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: calc(74px + var(--safe-bottom));
  z-index: 8;
  border-top: 1px solid rgba(226, 232, 240, 0.88);
  background: linear-gradient(180deg, rgba(247, 248, 251, 0.82), var(--bg) 22%);
  padding: 12px 0 10px;
  backdrop-filter: blur(16px);
}

.chat-input {
  display: grid;
  grid-template-columns: 1fr 46px;
  gap: 8px;
}

.chat-input input {
  min-width: 0;
  height: 46px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  padding: 0 12px;
  outline: none;
}

.chat-input input:focus {
  border-color: var(--green);
}

.send {
  height: 46px;
  width: 46px;
  flex-basis: 46px;
  background: var(--ink);
  color: #ffffff;
}

.tabbar {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 2px;
  border-top: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.94);
  padding: 8px 8px calc(8px + var(--safe-bottom));
  backdrop-filter: blur(18px);
}

.tab {
  min-width: 0;
  height: 58px;
  display: grid;
  place-items: center;
  gap: 2px;
  border: 0;
  border-radius: var(--radius);
  background: transparent;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.tab svg {
  width: 21px;
  height: 21px;
}

.tab.active {
  background: #e8f6ef;
  color: var(--green-dark);
}

.sheet {
  position: fixed;
  inset: 0;
  display: none;
  align-items: flex-end;
  justify-content: center;
  background: rgba(10, 14, 12, 0.42);
  padding: 0 12px;
  z-index: 20;
}

.sheet.open {
  display: flex;
}

#movementPickerSheet {
  z-index: 44;
}

.sheet-panel {
  width: min(100%, 430px);
  border-radius: 8px 8px 0 0;
  background: var(--bg);
  padding: 10px 14px calc(18px + var(--safe-bottom));
  box-shadow: 0 -18px 42px rgba(0, 0, 0, 0.18);
}

.sheet-handle {
  width: 48px;
  height: 4px;
  margin: 0 auto 16px;
  border-radius: 999px;
  background: #ccd5cf;
}

.field {
  display: block;
  margin-bottom: 12px;
}

.field span {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.field input,
.field select {
  width: 100%;
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  padding: 0 12px;
  outline: none;
}

.field input:focus,
.field select:focus {
  border-color: var(--green);
}

.review-copy {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 12px;
  color: #263244;
  font-size: 15px;
  line-height: 1.5;
}

.review-detail-list {
  display: grid;
  gap: 8px;
  margin: 10px 0;
}

.review-detail-list:empty {
  display: none;
}

.review-detail-list article {
  border: 1px solid #e4ebf2;
  border-radius: var(--radius);
  background: #fbfcfe;
  padding: 10px 12px;
}

.review-detail-list strong {
  display: block;
  margin-bottom: 6px;
  color: #0f172a;
  font-size: 13px;
}

.review-detail-list ul {
  display: grid;
  gap: 5px;
  margin: 0;
  padding-left: 18px;
  color: #475569;
  font-size: 13px;
  line-height: 1.42;
}

.review-detail-list article.risk {
  border-color: rgba(255, 107, 107, 0.32);
  background: #fff7f7;
}

.review-panel .rating-row {
  grid-template-columns: repeat(3, 1fr);
}

.movement-picker-panel {
  max-height: min(78svh, 660px);
  display: flex;
  flex-direction: column;
}

.movement-picker-note {
  margin: 0 0 10px;
  color: #334155;
  font-size: 14px;
  font-weight: 800;
}

.movement-picker-list {
  min-height: 0;
  overflow-y: auto;
  display: grid;
  gap: 8px;
  padding-right: 2px;
}

.movement-picker-item {
  min-height: 58px;
  display: grid;
  grid-template-columns: 1fr 68px;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 9px 10px;
}

.movement-picker-item.selected {
  border-color: var(--green);
  background: #e8f6ef;
}

.movement-picker-item strong,
.user-movement-list strong {
  display: block;
  font-size: 14px;
}

.movement-picker-item span,
.user-movement-list span {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.movement-picker-item button {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--ink);
  color: #ffffff;
  font-size: 12px;
  font-weight: 900;
}

.movement-picker-item.selected button {
  border-color: rgba(255, 107, 107, 0.18);
  background: #fff1f1;
  color: #d94848;
}

.movement-picker-item button:disabled {
  background: #e8eef5;
  color: var(--muted);
  cursor: not-allowed;
}

.pill.compact {
  min-height: 24px;
  margin-top: 8px;
  padding: 4px 8px;
}

.primary-action.compact,
.secondary-action.compact {
  min-height: 46px;
}

.onboarding {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: none;
  align-items: stretch;
  justify-content: center;
  background: var(--bg);
  padding: 18px 14px calc(18px + var(--safe-bottom));
}

.onboarding.open {
  display: flex;
}

.onboarding-panel {
  width: min(100%, 430px);
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 16px;
  box-shadow: var(--shadow);
}

.onboarding-progress {
  display: grid;
  grid-template-columns: repeat(var(--step-count, 7), 1fr);
  gap: 6px;
  margin-bottom: 18px;
}

.onboarding-progress span {
  height: 6px;
  border-radius: 999px;
  background: #e8eef5;
}

.onboarding-progress span.done {
  background: var(--green);
}

.onboarding-copy {
  margin: 10px 0 18px;
  color: #334155;
  font-size: 15px;
  line-height: 1.55;
}

.onboarding-body {
  flex: 1;
  overflow-y: auto;
  padding-bottom: 12px;
}

.onboarding-actions {
  display: grid;
  grid-template-columns: 0.8fr 1.2fr;
  gap: 10px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.onboarding-actions.single-action {
  grid-template-columns: 1fr;
}

.option-grid {
  display: grid;
  gap: 9px;
}

.option-grid.two {
  grid-template-columns: repeat(2, 1fr);
}

.option-grid.three {
  grid-template-columns: repeat(3, 1fr);
}

.option-grid.four {
  grid-template-columns: repeat(4, 1fr);
}

.option-card {
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fbfcfe;
  color: var(--ink);
  padding: 10px;
  text-align: left;
  font-size: 14px;
  font-weight: 800;
}

.option-card span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.35;
}

.option-card.active {
  border-color: var(--green);
  background: #e8f6ef;
  color: var(--green-dark);
}

.concern-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 9px;
}

.concern-grid .option-card {
  min-height: 38px;
  text-align: center;
}

.onboarding-group {
  margin-bottom: 16px;
}

.onboarding-group h3 {
  margin: 0 0 9px;
  font-size: 15px;
  line-height: 1.25;
}

.compact-group {
  margin-bottom: 12px;
}

.profile-intake {
  display: grid;
  grid-template-columns: 92px 1fr;
  gap: 10px;
  align-items: end;
}

.avatar-field input {
  text-align: center;
  font-size: 18px;
  font-weight: 900;
}

.unit-input {
  position: relative;
}

.unit-input input {
  padding-right: 42px;
}

.unit-input em {
  position: absolute;
  right: 12px;
  top: 50%;
  color: var(--muted);
  font-size: 13px;
  font-style: normal;
  font-weight: 800;
  transform: translateY(-50%);
}

.optional-row {
  min-height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fbfcfe;
  padding: 10px 12px;
}

.optional-row span {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.optional-row strong,
.optional-row em {
  font-size: 13px;
  font-style: normal;
  font-weight: 800;
}

.optional-row em {
  color: var(--muted);
  white-space: nowrap;
}

.onboarding-input-list {
  display: grid;
  gap: 10px;
  margin-bottom: 16px;
}

.onboarding-input-list .field {
  margin-bottom: 0;
}

.plan-preview-title {
  margin: 0 0 10px;
  font-size: 15px;
}

.calibration-note {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.weight-collection {
  display: grid;
  gap: 10px;
}

.weight-row {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fbfcfe;
  padding: 10px;
}

.weight-row-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.weight-row-head button {
  min-height: 28px;
  border: 0;
  border-radius: var(--radius);
  background: #fff1f1;
  color: #d94848;
  padding: 0 9px;
  font-size: 12px;
  font-weight: 900;
}

.weight-row strong,
.movement-library strong {
  display: block;
  font-size: 14px;
}

.weight-fields {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.weight-field span {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.weight-field input {
  width: 100%;
  min-height: 42px;
  border: 1px solid #e8eef5;
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  padding: 0 10px;
  outline: none;
}

.weight-field input:focus {
  border-color: var(--green);
}

.movement-library {
  display: grid;
  gap: 8px;
}

.movement-library button {
  min-height: 52px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  padding: 9px 10px;
  text-align: left;
}

.movement-library span {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.empty-state {
  border: 1px dashed #cbd5e1;
  border-radius: var(--radius);
  background: #f8fafc;
  color: var(--muted);
  padding: 12px;
  font-size: 13px;
  font-weight: 800;
  text-align: center;
}

.inline-fields {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.inline-fields.three {
  grid-template-columns: repeat(3, 1fr);
}

.plan-preview-list {
  display: grid;
  gap: 8px;
}

.plan-preview-list article {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fbfcfe;
  padding: 10px;
}

.plan-preview-list strong,
.plan-preview-list span {
  display: block;
}

.plan-preview-list span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.set-editor {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fbfcfe;
  padding: 10px;
  margin-bottom: 12px;
}

.set-editor-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.set-editor-head strong {
  font-size: 15px;
}

.set-editor-head span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.number-controls {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 10px;
}

.number-control {
  border: 1px solid #e8eef5;
  border-radius: var(--radius);
  background: var(--surface);
  padding: 8px;
}

.number-control > span,
.feeling-row > span,
.set-log-list > span {
  display: block;
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.stepper {
  display: grid;
  grid-template-columns: 34px 1fr 34px;
  align-items: center;
  gap: 6px;
}

.stepper button {
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #ffffff;
  color: var(--ink);
  font-size: 18px;
  font-weight: 900;
}

.stepper strong {
  min-width: 0;
  text-align: center;
  font-size: 15px;
}

.feeling-options {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 7px;
}

.feeling-options button {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #ffffff;
  color: var(--ink);
  font-size: 12px;
  font-weight: 900;
}

.feeling-options button.active {
  border-color: var(--blue);
  background: #eef3ff;
  color: var(--blue);
}

.set-log-list {
  display: grid;
  gap: 7px;
  margin-bottom: 12px;
}

.set-log-row {
  min-height: 38px;
  display: grid;
  grid-template-columns: 52px 1fr auto;
  align-items: center;
  gap: 8px;
  border: 1px solid #e8eef5;
  border-radius: var(--radius);
  background: #ffffff;
  padding: 7px 8px;
}

.set-log-row strong {
  font-size: 12px;
}

.set-log-row span,
.set-log-row em {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
  font-weight: 800;
}

.set-log-row.done {
  border-color: rgba(32, 201, 151, 0.32);
  background: #f0fbf6;
}

.set-log-row.skipped {
  border-color: rgba(255, 176, 32, 0.34);
  background: #fff8eb;
}

.set-track span.skipped {
  background: var(--amber);
}

.decision-copy {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 12px;
  color: #263244;
  font-size: 15px;
  line-height: 1.5;
}

.decision-copy p {
  margin-bottom: 10px;
}

.decision-copy p:last-child {
  margin-bottom: 0;
}

.payload-preview {
  max-height: 220px;
  overflow: auto;
  margin-top: 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #f8fafc;
  padding: 10px;
  color: #263244;
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 12px;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
}

.decision-actions {
  display: grid;
  gap: 9px;
  margin-top: 12px;
}

.decision-actions button {
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  font-size: 14px;
  font-weight: 900;
}

.decision-actions button.primary {
  border-color: var(--ink);
  background: var(--ink);
  color: #ffffff;
}

.decision-actions button.danger {
  border-color: rgba(255, 107, 107, 0.42);
  background: #fff1f1;
  color: #d73b3b;
}

.safety-fields {
  display: grid;
  gap: 10px;
  margin-top: 10px;
}

.safety-severity {
  grid-template-columns: repeat(2, 1fr);
  margin-bottom: 0;
}

.safety-note {
  border-left: 3px solid var(--coral);
  background: #fff6f6;
  padding: 9px 10px;
  color: #8f2d2d;
  font-size: 13px;
  font-weight: 800;
}

@media (max-width: 430px) {
  body {
    background: var(--bg);
  }

  .app-frame {
    display: block;
  }

  .app-shell {
    width: 100vw;
    max-height: none;
    box-shadow: none;
  }
}

@media (min-width: 700px) {
  .app-shell {
    min-height: 880px;
    border-radius: 24px;
  }
}
