:root {
  --bg: #f4f1ea;
  --surface: #ffffff;
  --surface-soft: #f8f6f0;
  --ink: #111814;
  --muted: #65706b;
  --line: #d7d0c2;
  --line-soft: #ece6dc;
  --green: #245746;
  --green-soft: #e9f0ec;
  --yellow: #f4c45f;
  --yellow-ink: #1d1604;
  --blue-soft: #e6eef5;
  --blue-ink: #102033;
  --danger-bg: #f7dfd7;
  --danger: #7a2f1a;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: Arial, Helvetica, sans-serif;
  min-height: 100vh;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  -webkit-tap-highlight-color: transparent;
  cursor: pointer;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid var(--yellow);
  outline-offset: 2px;
}

svg {
  width: 1.25rem;
  height: 1.25rem;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.screen {
  min-height: 100vh;
  background: var(--bg);
}

.center-screen {
  display: grid;
  place-items: center;
  padding: max(1.25rem, env(safe-area-inset-top)) 1rem max(1.25rem, env(safe-area-inset-bottom));
}

.app-shell {
  width: min(100%, 28rem);
  min-height: 100vh;
  margin: 0 auto;
  padding: max(1.25rem, env(safe-area-inset-top)) 1rem max(1.5rem, env(safe-area-inset-bottom));
  background: var(--surface-soft);
  box-shadow: 0 0 0 1px rgb(17 24 20 / 6%);
}

.topbar,
.hero-row,
.panel-head,
.post-head,
.sheet-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.eyebrow {
  margin: 0;
  color: var(--muted);
  font-size: .75rem;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

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

h1 {
  margin-bottom: 0;
  font-size: 2rem;
  line-height: 1.05;
}

h2 {
  margin-bottom: 0;
  font-size: 1rem;
}

h3 {
  margin-bottom: 0;
  font-size: .9rem;
}

.muted {
  color: var(--muted);
  font-size: .9rem;
  line-height: 1.55;
}

.login-card,
.panel {
  border: 1px solid var(--line);
  border-radius: .5rem;
  background: var(--surface);
}

.login-card {
  width: min(100%, 28rem);
  padding: 1.25rem;
}

.form-stack {
  display: grid;
  gap: 1rem;
  margin-top: 1.25rem;
}

label span,
.range-label > span,
legend {
  display: block;
  color: #202a24;
  font-size: .875rem;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  min-height: 3rem;
  margin-top: .5rem;
  border: 1px solid var(--line);
  border-radius: .375rem;
  background: var(--surface-soft);
  color: var(--ink);
  padding: 0 .75rem;
  font-size: 1rem;
}

textarea {
  min-height: 6rem;
  resize: vertical;
  padding-top: .75rem;
  line-height: 1.5;
}

.error {
  margin: 0;
  border-radius: .375rem;
  background: var(--danger-bg);
  color: var(--danger);
  padding: .75rem;
  font-size: .875rem;
  font-weight: 700;
}

.primary,
.secondary,
.icon-button {
  border: 0;
  border-radius: .375rem;
  font-weight: 700;
}

.primary {
  display: flex;
  min-height: 3rem;
  width: 100%;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  padding: 0 1rem;
}

.primary:disabled {
  opacity: .6;
}

.primary.dark {
  background: var(--ink);
  color: #fff;
}

.primary.warm {
  background: var(--yellow);
  color: var(--yellow-ink);
}

.secondary {
  min-height: 2.5rem;
  border: 1px solid var(--line);
  background: var(--surface);
  color: #38433e;
  padding: 0 .75rem;
}

.hero {
  margin-top: 1.25rem;
  border-radius: .5rem;
  background: var(--ink);
  color: #fff;
  padding: 1rem;
}

.hero p {
  margin-bottom: 0;
  color: #b8c8bd;
  font-size: .9rem;
}

.hero h2 {
  margin-top: .25rem;
  font-size: 1.5rem;
}

.hero span {
  border-radius: .375rem;
  background: rgb(255 255 255 / 12%);
  color: var(--yellow);
  padding: .35rem .5rem;
  font-size: .75rem;
  font-weight: 700;
}

.hero-copy {
  margin: .75rem 0 1.25rem;
  line-height: 1.55;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: .5rem;
  margin-top: 1rem;
}

.stat-grid div {
  border: 1px solid var(--line);
  border-radius: .375rem;
  background: var(--surface);
  padding: .75rem;
}

.stat-grid p {
  margin-bottom: .25rem;
  color: var(--muted);
  font-size: .75rem;
}

.stat-grid strong {
  display: block;
  overflow: hidden;
  font-size: 1.25rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.panel {
  margin-top: 1rem;
  padding: 1rem;
}

.panel.no-pad {
  padding: 0;
}

.panel.compact {
  padding: .85rem 1rem 1rem;
}

.program-panel {
  margin-top: 1.25rem;
}

.program-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.program-head h2 {
  margin-top: .25rem;
  font-size: 1.5rem;
}

.program-head strong {
  border-radius: .5rem;
  background: var(--green-soft);
  color: var(--green);
  padding: .45rem .65rem;
}

.panel-head p {
  margin: .25rem 0 0;
  color: var(--muted);
  font-size: .875rem;
}

.icon-box {
  display: grid;
  width: 3rem;
  height: 3rem;
  place-items: center;
  border-radius: .5rem;
  background: var(--blue-soft);
  color: var(--blue-ink);
}

.progress {
  height: .5rem;
  margin-top: 1rem;
  overflow: hidden;
  border-radius: 999px;
  background: var(--line-soft);
}

.progress span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--green);
}

.phase-progress-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: .85rem;
  color: var(--text-muted);
}
.phase-progress-head strong {
  font-size: .85rem;
  color: var(--text);
}
.phase-progress {
  margin-top: .5rem;
}
.phase-progress-label {
  margin-top: .5rem;
  font-size: .8rem;
  color: var(--text-muted);
}

