* {
  box-sizing: border-box;
}

body {
  margin: 0;
  padding: 48px 16px;
  background: #eef2f5;
  color: #1f2933;
  font-family: "Segoe UI", sans-serif;
}

main {
  max-width: 540px;
  margin: 0 auto;
  padding: 24px;
  background: white;
  border-radius: 12px;
}

h1 {
  margin: 0 0 16px;
  font-size: 28px;
}

h2 {
  margin: 40px 0 16px;
  font-size: 22px;
}

/* Puts the text box and the button side by side. */
form {
  display: flex;
  gap: 8px;
}

form input,
form select {
  flex: 1;
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid #7b8794;
  border-radius: 8px;
  font: inherit;
}

/* Without this, "display: flex" above would show a form that should be hidden. */
form[hidden] {
  display: none;
}

/* These forms have more boxes, so let them wrap onto more lines. */
#login-form,
#event-form {
  flex-wrap: wrap;
}

#login-form input,
#event-input {
  flex-basis: 100%;
}

/* Wide enough to show the whole date and time. */
#event-when {
  flex: 1 0 215px;
}

#event-repeat {
  flex: 1 0 165px;
}

form button {
  padding: 10px 18px;
  border: none;
  border-radius: 8px;
  background: #0b6e4f;
  color: white;
  font: inherit;
  cursor: pointer;
}

form button:hover {
  background: #095c42;
}

#problem {
  padding: 12px;
  border-radius: 8px;
  background: #fde8e8;
  color: #8a1c13;
}

#logout-button {
  margin-top: 32px;
  padding: 8px 0;
  border: none;
  background: none;
  color: #616e7c;
  font: inherit;
  text-decoration: underline;
  cursor: pointer;
}

ul {
  margin: 16px 0 0;
  padding: 0;
  list-style: none;
}

li {
  display: flex;
  align-items: center;
  border-bottom: 1px solid #e4e7eb;
}

.delete-button {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: #616e7c;
  font: inherit;
  cursor: pointer;
}

.delete-button:hover {
  background: #fde8e8;
  color: #b42318;
}

li label {
  display: flex;
  flex: 1;
  min-width: 0;
  align-items: center;
  gap: 12px;
  padding: 12px 4px 12px 8px;
  cursor: pointer;
}

/* The words take up the spare space, which pushes the tick button right. */
li span {
  flex: 1;
  min-width: 0;
  overflow-wrap: anywhere;
}

/* The date line under an event. */
li small {
  display: block;
  color: #616e7c;
}

/* Hide the normal square checkbox and draw a round one instead. */
li input {
  appearance: none;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  width: 26px;
  height: 26px;
  margin: 0;
  border: 2px solid #7b8794;
  border-radius: 50%;
  cursor: pointer;
}

li input:checked {
  border-color: #0b6e4f;
  background: #0b6e4f;
}

li input:checked::before {
  content: "\2713"; /* the tick symbol */
  color: white;
  font-size: 16px;
  font-weight: bold;
  line-height: 1;
}

/* When a task's checkbox is ticked, cross out its words. */
li:has(input:checked) span {
  color: #616e7c;
  text-decoration: line-through;
}
