:root {
  color-scheme: light;
  --bg: #f6f1ea;
  --panel: #fffdf8;
  --panel-strong: #e5f1ee;
  --ink: #20332f;
  --muted: #73817d;
  --line: #dae4df;
  --mint: #bfe4d9;
  --mint-dark: #6aa99b;
  --blue: #d8e8f5;
  --lemon: #f7e6a1;
  --rose: #f6d6d2;
  --shadow: 0 18px 50px rgba(59, 90, 84, .14);
}

* {
  box-sizing: border-box;
}

html,
body {
  touch-action: pan-x pan-y;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 15% 8%, rgba(191, 228, 217, .78), transparent 34%),
    radial-gradient(circle at 90% 2%, rgba(216, 232, 245, .88), transparent 32%),
    linear-gradient(180deg, #f8f3ec 0%, #edf6f2 100%);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
select {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

a {
  color: inherit;
  text-decoration: none;
}

.app-shell {
  width: min(1120px, 100%);
  margin: 0 auto;
  padding: 18px 16px 96px;
}

.top-card,
.planner-card,
.panel,
.login-card {
  background: rgba(255, 253, 248, .86);
  border: 1px solid rgba(255, 255, 255, .78);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.top-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-radius: 28px;
  padding: 18px 18px 20px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--mint-dark);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 28px;
  line-height: 1.1;
}

h2 {
  font-size: 18px;
}

.ghost-button {
  min-height: 40px;
  padding: 0 14px;
  border-radius: 8px;
  background: #edf5f2;
  color: var(--ink);
  font-weight: 700;
}

.planner-card,
.panel {
  border-radius: 24px;
  padding: 14px;
  margin-top: 14px;
}

.date-row {
  display: grid;
  grid-template-columns: minmax(132px, .7fr) 1.3fr;
  gap: 10px;
}

.field,
.search-field {
  display: grid;
  gap: 6px;
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

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

.date-row .ghost-button {
  align-self: end;
  min-height: 48px;
}

.field input:focus,
.field select:focus,
.search-field input:focus {
  border-color: var(--mint-dark);
  box-shadow: 0 0 0 3px rgba(106, 169, 155, .18);
}

.segments {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.segment {
  min-height: 42px;
  border-radius: 8px;
  background: #eef3f0;
  color: var(--muted);
  font-weight: 800;
}

.segment.active {
  background: var(--mint);
  color: #173c34;
}

.content-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

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

.panel-head span {
  min-width: 34px;
  min-height: 28px;
  border-radius: 8px;
  display: inline-grid;
  place-items: center;
  background: var(--panel-strong);
  color: var(--mint-dark);
  font-weight: 800;
}

.exercise-list,
.selected-list,
.recent-list,
.profile-list {
  display: grid;
  gap: 8px;
}

.exercise-card,
.selected-card,
.recent-item,
.list-button {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, .76);
  padding: 12px;
}

.list-button {
  width: 100%;
  display: grid;
  gap: 4px;
  color: var(--ink);
  text-align: left;
}

.date-button {
  width: 100%;
  display: grid;
  gap: 4px;
  padding: 0;
  background: transparent;
  color: var(--ink);
  text-align: left;
}

.date-button span {
  color: var(--muted);
  font-size: 14px;
}

.workout-details {
  display: grid;
  gap: 8px;
  padding-top: 8px;
}

.inline-date {
  margin-bottom: 0;
}

.list-button span {
  color: var(--muted);
  font-size: 14px;
}

.exercise-card {
  display: grid;
  gap: 7px;
}

.exercise-main {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.exercise-title,
.selected-title {
  font-weight: 850;
}

.exercise-desc,
.recent-item,
.empty-state {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.42;
}

.tag {
  align-self: start;
  border-radius: 8px;
  background: var(--blue);
  color: #31566d;
  padding: 5px 8px;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.add-button,
.remove-button,
.primary-button,
.set-button {
  min-height: 42px;
  border-radius: 8px;
  font-weight: 850;
}

.add-button,
.set-button {
  background: var(--lemon);
  color: #564915;
}

.remove-button {
  background: var(--rose);
  color: #7b352e;
  padding: 0 12px;
}

.primary-button {
  width: 100%;
  margin-top: 12px;
  background: #88c9b9;
  color: #12372f;
  padding: 0 16px;
}

.selected-card {
  display: grid;
  gap: 10px;
}

.selected-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.sets-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.sets-grid input {
  width: 100%;
  min-height: 38px;
  border-radius: 8px;
  border: 1px solid var(--line);
  padding: 0 9px;
}

.recent-item {
  display: grid;
  gap: 4px;
}

.recent-item strong {
  color: var(--ink);
}

.recent-item span {
  color: var(--muted);
}

.qr-box {
  display: grid;
  gap: 12px;
}

.qr-box img {
  width: min(260px, 100%);
  aspect-ratio: 1;
  justify-self: center;
  border-radius: 8px;
  background: white;
  padding: 10px;
  border: 1px solid var(--line);
}

.link-button {
  min-height: 42px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--blue);
  color: #31566d;
  font-weight: 850;
}

.compact-action {
  margin-top: 0;
}

.profile-form {
  display: grid;
  gap: 8px;
}

.check-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 750;
}

.hidden {
  display: none !important;
}

.bottom-nav {
  position: fixed;
  left: 50%;
  bottom: 14px;
  z-index: 10;
  transform: translateX(-50%);
  width: min(390px, calc(100% - 28px));
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  padding: 8px;
  border-radius: 22px;
  background: rgba(255, 253, 248, .9);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}

.nav-item {
  min-height: 44px;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-weight: 800;
}

.nav-item.active {
  background: var(--mint);
  color: #173c34;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 86px;
  transform: translateX(-50%);
  width: min(420px, calc(100% - 32px));
  min-height: 42px;
  display: none;
  place-items: center;
  border-radius: 8px;
  background: rgba(32, 51, 47, .94);
  color: white;
  padding: 10px 14px;
  text-align: center;
  font-weight: 700;
}

.toast.visible {
  display: grid;
}

.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 22px;
}

.login-card {
  width: min(430px, 100%);
  border-radius: 28px;
  padding: 24px;
}

.login-card h1 {
  margin-bottom: 18px;
}

.login-note {
  margin-top: 14px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.4;
}

@media (max-width: 760px) {
  .app-shell {
    max-width: 430px;
  }

  .content-grid {
    grid-template-columns: 1fr;
  }

  .date-row,
  .sets-grid {
    grid-template-columns: 1fr 1fr;
  }

  .selected-panel {
    order: -1;
  }

  h1 {
    font-size: 24px;
  }
}

@media (max-width: 380px) {
  .segments,
  .date-row,
  .sets-grid {
    grid-template-columns: 1fr;
  }
}