.check-list {
  display: grid;
  gap: .5rem;
  margin-top: 1rem;
}

.check-list div {
  display: flex;
  min-height: 1.75rem;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  color: #38433e;
  font-size: .875rem;
}

.check-list b {
  display: grid;
  width: 1.5rem;
  height: 1.5rem;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 999px;
  background: var(--line-soft);
  color: #80776b;
}

.check-list b.ready {
  background: var(--green);
  color: #fff;
}

.section-title {
  border-bottom: 1px solid var(--line-soft);
  padding: .85rem 1rem;
}

.exercise-list,
.post-list {
  display: grid;
}

.exercise-list.program-first {
  margin-top: 1rem;
  border: 1px solid var(--line-soft);
  border-radius: .5rem;
  overflow: hidden;
}

.exercise-list button {
  display: grid;
  min-height: 4.25rem;
  grid-template-columns: 1fr auto;
  gap: .75rem;
  align-items: start;
  border: 0;
  border-bottom: 1px solid var(--line-soft);
  background: transparent;
  color: var(--ink);
  padding: .85rem 1rem;
  text-align: left;
}

.exercise-list button:last-child {
  border-bottom: 0;
}

.exercise-list small {
  display: block;
  margin-top: .25rem;
  color: var(--muted);
  line-height: 1.35;
}

.exercise-list em {
  border-radius: .375rem;
  background: var(--green-soft);
  color: var(--green);
  padding: .35rem .5rem;
  font-size: .75rem;
  font-style: normal;
  font-weight: 700;
}

.exercise-list button.completed {
  background: #fbf8ef;
}

.exercise-list button.completed em {
  background: var(--green);
  color: #fff;
}

.finish-workout {
  margin-top: 1rem;
}

.rules {
  margin: .75rem 0 0;
  padding-left: 1.25rem;
  color: #38433e;
  font-size: .9rem;
  line-height: 1.65;
}

.empty {
  margin: 0;
  padding: 1rem;
  color: var(--muted);
  font-size: .9rem;
}

.post {
  border-bottom: 1px solid var(--line-soft);
  padding: .85rem 1rem;
}

.post:last-child {
  border-bottom: 0;
}

.post-head p {
  margin: .25rem 0 0;
  color: var(--muted);
  font-size: .75rem;
}

.icon-button {
  display: grid;
  width: 2.25rem;
  height: 2.25rem;
  place-items: center;
  background: transparent;
  color: #80776b;
}

