* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Arial, sans-serif;
  background: #f4f6f8;
  color: #222;
}

.app {
  min-height: 100vh;
  padding: 40px 16px;
}

.todo {
  max-width: 900px;
  margin: 0 auto;
  background: #fff;
  border-radius: 16px;
  padding: 24px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
}

.todo__title {
  margin: 0 0 24px;
  text-align: center;
  font-size: 32px;
}

.todo__controls {
  display: grid;
  gap: 16px;
  margin-bottom: 24px;
}

.todo-form {
  display: grid;
  grid-template-columns: 1fr 180px 140px;
  gap: 12px;
}

.todo-form__input,
.todo-form__date,
.todo-form__button,
.todo__search,
.todo__select {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid #cfd6dd;
  border-radius: 10px;
  font-size: 16px;
}

.todo-form__button {
  cursor: pointer;
  background: #222;
  color: #fff;
  border: none;
}

.todo__filters {
  display: flex;
  gap: 12px;
}

.todo-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.todo-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 16px;
  border: 1px solid #e3e7eb;
  border-radius: 12px;
  margin-bottom: 12px;
  background: #fff;
}

.todo-item__info {
  flex: 1;
  min-width: 0;
}

.todo-item__title {
  margin: 0 0 8px;
  font-size: 18px;
  word-break: break-word;
}

.todo-item__date {
  margin: 0;
  color: #666;
}

.todo-item__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.todo-item__edit,
.todo-item__toggle,
.todo-item__delete,
.todo-item__save,
.todo-item__cancel {
  border: none;
  border-radius: 8px;
  padding: 10px 12px;
  cursor: pointer;
  color: white;
}

.todo-item__edit {
  background: #0d6efd;
}

.todo-item__toggle {
  background: #198754;
}

.todo-item__delete {
  background: #d9534f;
}

.todo-item--completed {
  opacity: 0.7;
}

.todo-item--completed .todo-item__title {
  text-decoration: line-through;
}

.todo-item__edit-wrap {
  display: grid;
  grid-template-columns: 1fr 180px auto auto;
  gap: 10px;
  width: 100%;
}

.todo-item__edit-input,
.todo-item__edit-date {
  padding: 10px 12px;
  border: 1px solid #cfd6dd;
  border-radius: 8px;
  font-size: 16px;
}

.todo-item__save {
  background: #198754;
}

.todo-item__cancel {
  background: #6c757d;
}

.todo-list__empty {
  padding: 20px;
  text-align: center;
  color: #777;
  border: 1px dashed #cfd6dd;
  border-radius: 12px;
}

.todo-item--dragging {
  opacity: 0.5;
}

.todo-form__button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.todo-form__input:focus,
.todo-form__date:focus,
.todo__search:focus,
.todo__select:focus,
.todo-item__edit-input:focus,
.todo-item__edit-date:focus {
  outline: 2px solid #99c2ff;
  border-color: #99c2ff;
}

.todo-form__button:hover,
.todo-item__edit:hover,
.todo-item__toggle:hover,
.todo-item__delete:hover,
.todo-item__save:hover,
.todo-item__cancel:hover {
  filter: brightness(0.95);
}

@media (max-width: 768px) {
  .todo {
    padding: 18px;
  }

  .todo__title {
    font-size: 26px;
  }

  .todo-form {
    grid-template-columns: 1fr;
  }

  .todo__filters {
    flex-direction: column;
  }

  .todo-item {
    flex-direction: column;
    align-items: stretch;
  }

  .todo-item__actions {
    justify-content: stretch;
  }

  .todo-item__actions button {
    width: 100%;
  }

  .todo-item__edit-wrap {
    grid-template-columns: 1fr;
  }
}