.kg-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .5rem;
  margin-top: .75rem;
}

.kg-grid p {
  margin: 0;
  border-radius: .375rem;
  background: var(--surface-soft);
  color: #38433e;
  padding: .6rem;
  font-size: .75rem;
  line-height: 1.4;
}

.kg-grid small {
  display: block;
  margin-top: .35rem;
  color: var(--muted);
  line-height: 1.35;
}

.note {
  margin: .75rem 0 0;
  color: #38433e;
  font-size: .875rem;
  line-height: 1.55;
}

.soreness-actions {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: .5rem;
  margin-top: .75rem;
}

.soreness-actions button,
.soreness-field button {
  min-height: 2.5rem;
  border: 1px solid var(--line);
  border-radius: .375rem;
  background: var(--surface);
  color: #38433e;
  font-size: .8rem;
  font-weight: 700;
}

.sheet-backdrop {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: flex;
  align-items: flex-end;
  background: rgb(17 24 20 / 45%);
  padding: 2rem .75rem max(.75rem, env(safe-area-inset-bottom));
}

.sheet {
  width: min(100%, 28rem);
  max-height: 92vh;
  margin: 0 auto;
  overflow-y: auto;
  border-radius: .5rem;
  background: var(--surface-soft);
  padding: 1rem;
  box-shadow: 0 1.5rem 4rem rgb(17 24 20 / 35%);
}

.two-col {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .75rem;
  margin-top: 1.25rem;
}

.compact .two-col {
  margin-top: 0;
}

.inline-panel {
  margin-top: 1.25rem;
}

.exercise-picker {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .5rem;
  padding: .75rem;
}

.exercise-picker button {
  min-height: 3.5rem;
  border: 1px solid var(--line);
  border-radius: .375rem;
  background: var(--surface);
  color: #38433e;
  padding: .6rem;
  text-align: left;
}

.exercise-picker button.active {
  border-color: var(--green);
  background: var(--green-soft);
  color: var(--green);
}

.exercise-picker b,
.exercise-picker span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.exercise-picker span {
  margin-top: .25rem;
  font-size: .75rem;
  font-weight: 700;
}

.kg-input {
  display: block;
  border-top: 1px solid var(--line-soft);
  padding: 1rem;
}

.kg-input small {
  display: block;
  margin-top: .25rem;
  color: var(--muted);
  font-size: .75rem;
}

.range-label {
  display: block;
  margin-top: 1.25rem;
}

.range-label b {
  float: right;
  border-radius: .375rem;
  background: var(--green-soft);
  color: var(--green);
  padding: .25rem .5rem;
}

input[type="range"] {
  min-height: auto;
  padding: 0;
  accent-color: var(--green);
}

.toggle-box {
  margin-top: 1.25rem;
  border: 1px solid var(--line);
  border-radius: .5rem;
  background: var(--surface);
  padding: 0 1rem;
}

.mini-toggle-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .5rem;
  margin-top: 1rem;
}

.toggle-row {
  display: flex;
  min-height: 3rem;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  border-top: 1px solid var(--line-soft);
}

.compact-toggle {
  min-height: 2.75rem;
  border: 1px solid var(--line);
  border-radius: .375rem;
  background: var(--surface);
  padding: .55rem .65rem;
}

.compact-toggle:first-child {
  border-top: 1px solid var(--line);
}

.compact-toggle span {
  font-size: .78rem;
}

.toggle-row:first-child {
  border-top: 0;
}

.toggle-row input {
  width: 1.25rem;
  min-height: 1.25rem;
  margin: 0;
  accent-color: var(--green);
}

.soreness-field {
  margin: 1.25rem 0 0;
  border: 0;
  padding: 0;
}

.soreness-field div {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .5rem;
  margin-top: .5rem;
}

.soreness-field button.active {
  border-color: var(--green);
  background: var(--green);
  color: #fff;
}

.exercise-sheet {
  display: grid;
  gap: 1rem;
}

.exercise-prescription {
  margin: 0;
  border-radius: .5rem;
  background: var(--green-soft);
  color: var(--green);
  padding: .75rem;
  font-size: .875rem;
  font-weight: 700;
  line-height: 1.45;
}
